diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java index 3367725..2439cc1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java @@ -151,7 +151,7 @@ public class AssetCurrentController extends BaseController { throw new ServiceException("请选择已有单位!"); } List list1 = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, assetCurrent.getXtmc()).eq(AssetCurrent::getDwmc, assetCurrent.getDwmc()).list(); - if (list1 != null&& !list1.isEmpty()){ + if (list1 != null && !list1.isEmpty()) { throw new ServiceException("不允许新增重复资产!"); } @@ -520,8 +520,8 @@ public class AssetCurrentController extends BaseController { if (currentCpPo != null) { //查询任务是否为进行中 AssetTask assetTask = assetTaskService.findByTaskId(currentCpPo.getTaskId()); - if (assetTask.getTaskStatus().equals(1)){ - if (currentCpPo.getStatus()==5 ){ + if (assetTask.getTaskStatus().equals(1)) { + if (currentCpPo.getStatus() == 5) { //修改任务中资产状态 currentCpPo.setStatus(0); currentCpPo.setBtgyy(null); @@ -684,7 +684,7 @@ public class AssetCurrentController extends BaseController { } else { //根据资产id查询旧资产 AssetCurrentCpPo assetCurrentCpPo = assetCurrentCpService.findDwmc(assetCurrent.getId()); - if (assetCurrentCpPo!=null){ + if (assetCurrentCpPo != null) { assetCurrentCpPo.setDwmc(assetCurrent.getDwmc()); assetCurrentCpPo.setTaskId(assetTask.getId()); //修改 diff --git a/ruoyi-admin/src/main/resources/mapper/AssetCurrentMapper.xml b/ruoyi-admin/src/main/resources/mapper/AssetCurrentMapper.xml index 4ce1422..e10dea0 100644 --- a/ruoyi-admin/src/main/resources/mapper/AssetCurrentMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/AssetCurrentMapper.xml @@ -55,8 +55,21 @@ l.* FROM asset_current a - LEFT JOIN ( SELECT asset_id, NAME, tyshxydm, lxr, lxdh, gyszcdz, sfwtc FROM asset_supply_chain WHERE type = 5 - GROUP BY asset_id,NAME, tyshxydm, lxr, lxdh, gyszcdz, sfwtc ) b ON a.id = b.asset_id + LEFT JOIN ( + SELECT + asset_id, + NAME, + tyshxydm, + lxr, + lxdh, + gyszcdz, + sfwtc, + ROW_NUMBER() OVER (PARTITION BY asset_id ORDER BY create_time) AS row_num + FROM + asset_supply_chain + WHERE + type = 5 + ) b ON a.id = b.asset_id AND b.row_num = 1 LEFT JOIN ( SELECT asset_id, @@ -65,20 +78,13 @@ lxr AS lxr1, lxdh AS lxdh1, gyszcdz AS gyszcdz1, - sfwtc AS sfwtc1 + sfwtc AS sfwtc1, + ROW_NUMBER() OVER (PARTITION BY asset_id ORDER BY create_time) AS row_num FROM asset_supply_chain WHERE type = 7 - GROUP BY - asset_id, - NAME, - tyshxydm, - lxr, - lxdh, - gyszcdz, - sfwtc - ) c ON a.id = c.asset_id + ) c ON a.id = c.asset_id AND c.row_num = 1 LEFT JOIN ( SELECT asset_id, @@ -91,18 +97,13 @@ yjxlh, yjbbxx, yjyt, - yjbsxx + yjbsxx, + ROW_NUMBER() OVER (PARTITION BY asset_id ORDER BY create_time) AS row_num FROM asset_basic_network WHERE type = 1 - GROUP BY - asset_id, - sblx, - pp, - sb_ip, - czxt,czxtbb,yjxh,yjxlh,yjbbxx,yjyt,yjbsxx - ) d ON a.id = d.asset_id + ) d ON a.id = d.asset_id AND d.row_num = 1 LEFT JOIN ( SELECT asset_id, @@ -113,26 +114,32 @@ yjxlh AS wlyjxlh, yjbbxx AS wlyjbbxx, yjyt AS wlyjyt, - yjbsxx AS wlyjbsxx + yjbsxx AS wlyjbsxx, + ROW_NUMBER() OVER (PARTITION BY asset_id ORDER BY create_time) AS row_num FROM asset_basic_network WHERE type = 2 - GROUP BY + ) e ON a.id = e.asset_id AND e.row_num = 1 + LEFT JOIN ( + SELECT asset_id, - sblx, - pp,sb_ip,yjxh,yjxlh,yjbbxx,yjyt,yjbsxx - ) e ON a.id = e.asset_id - LEFT JOIN ( SELECT - asset_id, sblx AS aqwlsblx, pp AS aqwlpp, sb_ip AS aqwlsbIp, + sblx AS aqwlsblx, + pp AS aqwlpp, + sb_ip AS aqwlsbIp, yjxh AS aqyjxh, yjxlh AS aqyjxlh, yjbbxx AS aqyjbbxx, yjyt AS aqyjyt, - yjbsxx AS aqyjbswz - FROM asset_basic_network WHERE type = 3 GROUP BY asset_id,sblx,pp,sb_ip,yjxh,yjxlh,yjbbxx,yjyt,yjbsxx ) l ON a.id = l.asset_id + yjbsxx AS aqyjbswz, + ROW_NUMBER() OVER (PARTITION BY asset_id ORDER BY create_time) AS row_num + FROM + asset_basic_network + WHERE + type = 3 + ) l ON a.id = l.asset_id AND l.row_num = 1 - a.del_flag = '0' and a.isbf = '0' + a.del_flag = '0' and a.xtmc like concat('%',#{req.xtmc},'%')