Commit 2ada3539 by 高晓磊

场站列表增加场站状态的筛选条件

parent a40579be
......@@ -11,7 +11,7 @@ public interface StationDao extends BaseDao {
KObject load(UUID id);
Page<KObject> listStationInfoPaging(Page<KObject> page);
Page<KObject> listStationInfoPaging(Page<KObject> page, Integer stationStatus);
UUID create(KObject kObject);
......
......@@ -31,12 +31,15 @@ public class StationDaoImpl extends AbstractBaseDao implements StationDao, Stat
}
@Override
public Page<KObject> listStationInfoPaging(Page<KObject> page) {
public Page<KObject> listStationInfoPaging(Page<KObject> page, Integer stationStatus) {
// UUID departmentId = AminoContextHolder.getContext().getStaff().get("department").getUuid("id");
KClass bean = Amino.getStaticMetadataContext().getBean(StationConstant.ENTITY, KClass.class);
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(bean.getName());
// detachedCriteria.add(Restrictions.eq("department.id", departmentId));
detachedCriteria.add(Restrictions.eq("del", false));
if(null!=stationStatus){
detachedCriteria.add(Restrictions.eq("stationStatus", stationStatus));
}
int offset = page.getPageSize() * (page.getPageNo() - 1);
List<KObject> list = (List<KObject>) template.findByCriteria(detachedCriteria,offset,page.getPageSize());
page.setDatas(list);
......
......@@ -18,11 +18,11 @@ public class StationServiceImpl implements StationService {
private StationDao stationDao;
@Override
public Page<KObject> queryByPaging(Page<KObject> page) throws Exception {
public Page<KObject> queryByPaging(Page<KObject> page, Integer stationStatus) throws Exception {
if(page.getPageNo()==0||page.getPageSize()==0) {
throw new Exception("pageSize or offset is null");
}
return stationDao.listStationInfoPaging(page);
return stationDao.listStationInfoPaging(page,stationStatus);
}
@Override
......
......@@ -7,7 +7,7 @@ import java.util.UUID;
public interface StationService {
Page<KObject> queryByPaging(Page<KObject> page) throws Exception;
Page<KObject> queryByPaging(Page<KObject> page, Integer stationStatus) throws Exception;
UUID addStation(KObject kObject);
......
......@@ -29,18 +29,17 @@ public class StationController {
@Autowired
private StationService stationService;
@RequestMapping(value = "list/page", method = RequestMethod.GET)
public ResponseObj getListPage(
@RequestParam(name = "pageNo", required = false) Integer pageNo,
@RequestParam(name = "pageSize", required = false) Integer pageSize) throws Exception {
@RequestParam(name = "pageSize", required = false) Integer pageSize,
@RequestParam(name = "stationStatus", required = false) Integer stationStatus
) throws Exception {
Page<KObject> objectPage = new Page<>();
objectPage.setPageNo(pageNo);
objectPage.setPageSize(pageSize);
return ResponseObj.success("查询成功",stationService.queryByPaging(objectPage));
return ResponseObj.success("查询成功",stationService.queryByPaging(objectPage,stationStatus));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment