From ff80946f863534c76102900add148bb34ae1a727 Mon Sep 17 00:00:00 2001 From: mashuai Date: Fri, 12 Dec 2025 17:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E5=A4=87=EF=BC=8C=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=A7=9F=E8=B5=81=E4=BB=B7=E6=89=B9=E9=87=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UpOrDownEquipmentController.java | 14 ++++---- .../equipment/domain/EquipmentEntity.java | 10 ++++-- .../mapper/UpOrDownEquipmentMapper.java | 7 +++- .../service/UpOrDownEquipmentService.java | 8 ++++- .../impl/UpOrDownEquipmentServiceImpl.java | 32 +++++++++++++++++-- .../controller/UpOrDownToolController.java | 11 ++++--- .../upOrDown/tool/entity/ToolEntity.java | 7 ++++ .../tool/mapper/UpOrDownToolMapper.java | 7 +++- .../tool/service/UpOrDownToolService.java | 8 +++-- .../service/impl/UpOrDownToolServiceImpl.java | 30 +++++++++++++++-- .../mapper/material/bookcar/BookCarMapper.xml | 6 ++-- .../mapper/material/device/DevInfoMapper.xml | 13 +++++--- .../mapper/material/order/OrderInfoMapper.xml | 8 +++-- .../upOrDown/UpOrDownEquipmentMapper.xml | 23 +++++++++---- .../material/upOrDown/UpOrDownToolMapper.xml | 24 +++++++++----- 15 files changed, 160 insertions(+), 48 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/controller/UpOrDownEquipmentController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/controller/UpOrDownEquipmentController.java index a32c971..ba6949e 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/controller/UpOrDownEquipmentController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/controller/UpOrDownEquipmentController.java @@ -1,13 +1,11 @@ package com.bonus.material.upOrDown.equipment.controller; +import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.page.TableDataInfo; import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity; import com.bonus.material.upOrDown.equipment.service.UpOrDownEquipmentService; -import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity; -import com.bonus.material.upOrDown.tool.entity.ToolEntity; -import com.bonus.material.upOrDown.tool.service.UpOrDownToolService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; @@ -79,14 +77,16 @@ public class UpOrDownEquipmentController extends BaseController { /** * 批量上架 - * @param ids + * @param entity * @return */ @ApiOperation(value = "批量上架装备") @PostMapping("/batch/up") - public AjaxResult upToolBatch(@RequestBody List ids) { - upOrDownEquipmentService.upEquipmentBatch(ids); - return AjaxResult.success(); + public AjaxResult upToolBatch(@RequestBody List entity) { + if (CollectionUtils.isEmpty(entity)) { + return AjaxResult.warn("请选择要批量上架的装备"); + } + return upOrDownEquipmentService.upEquipmentBatch(entity); } /** diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/domain/EquipmentEntity.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/domain/EquipmentEntity.java index 74f7b9d..df20a09 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/domain/EquipmentEntity.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/domain/EquipmentEntity.java @@ -1,14 +1,12 @@ package com.bonus.material.upOrDown.equipment.domain; -import com.bonus.common.core.annotation.Excel; import com.bonus.material.devchange.domain.MaDevFile; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.Date; import java.util.List; @@ -342,4 +340,10 @@ public class EquipmentEntity { private String remainingStopYear; + @ApiModelProperty(value = "租赁单价") + private BigDecimal leasePrice; + + @ApiModelProperty(value = "是否改价") + private Boolean isChangePrice; + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/mapper/UpOrDownEquipmentMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/mapper/UpOrDownEquipmentMapper.java index 885d036..edc83ae 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/mapper/UpOrDownEquipmentMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/mapper/UpOrDownEquipmentMapper.java @@ -11,7 +11,12 @@ public interface UpOrDownEquipmentMapper { void downEquipmentById(Long equipmentId); - void upEquipmentBatch(List ids); + /** + * 批量修改装备上架状态及租赁价 + * @param list + * @return + */ + int upEquipmentBatch(List list); void downEquipmentBatch(List ids); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/service/UpOrDownEquipmentService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/service/UpOrDownEquipmentService.java index da761f7..43cd034 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/service/UpOrDownEquipmentService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/service/UpOrDownEquipmentService.java @@ -1,5 +1,6 @@ package com.bonus.material.upOrDown.equipment.service; +import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity; import com.bonus.material.upOrDown.tool.entity.ToolEntity; @@ -11,7 +12,12 @@ public interface UpOrDownEquipmentService { void downEquipmentById(Long equipmentId); - void upEquipmentBatch(List ids); + /** + * 批量修改装备上架状态及租赁价 + * @param entity + * @return + */ + AjaxResult upEquipmentBatch(List entity); void downEquipmentBatch(List ids); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/service/impl/UpOrDownEquipmentServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/service/impl/UpOrDownEquipmentServiceImpl.java index ee3a790..7707f4a 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/service/impl/UpOrDownEquipmentServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/equipment/service/impl/UpOrDownEquipmentServiceImpl.java @@ -1,13 +1,16 @@ package com.bonus.material.upOrDown.equipment.service.impl; +import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity; import com.bonus.material.upOrDown.equipment.mapper.UpOrDownEquipmentMapper; import com.bonus.material.upOrDown.equipment.service.UpOrDownEquipmentService; -import com.bonus.material.upOrDown.tool.entity.ToolEntity; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; +import java.util.Objects; /** * @author 30791 @@ -15,6 +18,7 @@ import java.util.List; * Create by 2025/11/16 14:13 */ @Service +@Slf4j public class UpOrDownEquipmentServiceImpl implements UpOrDownEquipmentService { @Resource @@ -36,9 +40,31 @@ public class UpOrDownEquipmentServiceImpl implements UpOrDownEquipmentService { } + /** + * 批量修改装备上架状态及租赁价 + * @param entity + * @return + */ @Override - public void upEquipmentBatch(List ids) { - upOrDownEquipmentMapper.upEquipmentBatch(ids) ; + @Transactional(rollbackFor = Exception.class) + public AjaxResult upEquipmentBatch(List entity) { + try { + entity.stream() + .filter(Objects::nonNull) + // 仅处理未修改价格的设备 + .filter(equipment -> !equipment.getIsChangePrice()) + .forEach(equipment -> { + log.debug("设备ID:{} 未修改价格,置空leasePrice", equipment.getMaId()); + equipment.setLeasePrice(null); + }); + int result = upOrDownEquipmentMapper.upEquipmentBatch(entity); + if (result == 0) { + throw new RuntimeException("批量上架失败"); + } + } catch (RuntimeException e) { + log.error("批量上架失败:{}", e.getMessage()); + } + return AjaxResult.success("批量上架成功"); } @Override diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/controller/UpOrDownToolController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/controller/UpOrDownToolController.java index 755fb4c..7de62cb 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/controller/UpOrDownToolController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/controller/UpOrDownToolController.java @@ -1,5 +1,6 @@ package com.bonus.material.upOrDown.tool.controller; +import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.page.TableDataInfo; @@ -122,14 +123,16 @@ public class UpOrDownToolController extends BaseController { /** * 批量上架 - * @param ids + * @param entity * @return */ @ApiOperation(value = "批量上架工具") @PostMapping("/batch/up") - public AjaxResult upToolBatch(@RequestBody List ids) { - toolService.upToolBatch(ids); - return AjaxResult.success(); + public AjaxResult upToolBatch(@RequestBody List entity) { + if (CollectionUtils.isEmpty(entity)) { + return AjaxResult.warn("请选择要批量上架的工具"); + } + return toolService.upToolBatch(entity); } /** diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/entity/ToolEntity.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/entity/ToolEntity.java index b30d611..c64ef1c 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/entity/ToolEntity.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/entity/ToolEntity.java @@ -2,6 +2,7 @@ package com.bonus.material.upOrDown.tool.entity; import com.bonus.common.core.annotation.Excel; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.apache.ibatis.type.Alias; @@ -186,4 +187,10 @@ public class ToolEntity { private String fileList; private List propertyVoList; + + @ApiModelProperty(value = "租赁单价") + private BigDecimal leasePrice; + + @ApiModelProperty(value = "是否改价") + private Boolean isChangePrice; } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/mapper/UpOrDownToolMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/mapper/UpOrDownToolMapper.java index 242bbab..d2cbd9d 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/mapper/UpOrDownToolMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/mapper/UpOrDownToolMapper.java @@ -11,7 +11,12 @@ public interface UpOrDownToolMapper { List listByCode(ToolEntity entity); - int upToolBatch(List ids); + /** + * 批量修改工具上架及租赁价 + * @param list + * @return + */ + int upToolBatch(List list); int downToolBatch(List ids); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/service/UpOrDownToolService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/service/UpOrDownToolService.java index fdad74a..4ab9be2 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/service/UpOrDownToolService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/service/UpOrDownToolService.java @@ -16,8 +16,12 @@ public interface UpOrDownToolService { AjaxResult upToolByCode(ToolEntity entity); - - void upToolBatch(List ids); + /** + * 批量修改工具上架及租赁价 + * @param entity + * @return + */ + AjaxResult upToolBatch(List entity); void downToolBatch(List ids); diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/service/impl/UpOrDownToolServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/service/impl/UpOrDownToolServiceImpl.java index 2dcaf54..c3bc695 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/service/impl/UpOrDownToolServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/upOrDown/tool/service/impl/UpOrDownToolServiceImpl.java @@ -4,10 +4,13 @@ import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.upOrDown.tool.entity.ToolEntity; import com.bonus.material.upOrDown.tool.mapper.UpOrDownToolMapper; import com.bonus.material.upOrDown.tool.service.UpOrDownToolService; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; +import java.util.Objects; /** * @author 30791 @@ -16,6 +19,7 @@ import java.util.List; */ @Service +@Slf4j public class UpOrDownToolServiceImpl implements UpOrDownToolService { @Resource @@ -51,9 +55,31 @@ public class UpOrDownToolServiceImpl implements UpOrDownToolService { } + /** + * 批量修改工具上架及租赁价 + * @param entity + * @return + */ @Override - public void upToolBatch(List ids) { - upOrDownToolMapper.upToolBatch(ids) ; + @Transactional(rollbackFor = Exception.class) + public AjaxResult upToolBatch(List entity) { + try { + entity.stream() + .filter(Objects::nonNull) + // 仅处理未修改价格的工具 + .filter(equipment -> !equipment.getIsChangePrice()) + .forEach(equipment -> { + log.debug("工具ID:{} 未修改价格,置空leasePrice", equipment.getId()); + equipment.setLeasePrice(null); + }); + int result = upOrDownToolMapper.upToolBatch(entity); + if (result == 0) { + throw new RuntimeException("批量上架失败"); + } + } catch (RuntimeException e) { + log.error("批量上架失败:{}", e.getMessage()); + } + return AjaxResult.success("批量上架成功"); } @Override diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/bookcar/BookCarMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/bookcar/BookCarMapper.xml index 62da1e4..a1c99b5 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/bookcar/BookCarMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/bookcar/BookCarMapper.xml @@ -44,7 +44,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" d.create_time as createTime, d.up_down_status as upDownStatus, bcd.order_user as orderUser, - bcd.address as address + bcd.address as address, + COALESCE(d.lease_price, mt.lease_price) as dayLeasePrice FROM ma_dev_info d LEFT JOIN sys_dept sd ON sd.dept_id = d.on_company LEFT JOIN bm_company_info c ON d.on_company = c.company_id @@ -81,7 +82,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" tt.create_time as createTime, tl.up_down_status AS upDownStatus, bcd.order_user as orderUser, - bcd.address as address + bcd.address as address, + COALESCE(tl.lease_price, tt.lease_price) AS dayLeasePrice FROM tool_ledger tl LEFT JOIN sys_dept sd ON sd.dept_id = tl.company_id diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml index 0a406ac..ad750c4 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml @@ -77,10 +77,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" d.update_time AS updateTime, -- 第23列 d.on_company AS companyId, -- 第24列 sd.dept_name AS companyName, -- 第25列 - c.operate_address AS operateAddress -- 第26列 + c.operate_address AS operateAddress, -- 第26列 + COALESCE(d.lease_price, mt.lease_price) AS dayLeasePrice FROM ma_dev_info d LEFT JOIN sys_dept sd ON d.on_company = sd.dept_id + LEFT JOIN ma_type mt ON d.type_id = mt.type_id LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id INNER JOIN ma_type_view mtv ON mtv.typeId = d.type_id LEFT JOIN bm_file_info bfi ON d.ma_id = bfi.model_id AND bfi.file_type = '0' AND bfi.task_type = '17' @@ -171,7 +173,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" tl.update_time AS updateTime, -- 23. 对应 updateTime tl.company_id AS companyId, -- 24. 对应 companyId sd.dept_name AS companyName, -- 25. 对应 companyName - c.operate_address AS operateAddress -- 26. 对应 operateAddress(列数对齐!) + c.operate_address AS operateAddress, -- 26. 对应 operateAddress(列数对齐!) + COALESCE(tl.lease_price, tt.lease_price) AS dayLeasePrice FROM tool_ledger tl LEFT JOIN sys_dept sd ON tl.company_id = sd.dept_id @@ -284,7 +287,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" d.create_time as createTime, d.update_time as updateTime, d.expiration_time, - d.entry_status + d.entry_status, + COALESCE(d.lease_price, mt4.lease_price) as dayLeasePrice FROM ma_dev_info d LEFT JOIN sys_dept sd ON d.on_company = sd.dept_id LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id @@ -1625,7 +1629,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" tl.company_id AS companyId, -- 24. 对应 companyId sd.dept_name AS companyName, -- 25. 对应 companyName c.operate_address AS operateAddress, -- 26. 对应 operateAddress(列数对齐!) - tt.create_time AS companyCreateTime + tt.create_time AS companyCreateTime, + COALESCE(tl.lease_price, tt.lease_price) AS dayLeasePrice FROM tool_ledger tl LEFT JOIN sys_dept sd ON tl.company_id = sd.dept_id diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml index 8937e8c..c2a59e7 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml @@ -253,12 +253,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" CASE WHEN DATE(hh.rent_over_time) = DATE(hh.pre_outbound_time) THEN 1 ELSE TIMESTAMPDIFF(DAY, hh.pre_outbound_time, hh.rent_over_time) + 1 - END AS dateDays + END AS dateDays, + COALESCE(mdi.lease_price, mt.lease_price) as dayLeasePrice FROM ma_order_details hh LEFT JOIN ma_order_info moi ON hh.order_id = moi.order_id LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id + LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id LEFT JOIN bm_file_info bfi ON hh.ma_id = bfi.model_id and bfi.task_type = 17 and bfi.file_type = 0 - left join ma_type mt ON mdi.type_id = mt.type_id AND bfi.file_type = 0 WHERE hh.id = #{id} and hh.devType = '0' @@ -292,7 +293,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" CASE WHEN DATE(hh.rent_over_time) = DATE(hh.pre_outbound_time) THEN 1 ELSE TIMESTAMPDIFF(DAY, hh.pre_outbound_time, hh.rent_over_time) + 1 - END AS dateDays + END AS dateDays, + COALESCE(mdi.lease_price, tt.lease_price) AS leasePrice FROM ma_order_details hh LEFT JOIN ma_order_info moi ON hh.order_id = moi.order_id LEFT JOIN tool_ledger mdi ON hh.ma_id = mdi.id diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/upOrDown/UpOrDownEquipmentMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/upOrDown/UpOrDownEquipmentMapper.xml index f9ff2a0..475094e 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/upOrDown/UpOrDownEquipmentMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/upOrDown/UpOrDownEquipmentMapper.xml @@ -81,14 +81,19 @@ - UPDATE - ma_dev_info + UPDATE ma_dev_info SET - up_down_status = 1 + up_down_status = 1, + lease_price = CASE + + WHEN ma_id = #{item.maId} THEN #{item.leasePrice} + + ELSE lease_price + END WHERE ma_id IN - - #{id} + + #{item.maId} @@ -143,9 +148,11 @@ mdi.max_working_hours AS maxServiceLifeYears, 0 AS repairCount, 0 AS usageCount, - sc.name AS province + sc.name AS province, + COALESCE(mdi.lease_price, mt.lease_price) AS leasePrice from ma_dev_info mdi INNER JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id + LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company LEFT JOIN (SELECT max( next_check_time) next_check_time,ma_id from ma_dev_qc GROUP BY ma_id ) mdq on @@ -239,9 +246,11 @@ mdi.max_working_hours AS maxServiceLifeYears, 0 AS repairCount, 0 AS usageCount, - sc.name AS province + sc.name AS province, + COALESCE(mdi.lease_price, mt.lease_price) AS leasePrice from ma_dev_info mdi INNER JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id + LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company LEFT JOIN (SELECT max( next_check_time) next_check_time,ma_id from ma_dev_qc GROUP BY ma_id ) mdq on diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/upOrDown/UpOrDownToolMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/upOrDown/UpOrDownToolMapper.xml index 0a61249..508ad76 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/upOrDown/UpOrDownToolMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/upOrDown/UpOrDownToolMapper.xml @@ -2,14 +2,19 @@ - UPDATE - tool_ledger + UPDATE tool_ledger SET - up_down_status = 1 + up_down_status = 1, + lease_price = CASE + + WHEN id = #{item.id} THEN #{item.leasePrice} + + ELSE lease_price + END WHERE id IN - - #{id} + + #{item.id} @@ -47,7 +52,8 @@ SUM(COALESCE ( tl.in_num, 0 )) AS inNum, SUM(COALESCE ( tl.scrap_num, 0 )) AS scrapNum, SUM(COALESCE ( tl.repair_num, 0 )) AS repairNum, - SUM(COALESCE ( tl.total_num, 0 )) AS totalNum + SUM(COALESCE ( tl.total_num, 0 )) AS totalNum, + COALESCE(tl.lease_price, tt.lease_price) AS leasePrice FROM tool_type tt LEFT JOIN tool_ledger tl ON tl.type_id = tt.type_id @@ -104,7 +110,8 @@ SUM(COALESCE ( tl.in_num, 0 )) AS inNum, SUM(COALESCE ( tl.scrap_num, 0 )) AS scrapNum, SUM(COALESCE ( tl.repair_num, 0 )) AS repairNum, - SUM(COALESCE ( tl.total_num, 0 )) AS totalNum + SUM(COALESCE ( tl.total_num, 0 )) AS totalNum, + COALESCE(tl.lease_price, tt.lease_price) AS leasePrice FROM tool_type tt LEFT JOIN tool_ledger tl ON tl.type_id = tt.type_id @@ -167,7 +174,8 @@ SUM(COALESCE ( tl.in_num, 0 )) AS inNum, SUM(COALESCE ( tl.scrap_num, 0 )) AS scrapNum, SUM(COALESCE ( tl.repair_num, 0 )) AS repairNum, - SUM(COALESCE ( tl.total_num, 0 )) AS totalNum + SUM(COALESCE ( tl.total_num, 0 )) AS totalNum, + COALESCE(tl.lease_price, tt.lease_price) AS leasePrice FROM tool_type tt