From 50b26aefe7ff41aa619eac1477dc40f0b38fd0b7 Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Tue, 4 Mar 2025 15:07:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=99=A8=E5=85=B7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lease/controller/LeaseTaskController.java | 12 ++-- .../lease/mapper/LeaseTaskMapper.java | 5 +- .../lease/service/ILeaseTaskService.java | 6 +- .../service/impl/LeaseTaskServiceImpl.java | 15 +---- .../ma/domain/vo/MaTypeVoLevelTwo.java | 65 +++++++++++++++++++ .../mapper/material/lease/LeaseTaskMapper.xml | 53 +++++---------- 6 files changed, 92 insertions(+), 64 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/MaTypeVoLevelTwo.java diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseTaskController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseTaskController.java index 02ec1b23..0c421d70 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseTaskController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseTaskController.java @@ -17,6 +17,7 @@ import com.bonus.material.lease.service.ILeaseApplyInfoService; import com.bonus.material.lease.service.ILeaseTaskService; import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.vo.MaTypeVo; +import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo; import com.bonus.material.ma.domain.vo.StandardConfigDetailsVo; import com.bonus.system.api.RemoteFileService; import com.itextpdf.text.Paragraph; @@ -199,14 +200,9 @@ public class LeaseTaskController extends BaseController { @SysLog(title = "工器具物资类型", businessType = OperaType.EXPORT, module = "->导出物资类型") @PostMapping("/export") public void export(HttpServletResponse response) { - List parentIds = service.selectParentId(); - List maTypeVos = new ArrayList<>(); - ExcelUtil util = new ExcelUtil<>(MaTypeVo.class); - - for (Integer parentId : parentIds) { - maTypeVos.addAll(service.getListByParentId(parentId.longValue())); - } - util.exportExcel(response, maTypeVos, "物资类型管理数据"); + List maTypeVos = service.selectParentId(); + ExcelUtil util = new ExcelUtil<>(MaTypeVoLevelTwo.class); + util.exportExcel(response, maTypeVos, "工器具数据"); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseTaskMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseTaskMapper.java index 190355b6..7dd21cb8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseTaskMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseTaskMapper.java @@ -6,6 +6,7 @@ import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.material.lease.domain.vo.LeaseDeptInfo; import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.vo.MaTypeVo; +import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -89,9 +90,7 @@ public interface LeaseTaskMapper { /** * 根据level层级和typeID 查询父级ID */ - List selectParentId(); - - List getListByTypeName(@Param("typeId") Long typeId); + List selectParentId(); void updateLeaseTaskStatus(@Param("taskId") Long taskId, @Param("taskStatus") int taskStatus); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseTaskService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseTaskService.java index 61b28d70..02ee42ca 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseTaskService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseTaskService.java @@ -8,6 +8,7 @@ import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo; import com.bonus.material.lease.domain.vo.LeaseDeptInfo; import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.vo.MaTypeVo; +import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo; import java.util.List; @@ -77,7 +78,7 @@ public interface ILeaseTaskService { */ LeaseDeptInfo getCode(); - List selectParentId(); + List selectParentId(); /** @@ -87,9 +88,6 @@ public interface ILeaseTaskService { */ List getEquipmentThreeTypes(); - List getListByParentId(Long typeId); - - LeaseApplyInfo getApplyInfo(Long taskId); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java index 1bb03d2e..529ecd11 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java @@ -22,6 +22,7 @@ import com.bonus.material.lease.mapper.LeaseTaskMapper; import com.bonus.material.lease.service.ILeaseTaskService; import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.vo.MaTypeVo; +import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo; import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.domain.TmTaskAgreement; import com.bonus.material.task.mapper.TmTaskAgreementMapper; @@ -487,21 +488,9 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { } @Override - public List selectParentId() { + public List selectParentId() { return mapper.selectParentId(); } - - /** - * 根据组织树parent_id查询结果 - * - * @param typeId 父级id - */ - @Override - public List getListByParentId(Long typeId) { - return mapper.getListByTypeName(typeId); - } - - /** * 根据id查询领用任务信息 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/MaTypeVoLevelTwo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/MaTypeVoLevelTwo.java new file mode 100644 index 00000000..486fbb56 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/MaTypeVoLevelTwo.java @@ -0,0 +1,65 @@ +package com.bonus.material.ma.domain.vo; + +import com.bonus.common.core.annotation.Excel; +import com.bonus.material.ma.domain.Type; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.math.BigDecimal; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @PackagePath: com.bonus.material.ma.vo + * @CreateTime: 2024-10-14 17:47 + * @Description: 物资类型列表展示VO + */ +@Getter +@Setter +public class MaTypeVoLevelTwo { + /** 类型ID */ + @ApiModelProperty(value = "类型ID") + private Long typeId; + + /** 上级ID */ + @ApiModelProperty(value = "上级ID") + private Long parentId; + + @Excel(name = "物资名称", sort = 1) + @ApiModelProperty(value = "物资名称") + private String materialName; + + @Excel(name = "规格型号", sort = 2) + @ApiModelProperty(value = "规格型号") + private String typeName; + + /** 计量单位名称 */ + @ApiModelProperty(value = "计量单位名称") + @Excel(name = "计量单位",sort = 3) + private String unitName; + + /** 管理方式(0编号 1计数) */ + @Excel(name = "管理方式", readConverterExp = "0=编号,1=计数",sort = 4) + @ApiModelProperty(value = "管理方式(0编号 1计数)") + private String manageType; + + /** 层级 */ + @ApiModelProperty(value = "层级") + private String level; + + /** 外部租赁单价 */ + @Excel(name = "外部租赁单价",sort = 7) + @ApiModelProperty(value = "外部租赁单价") + private BigDecimal rentPrice; + + /** 内部租赁单价 */ + @Excel(name = "内部租赁单价",sort = 6) + @ApiModelProperty(value = "内部租赁单价") + private BigDecimal leasePrice; + + /** 实时库存 */ + @Excel(name = "实时库存",sort = 5) + @ApiModelProperty(value = "实时库存") + private BigDecimal storageNum; +} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml index 0dd6c130..7aeb6079 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml @@ -581,47 +581,28 @@ FROM ma_type m - SELECT DISTINCT - mt2.type_id + mt.type_name AS typeName, + mt2.type_name AS materialName, + mt3.type_name AS materialType, + mt4.type_name AS itemType, + mt.manage_type as manageType, + mt.unit_name as unitName, + mt.lease_price as leasePrice, + mt.rent_price as rentPrice, + mt.LEVEL as level, + mt.storage_num as storageNum FROM - ma_type mt - LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id - LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id - LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id - where mt2.type_id is not null + ma_type mt + LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id + LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id + LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id + where mt2.type_id is not null and mt.del_flag = '0' + and mt.`level` = 4 and mt2.`level` = 3 and mt3.`level` = 2 and mt4.`level` = 1 - - update tm_task