设备审批增加筛选条件

This commit is contained in:
lizhicheng 2022-09-27 16:43:20 +08:00
parent 22eea4c2f5
commit 1eb11c53ee
3 changed files with 21 additions and 6 deletions

View File

@ -116,10 +116,15 @@ public class TbDeviceApplyController {
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "deviceName", value = "设备名称", paramType = "query", dataType="String")
@ApiImplicitParam(name = "deviceName", value = "设备名称", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType="int")
})
public Result<PageData<TbDeviceApplyDTO>> myDonePage(@ApiIgnore @RequestParam Map<String, Object> params){
params.put("states", ImmutableList.of(2,3));
if(params.get("state") == null){
params.put("states", ImmutableList.of(2,3));
}else{
params.put("states", ImmutableList.of(params.get("state")));
}
PageData<TbDeviceApplyDTO> page = tbDeviceApplyService.queryAuditList(params);
return new Result<PageData<TbDeviceApplyDTO>>().ok(page);
}

View File

@ -53,4 +53,6 @@ public class TbDeviceApplyDTO implements Serializable {
private Integer delFlag;
private String deviceName;
private TbDeviceDTO tbDeviceDTO;
}

View File

@ -7,8 +7,7 @@ import io.renren.modules.device.dao.TbDeviceApplyDao;
import io.renren.modules.device.dto.TbDeviceApplyDTO;
import io.renren.modules.device.entity.TbDeviceApplyEntity;
import io.renren.modules.device.service.TbDeviceApplyService;
import io.renren.modules.fuse.dto.TbFuseDTO;
import io.renren.modules.meeting.dto.TMeetingroomBookDTO;
import io.renren.modules.device.service.TbDeviceService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -29,6 +28,8 @@ public class TbDeviceApplyServiceImpl extends CrudServiceImpl<TbDeviceApplyDao,
@Autowired
private TbDeviceApplyDao tbDeviceApplyDao;
@Autowired
private TbDeviceService tbDeviceService;
@Override
public QueryWrapper<TbDeviceApplyEntity> getWrapper(Map<String, Object> params) {
@ -48,8 +49,15 @@ public class TbDeviceApplyServiceImpl extends CrudServiceImpl<TbDeviceApplyDao,
}
params.put("userId", SecurityUser.getUserId());
List<TbDeviceApplyDTO> dtoList = tbDeviceApplyDao.queryListForAudit(params);
List<TbDeviceApplyDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
return new PageData(result, dtoList.size());
List<TbDeviceApplyDTO> resultList;
if(params.get("deviceName") != null){
resultList = dtoList.stream().filter(it->tbDeviceService.get(it.getDeviceId()).getName().contains(params.get("deviceName").toString())).collect(Collectors.toList());
}else{
resultList=dtoList;
}
List<TbDeviceApplyDTO> result = resultList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
result.stream().forEach(it->it.setTbDeviceDTO(tbDeviceService.get(it.getDeviceId())));
return new PageData(result, resultList.size());
}
@Override