From e1140f5bb8514f23409f0fc99951134017599da7 Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Fri, 9 Jan 2026 15:28:35 +0800 Subject: [PATCH] =?UTF-8?q?5=E5=8F=B7=E5=BA=93=E6=94=B9=E9=80=A0-=E7=BB=BC?= =?UTF-8?q?=E5=90=88=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ComplexQueryController.java | 38 +++++++++++++++ .../basic/domain/InputRecordInfo.java | 3 ++ .../domain/MachineHistoryRecordBean.java | 3 ++ .../material/basic/domain/OutRecordInfo.java | 3 ++ .../basic/domain/PurchaseInputInfo.java | 3 ++ .../basic/domain/RepairInputRecord.java | 3 ++ .../basic/domain/RepairStorageInfo.java | 3 ++ .../material/basic/domain/UseStorageInfo.java | 3 ++ .../material/basic/ComplexQueryMapper.xml | 48 +++++++++++++++++++ 9 files changed, 107 insertions(+) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java index 32155341..c6469649 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java @@ -18,6 +18,7 @@ import com.bonus.material.basic.domain.vo.MaTypeSelectInfo; import com.bonus.material.basic.service.ComplexQueryService; import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.service.ITypeService; import com.bonus.material.part.domain.PartInventory; import com.bonus.material.push.domain.MachineInfoBean; import com.bonus.material.push.domain.MachineInfoExport; @@ -43,6 +44,9 @@ public class ComplexQueryController extends BaseController { @Resource private ComplexQueryService complexQueryService; + @Resource + private ITypeService typeService; + /** * 保有设备总量查询 * @param bean @@ -53,6 +57,8 @@ public class ComplexQueryController extends BaseController { public AjaxResult getRetainedEquipmentList(RetainedEquipmentInfo bean) { bean.setIsExport(1); bean.setUserId(SecurityUtils.getLoginUser().getUserid()); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(Math.toIntExact(deptId)); if (bean.getIsApp() != null && bean.getIsApp() == 1) { List pageList = complexQueryService.getRetainedEquipmentList(bean); return AjaxResult.success(pageList); @@ -72,6 +78,8 @@ public class ComplexQueryController extends BaseController { public AjaxResult getRetainedEquipmentListNoPage(RetainedEquipmentInfo bean) { bean.setIsExport(0); bean.setUserId(SecurityUtils.getLoginUser().getUserid()); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(Math.toIntExact(deptId)); List list = complexQueryService.getRetainedEquipmentList(bean); RetainedEquipmentInfo dto = new RetainedEquipmentInfo(); if (CollectionUtils.isNotEmpty(list)) { @@ -105,6 +113,8 @@ public class ComplexQueryController extends BaseController { { bean.setUserId(SecurityUtils.getLoginUser().getUserid()); bean.setIsExport(0); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(Math.toIntExact(deptId)); List list = complexQueryService.getRetainedEquipmentList(bean); ExcelUtil util = new ExcelUtil<>(RetainedEquipmentInfo.class); util.exportExcel(response, list, "综合查询--保有设备总量查询"); @@ -147,6 +157,8 @@ public class ComplexQueryController extends BaseController { public AjaxResult getUserRecords(UseStorageInfo bean) { Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getUserRecords(bean); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } @@ -159,6 +171,8 @@ public class ComplexQueryController extends BaseController { @ApiOperation(value = "综合查询--导出在用设备详情") @PostMapping("/exportUserRecordList") public void exportUserRecordList(HttpServletResponse response, UseStorageInfo bean) { + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getUserRecords(bean); ExcelUtil util = new ExcelUtil<>(UseStorageInfo.class); util.exportExcel(response, list, "综合查询--导出在用设备详情"); @@ -174,6 +188,8 @@ public class ComplexQueryController extends BaseController { public AjaxResult getRepairRecordList(RepairStorageInfo bean) { Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getRepairRecordList(bean); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } @@ -186,6 +202,8 @@ public class ComplexQueryController extends BaseController { @ApiOperation(value = "综合查询--导出在修设备详情") @PostMapping("/exportRepairRecordList") public void exportRepairRecordList(HttpServletResponse response, RepairStorageInfo bean) { + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getRepairRecordList(bean); ExcelUtil util = new ExcelUtil<>(RepairStorageInfo.class); util.exportExcel(response, list, "综合查询--导出在修设备详情"); @@ -200,6 +218,8 @@ public class ComplexQueryController extends BaseController { @GetMapping("/getPurchaseRecordList") public AjaxResult getPurchaseRecordList(PurchaseInputInfo bean) { startPage(); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getPurchaseRecordList(bean); return AjaxResult.success(getDataTable(list)); } @@ -212,6 +232,8 @@ public class ComplexQueryController extends BaseController { @ApiOperation(value = "综合查询--导出新购待入库详情") @PostMapping("/exportPurchaseRecordList") public void exportPurchaseRecordList(HttpServletResponse response, PurchaseInputInfo bean) { + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getPurchaseRecordList(bean); ExcelUtil util = new ExcelUtil<>(PurchaseInputInfo.class); util.exportExcel(response, list, "综合查询--导出新购待入库详情"); @@ -226,6 +248,8 @@ public class ComplexQueryController extends BaseController { @GetMapping("/getRepairInputList") public AjaxResult getRepairInputList(RepairInputRecord bean) { startPage(); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getRepairInputList(bean); return AjaxResult.success(getDataTable(list)); } @@ -238,6 +262,8 @@ public class ComplexQueryController extends BaseController { @ApiOperation(value = "综合查询--导出修饰待入库详情") @PostMapping("/exportRepairInputList") public void exportRepairInputList(HttpServletResponse response, RepairInputRecord bean) { + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getRepairInputList(bean); ExcelUtil util = new ExcelUtil<>(RepairInputRecord.class); util.exportExcel(response, list, "综合查询--导出修饰待入库详情"); @@ -358,6 +384,8 @@ public class ComplexQueryController extends BaseController { public AjaxResult getMachineHistoryRecordList(MachineHistoryRecordBean bean) { bean.setUserId(SecurityUtils.getLoginUser().getUserid()); startPage(); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getMachineHistoryRecordList(bean); return AjaxResult.success(getDataTable(list)); } @@ -372,6 +400,8 @@ public class ComplexQueryController extends BaseController { public void exportMachineHistoryRecord(HttpServletResponse response, MachineHistoryRecordBean bean) { bean.setUserId(SecurityUtils.getLoginUser().getUserid()); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getMachineHistoryRecordList(bean); ExcelUtil util = new ExcelUtil<>(MachineHistoryRecordBean.class); util.exportExcel(response, list, "综合查询--设备使用追溯查询"); @@ -385,6 +415,8 @@ public class ComplexQueryController extends BaseController { public AjaxResult getInputRecordList(InputRecordInfo bean) { Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getInputRecordList(bean); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } @@ -398,6 +430,8 @@ public class ComplexQueryController extends BaseController { @PostMapping("/exportInputRecord") public void exportInputRecord(HttpServletResponse response, InputRecordInfo bean) { + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getInputRecordList(bean); ExcelUtil util = new ExcelUtil<>(InputRecordInfo.class); util.exportExcel(response, list, "综合查询--机具入库查询"); @@ -413,6 +447,8 @@ public class ComplexQueryController extends BaseController { public AjaxResult getOutRecordList(OutRecordInfo bean) { Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getOutRecordList(bean); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } @@ -421,6 +457,8 @@ public class ComplexQueryController extends BaseController { @PostMapping("/exportOutRecord") public void exportOutRecord(HttpServletResponse response, OutRecordInfo bean) { + Long deptId = typeService.getUserDeptId(); + bean.setCompanyId(deptId); List list = complexQueryService.getOutRecordList(bean); ExcelUtil util = new ExcelUtil<>(OutRecordInfo.class); util.exportExcel(response, list, "综合查询--机具出库查询"); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/InputRecordInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/InputRecordInfo.java index 1159b0b5..5a11ed97 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/InputRecordInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/InputRecordInfo.java @@ -82,4 +82,7 @@ public class InputRecordInfo { @ApiModelProperty(value = "装备管理方式") private String manageType; + @ApiModelProperty(value = "组织id") + private Long companyId; + } \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/MachineHistoryRecordBean.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/MachineHistoryRecordBean.java index e2240d68..72821e16 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/MachineHistoryRecordBean.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/MachineHistoryRecordBean.java @@ -109,4 +109,7 @@ public class MachineHistoryRecordBean { private String keyWord; private Long userId; + + @ApiModelProperty(value = "组织id") + private Long companyId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/OutRecordInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/OutRecordInfo.java index bd3973ea..9db7c170 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/OutRecordInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/OutRecordInfo.java @@ -109,4 +109,7 @@ public class OutRecordInfo { @ApiModelProperty(value = "一级ID集合") private List firstTypeIdList; + + @ApiModelProperty(value = "组织id") + private Long companyId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/PurchaseInputInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/PurchaseInputInfo.java index b4706d89..b532e0c3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/PurchaseInputInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/PurchaseInputInfo.java @@ -65,4 +65,7 @@ public class PurchaseInputInfo { private String keyWord; private String manageType; + + @ApiModelProperty(value = "组织id") + private Long companyId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RepairInputRecord.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RepairInputRecord.java index 9e4adece..f74abe47 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RepairInputRecord.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RepairInputRecord.java @@ -64,4 +64,7 @@ public class RepairInputRecord { @ApiModelProperty(value = "关键字") private String keyWord; + + @ApiModelProperty(value = "组织id") + private Long companyId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RepairStorageInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RepairStorageInfo.java index bfc21a60..638a41b4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RepairStorageInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RepairStorageInfo.java @@ -70,4 +70,7 @@ public class RepairStorageInfo { @ApiModelProperty(value = "维修类型 1 定损 2 在修 3 修试待审核") private Integer type; + + @ApiModelProperty(value = "组织id") + private Long companyId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/UseStorageInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/UseStorageInfo.java index 9b37ade0..c688d1a8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/UseStorageInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/UseStorageInfo.java @@ -70,4 +70,7 @@ public class UseStorageInfo { @ApiModelProperty(value = "关键字") private String keyWord; + + @ApiModelProperty(value = "组织id") + private Long companyId; } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml index d6f659ad..78a836c8 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml @@ -206,6 +206,9 @@ END = #{statusName} ) + + and sai.company_id = #{companyId} + ORDER BY sai.end_time @@ -260,6 +263,9 @@ AND bs.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59') + + and bs.company_id = #{companyId} + order by bs.create_time desc @@ -335,6 +341,9 @@ AND bs.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59') + + and bs.company_id = #{companyId} + order by bs.create_time desc @@ -405,6 +414,9 @@ LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id WHERE mm.ma_code is not null and mm.ma_status in (1) + + AND mm.company_id = #{companyId} + GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id LEFT JOIN ( SELECT @@ -428,6 +440,9 @@ AND (sai.source = 1 OR sai.source is NULL) AND sai.end_time IS NULL AND sai.back_id IS NULL + + AND sai.company_id = #{companyId} + GROUP BY mt.type_id ) AS subquery1 ON mt.type_id = subquery1.type_id @@ -452,6 +467,9 @@ WHERE tt.task_status IN (0, 4) and tt.code is not null + + AND rad.company_id = #{companyId} + GROUP BY mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id LEFT JOIN ( @@ -474,6 +492,9 @@ WHERE tt.code is not null and rad.`status` = '0' + + AND rad.company_id = #{companyId} + GROUP BY mt.type_id) AS subquery12 ON subquery12.type_id = mt.type_id LEFT JOIN ( @@ -496,6 +517,9 @@ LEFT JOIN tm_task tt ON rid.task_id = tt.task_id WHERE IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0) - IFNULL(rid.reject_num, 0) > 0 and tt.task_status = 0 + + AND rid.company_id = #{companyId} + GROUP BY mt.type_id) AS subquery3 ON subquery3.type_id = mt.type_id LEFT JOIN ( @@ -517,6 +541,9 @@ LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id WHERE IFNULL(pcd.check_num, 0) - IFNULL(pcd.input_num, 0) > 0 and pcd.status in (3,4, 13,14) + + AND pcd.company_id = #{companyId} + GROUP BY mt.type_id) AS subquery4 ON subquery4.type_id = mt.type_id /*LEFT JOIN ( @@ -600,6 +627,9 @@ AND mt.jiju_type = #{jiJuType} + + and mt.company_id = #{companyId} + HAVING allNum > 0 order by mt4.type_name, mt3.type_name, mt2.type_name, mt.type_name @@ -1031,6 +1061,9 @@ AND type_id = #{typeId} + + AND company_id = #{companyId} + GROUP BY type_id, ma_id, @@ -1097,6 +1130,9 @@ su.nick_name like concat('%',#{keyWord},'%') ) + + AND rad.company_id = #{companyId} + GROUP BY mm.ma_id,tt.`code`,mt.type_id @@ -1129,6 +1165,9 @@ AND pcd.type_id = #{typeId} + + AND pcd.company_id = #{companyId} + GROUP BY tt.`code`, mt.type_id @@ -1180,6 +1219,9 @@ mm.ma_code like concat('%',#{keyWord},'%') ) + + AND rid.company_id = #{companyId} + GROUP BY mm.ma_id, tt.`code`, mt.type_id @@ -1697,6 +1739,9 @@ #{item} + + and lod.company_id= #{companyId} + GROUP BY lod.parent_id @@ -1967,6 +2012,9 @@ su.nick_name like concat('%',#{keyWord},'%') ) + + AND rad.company_id = #{companyId} + GROUP BY mm.ma_id,tt.`code`,mt.type_id