diff --git a/djhk-system/src/main/java/com/djhk/uav/equ/controller/EquInfoController.java b/djhk-system/src/main/java/com/djhk/uav/equ/controller/EquInfoController.java index 77178f8..f993d80 100644 --- a/djhk-system/src/main/java/com/djhk/uav/equ/controller/EquInfoController.java +++ b/djhk-system/src/main/java/com/djhk/uav/equ/controller/EquInfoController.java @@ -51,14 +51,14 @@ public class EquInfoController extends BaseController { @Log(title = "设备台账导出", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, EquInfoExportVo equInfoExportVo) { + public void export(HttpServletResponse response,EquInfoEntity equInfoEntity) { // SysUser sysUser = userService.getUserInfoByUserId(SecurityUtils.getUserId(), SecurityConstants.INNER).getData(); SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId()); Long deptId = sysUser.getDeptId(); // equInfoExportVo.setOrgIds(Arrays.asList(ServletUtils.urlDecode(String.valueOf(deptId)).split(",")).stream().map(x -> Long.parseLong(x)).collect(Collectors.toList())); - equInfoExportVo.setDeptId(deptId); - List list = equInfoService.selectEquInfoExportList(equInfoExportVo); - ExcelUtil util = new ExcelUtil(EquInfoExportDto.class); + equInfoEntity.setDeptId(deptId); + List list = equInfoService.selectEquInfoExportList(equInfoEntity); + ExcelUtil util = new ExcelUtil(EquInfoEntity.class); util.exportExcel(response, list, "设备台账"); } @@ -165,6 +165,8 @@ public class EquInfoController extends BaseController { if (equInfoEntity != null) { return new AjaxResult(500, "该组织下设备序列号重复,请先修改序列号"); } + Long orgId = vo.getDeptId(); + vo.setOrganId(orgId); if (vo.getEquId() == null) { vo.setCreateBy(SecurityUtils.getUsername()); return toAjax(equInfoService.saves(vo)); @@ -182,8 +184,8 @@ public class EquInfoController extends BaseController { } - @DeleteMapping - public AjaxResult delete(@Validated @RequestBody String[] equIds) { + @DeleteMapping("/{equIds}") + public AjaxResult delete(@PathVariable String[] equIds) { //equInfoService.delete(equIds); equInfoService.updateEquInfoByIds(equIds); return success(); diff --git a/djhk-system/src/main/java/com/djhk/uav/equ/domain/EquInfoEntity.java b/djhk-system/src/main/java/com/djhk/uav/equ/domain/EquInfoEntity.java index 5183353..3c76c62 100644 --- a/djhk-system/src/main/java/com/djhk/uav/equ/domain/EquInfoEntity.java +++ b/djhk-system/src/main/java/com/djhk/uav/equ/domain/EquInfoEntity.java @@ -160,6 +160,8 @@ public class EquInfoEntity extends BaseEntity { */ private String updateBy; + private Long deptId; + /** * 修改时间 */ diff --git a/djhk-system/src/main/java/com/djhk/uav/equ/mapper/EquInfoMapper.java b/djhk-system/src/main/java/com/djhk/uav/equ/mapper/EquInfoMapper.java index 0e6b465..752c170 100644 --- a/djhk-system/src/main/java/com/djhk/uav/equ/mapper/EquInfoMapper.java +++ b/djhk-system/src/main/java/com/djhk/uav/equ/mapper/EquInfoMapper.java @@ -51,7 +51,7 @@ public interface EquInfoMapper EquInfoEntity selectEquInfoByEquSn(EquInfoEntity equInfoEntity); - List selectEquInfoExportList(EquInfoExportVo equInfoExportVo); + List selectEquInfoExportList(EquInfoEntity equInfoEntity); EquInfoEntity selectEquInfoByTypeId(@Param("typeId") String typeId,@Param("deptId") String deptId); } diff --git a/djhk-system/src/main/java/com/djhk/uav/equ/service/EquInfoService.java b/djhk-system/src/main/java/com/djhk/uav/equ/service/EquInfoService.java index f642814..187db13 100644 --- a/djhk-system/src/main/java/com/djhk/uav/equ/service/EquInfoService.java +++ b/djhk-system/src/main/java/com/djhk/uav/equ/service/EquInfoService.java @@ -54,7 +54,7 @@ public interface EquInfoService { EquInfoEntity selectEquInfoByEquSn(EquInfoEntity vo); - List selectEquInfoExportList(EquInfoExportVo equInfoExportVo); + List selectEquInfoExportList(EquInfoEntity equInfoEntity); String importData(List userList, Boolean isUpdateSupport) throws ServiceException; diff --git a/djhk-system/src/main/java/com/djhk/uav/equ/service/impl/EquInfoServiceImpl.java b/djhk-system/src/main/java/com/djhk/uav/equ/service/impl/EquInfoServiceImpl.java index 8e3a60b..f758b13 100644 --- a/djhk-system/src/main/java/com/djhk/uav/equ/service/impl/EquInfoServiceImpl.java +++ b/djhk-system/src/main/java/com/djhk/uav/equ/service/impl/EquInfoServiceImpl.java @@ -202,6 +202,9 @@ public class EquInfoServiceImpl implements EquInfoService { List collect = sysDictDataList.stream().map(SysDictData::getDictLabel).collect(Collectors.toList()); boolean b = false; for (String s : collect) { + if (dept.getAdminCode() ==null){ + break; + } if (s.contains(dept.getAdminCode().substring(0, 6).trim())) { b = true; break; @@ -512,17 +515,17 @@ public class EquInfoServiceImpl implements EquInfoService { } @Override - public List selectEquInfoExportList(EquInfoExportVo equInfoExportVo) { - List equInfoExportDtos = equInfoMapper.selectEquInfoExportList(equInfoExportVo); - for (EquInfoExportDto equInfoExportDto : equInfoExportDtos) { + public List selectEquInfoExportList(EquInfoEntity equInfoEntity) { + List equInfoExportDtos = equInfoMapper.selectEquInfoExportList(equInfoEntity); + for (EquInfoEntity equInfoExportDto : equInfoExportDtos) { // R data = sysDeptService.getDeptInfo(Long.valueOf(equInfoExportDto.getOrganId()), "inner"); // SysDept sysDept = data.getData(); SysDept sysDept = sysDeptService.selectDeptById(Long.valueOf(equInfoExportDto.getOrganId())); if (sysDept != null) { - equInfoExportDto.setOrganId(sysDept.getDeptName()); + equInfoExportDto.setDeptName(sysDept.getDeptName()); } else { - equInfoExportDto.setOrganId(null); + equInfoExportDto.setDeptName(null); } EquType equType = equTypeMapper.selectEquTypeByTypeId(equInfoExportDto.getTypeId()); diff --git a/djhk-system/src/main/resources/mapper/equ/EquInfoMapper.xml b/djhk-system/src/main/resources/mapper/equ/EquInfoMapper.xml index e187a1c..d0d55ea 100644 --- a/djhk-system/src/main/resources/mapper/equ/EquInfoMapper.xml +++ b/djhk-system/src/main/resources/mapper/equ/EquInfoMapper.xml @@ -13,6 +13,7 @@ + @@ -132,15 +133,33 @@ AND (equ.organ_id = #{organId} OR equ.organ_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{organId}, ancestors) )) + + AND (equ.organ_id = #{deptId} OR equ.organ_id IN ( SELECT t.dept_id FROM sys_dept t WHERE + find_in_set(#{deptId}, ancestors) )) + order by equ_code desc + + + + + + - + - and equ.del_flag = "0" - - and id in - - #{id} - + and equ.del_flag = '0' + + AND equ.model_id like concat('%' , #{modelId}, '%') - - AND equ.create_by like concat('%',#{createBy},'%') + + AND equ.equ_code like concat('%' , #{equCode}, '%') - - AND equ.type_id = #{typeId} + + AND equ.type_id = #{typeId} - - AND equ.organ_id in (select dept_id from sys_dept WHERE dept_id = #{deptId} OR FIND_IN_SET(#{deptId}, ancestors)) + + AND equ.model_id like concat('%' , #{modelId}, '%') + + + AND equ.equ_sn like concat('%', #{equSn}, '%') + + + AND equ.mng_name like concat('%', #{mngName}, '%') + + + AND (equ.organ_id = #{organId} OR equ.organ_id IN ( SELECT t.dept_id FROM sys_dept t WHERE + find_in_set(#{organId}, ancestors) )) + + + AND (equ.organ_id = #{deptId} OR equ.organ_id IN ( SELECT t.dept_id FROM sys_dept t WHERE + find_in_set(#{deptId}, ancestors) )) - - order by equ.create_Time desc + order by equ_code desc + + + + + + + + + + + + + + + + + + + + + + + + + + + + +