diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java index 1dd690dd..090977b0 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java @@ -318,4 +318,9 @@ public class LeaseApplyInfo extends BaseEntity{ private String ids; private Long leaseSignId; + + private List typeIdList; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; } 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 ac534162..178f384e 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 @@ -7,9 +7,12 @@ import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.basic.domain.*; import com.bonus.material.basic.domain.vo.MaTypeSelectInfo; import com.bonus.material.basic.service.ComplexQueryService; +import com.bonus.system.api.domain.SysUser; +import com.bonus.system.api.model.LoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; @@ -39,6 +42,8 @@ public class ComplexQueryController extends BaseController { @GetMapping("/getRetainedEquipmentList") public AjaxResult getRetainedEquipmentList(RetainedEquipmentInfo bean) { bean.setIsExport(1); + LoginUser loginUser = SecurityUtils.getLoginUser(); + bean.setUserId(loginUser.getUserid()); if (bean.getIsApp() != null && bean.getIsApp() == 1) { List pageList = complexQueryService.getRetainedEquipmentList(bean); return AjaxResult.success(pageList); @@ -284,6 +289,8 @@ public class ComplexQueryController extends BaseController { @ApiOperation(value = "综合查询--工程机具使用列表") @GetMapping("/getProjUsingRecordList") public AjaxResult getProjUsingRecordList(ProjUsingRecord bean) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + bean.setUserId(loginUser.getUserid()); startPage(); List pageList = complexQueryService.getProjUsingRecordList(bean); return AjaxResult.success(getDataTable(pageList)); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/ProjUsingRecord.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/ProjUsingRecord.java index 8c2b2f30..3d0bbf11 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/ProjUsingRecord.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/ProjUsingRecord.java @@ -113,4 +113,6 @@ public class ProjUsingRecord { private String externalIds; @ApiModelProperty(value = "关联外部(第三方)的工程ID") private String externalId; -} \ No newline at end of file + + private Long userId; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RetainedEquipmentInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RetainedEquipmentInfo.java index 25214e89..b5ff8ee3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RetainedEquipmentInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/RetainedEquipmentInfo.java @@ -157,4 +157,6 @@ public class RetainedEquipmentInfo { @ApiModelProperty(value = "三级类型id") private Integer thirdTypeId; -} \ No newline at end of file + @ApiModelProperty(value = "用户id") + private Long userId; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/BmTeamServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/BmTeamServiceImpl.java index cb0f0f74..273e5c44 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/BmTeamServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/BmTeamServiceImpl.java @@ -16,6 +16,7 @@ import com.bonus.material.clz.service.BmTeamService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -135,7 +136,10 @@ public class BmTeamServiceImpl implements BmTeamService { // 根据i8工程id查询班组信息 List ids = Collections.singletonList(tbTeam.getProjectId()); iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(ids); - return AjaxResult.success(iwsTeamUserVos); + if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) { + return AjaxResult.success(iwsTeamUserVos); + } + return AjaxResult.success(new ArrayList<>()); } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java index 5e89a4d5..16398c08 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java @@ -177,6 +177,17 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { @Override public List getRetainedEquipmentList(MaterialRetainedEquipmentInfo bean) { String username = SecurityUtils.getLoginUser().getUsername(); + // 根据用户名判断用户是否为班组长 + BmTeam teamData = materialMachineMapper.getTeamData(username); + if (teamData == null) { + // 根据用户名查询项目部信息 + String departId = mapper.getDepartId(username); + // 根据项目部id查询工程信息 + List projectIdList = mapper.getProjectId(departId); + if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) { + bean.setProjectIdList(projectIdList); + } + } BigDecimal totalPrice = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); BigDecimal totalStoreNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalUsNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); @@ -184,14 +195,11 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { BigDecimal totalInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalRepairInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalAllNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); - List recordList = materialMachineMapper.getRetainedEquipmentList(bean); Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); - if (!CollectionUtils.isEmpty(recordList) && deptId != null) { - // 删除元素 - recordList.removeIf(m -> !deptId.toString().equals(m.getImpUnit())); + if (deptId != null) { + bean.setImpUnit(deptId.toString()); } - // 根据用户名判断用户是否为班组长 - BmTeam teamData = materialMachineMapper.getTeamData(username); + List recordList = materialMachineMapper.getRetainedEquipmentList(bean); if (!org.springframework.util.CollectionUtils.isEmpty(recordList)) { if (teamData != null) { // 将sortedList中班组身份证号与username相同的元素过滤处理 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java index 597af222..45e4b52d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java @@ -179,6 +179,11 @@ public class LeaseApplyDetails extends BaseEntity { private String leaseSignId; + @ApiModelProperty(value = "一级类型id") + private Long firstId; + + private List typeIdList; + @ApiModelProperty(value = "领料物资名称汇总") private String maTypeNames; public LeaseApplyDetails(Long id, Long parentId, Long typeId, BigDecimal preNum, BigDecimal auditNum, BigDecimal alNum, String status, Long companyId) { @@ -194,9 +199,10 @@ public class LeaseApplyDetails extends BaseEntity { public LeaseApplyDetails() {} - public LeaseApplyDetails(Long parentId, String keyword, Long userId) { + public LeaseApplyDetails(Long parentId, String keyword, Long userId, List typeIdList) { this.parentId = parentId; this.keyword = keyword; this.userId = userId; + this.typeIdList = typeIdList; } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java index ec370818..50c29c69 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java @@ -141,7 +141,8 @@ public interface LeaseApplyDetailsMapper { * @param publishTask * @return */ - List getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask); + List getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask, + @Param("list") List typeIdList); /** * 根据领料任务id查询领料任务详细 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java index 4d908d6e..29fd9c4f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java @@ -134,4 +134,11 @@ public interface LeaseApplyInfoMapper { List getDetailsLeaseList(LeaseApplyDetails bean); LeaseConfirmSign getLeaseConfirmSign(LeaseApplyDetails bean); + + /** + * 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + * @param userId + * @return + */ + List selectTypeIdList(Long userId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java index b313021d..1f35b7e6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java @@ -88,7 +88,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo(); leaseApplyInfo.setId(id); Long userId = SecurityUtils.getLoginUser().getUserid(); - leaseApplyInfo.setUserId(userId); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId); + if (!CollectionUtils.isEmpty(typeIdList)) { + leaseApplyInfo.setTypeIdList(typeIdList); + } else { + leaseApplyInfo.setUserId(userId); + } Optional optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo)); LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo(); // 查询领用出库数据 @@ -134,11 +140,16 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { leaseApplyRequestVo.setLeaseApplyInfo(info); // 获取领料单详情 - List details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, userId)); + List details = new ArrayList<>(); + if (leaseApplyInfo.getUserId() != null) { + details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, userId, null)); + } else { + details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, null, typeIdList)); + } // 走单独的领用详情查询 if (StringUtils.isNotBlank(publishTask)) { // 根据领用批次查询领用详情 - details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask); + details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask, typeIdList); if (!CollectionUtils.isEmpty(details)) { for (LeaseApplyDetails detail : details) { if (detail.getPreNum().compareTo(detail.getAlNum()) == 0) { @@ -270,7 +281,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public List selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { - leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid()); + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid()); + } List list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); // 如果statusList包含3、4、5,则为领料出库查询,需查询领用出库数据,进行拼接 if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { @@ -291,6 +307,11 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) .collect(Collectors.toList()); if (!CollectionUtils.isEmpty(sortedList)) { + if (!CollectionUtils.isEmpty(typeIdList)) { + sortedList = sortedList.stream() + .filter(item -> typeIdList.contains(item.getFirstId())) + .collect(Collectors.toList()); + } String keyWord = leaseApplyInfo.getKeyWord(); // 如果关键字不为空,进行过滤 if (!StringUtils.isBlank(keyWord)) { @@ -946,7 +967,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public List selectLeaseApplyDetailsList(LeaseApplyInfo leaseApplyInfo) { - return leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(leaseApplyInfo.getId(), leaseApplyInfo.getKeyWord(), leaseApplyInfo.getUserId())); + return leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(leaseApplyInfo.getId(), leaseApplyInfo.getKeyWord(), leaseApplyInfo.getUserId(), null)); } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java index 30c802dd..93fa7ec3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java @@ -448,7 +448,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { if (StringUtils.isNotBlank(record.getPublishTask())) { // 根据领用批次查询领用详情 boolean isFinished = true; - List details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask()); + List details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask(), null); if (!CollectionUtils.isEmpty(details)) { for (LeaseApplyDetails bean : details) { if (bean.getAlNum().compareTo(bean.getPreNum()) != 0) { 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 c2f37589..144a02d7 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 @@ -361,7 +361,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { leaseApplyRequestVo.setLeaseApplyInfo(info); // 获取领料单详情 - List details = mapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyWord, userId)); + List details = mapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyWord, userId, null)); if (!CollectionUtils.isEmpty(details)) { leaseApplyRequestVo.setLeaseApplyDetailsList(details); for (LeaseApplyDetails detail : details) { 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 1610064b..82b9ae64 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 @@ -37,6 +37,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id LEFT JOIN ma_type mt ON mt.type_id = sai.type_id LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_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 + LEFT JOIN ma_type_manage mtm ON mt3.parent_id = mtm.type_id WHERE 1=1 @@ -52,6 +55,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sd.dept_name like concat('%', #{keyWord}, '%') ) + + and mtm.user_id = #{userId} + + and bu.unit_id = #{unitId} @@ -354,7 +361,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 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 - sai.`status` = '0' + sai.`status` = '0' and sai.`is_slt` = '0' AND sai.end_time IS NULL AND sai.back_id IS NULL GROUP BY mt.type_id @@ -456,8 +463,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id + LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id WHERE mt.`level` = 4 and mt.del_flag = '0' + + and mtm.user_id = #{userId} + + and mt.parent_id = #{typeId} @@ -474,6 +486,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.type_name like concat('%',#{keyWord},'%') ) + and mt2.type_name like concat('%',#{typeName},'%') @@ -493,7 +506,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bs.create_time as inputTime, CASE WHEN tt.`code` LIKE 'XG%' THEN '新购入库' - WHEN tt.`code` LIKE 'R%' THEN '修饰入库' + WHEN tt.`code` LIKE 'R%' THEN '修试入库' WHEN tt.`code` LIKE 'PD%' THEN '盘点入库' ELSE '未知入库类型' END AS inputType, diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml index 7fb4d4e0..06fa76e9 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml @@ -169,6 +169,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mt.type_name like concat('%',#{typeModelName},'%') + + and subquery1.impUnit = #{impUnit} + + + and subquery1.externalId in + + #{item} + + GROUP BY mt.type_id, subquery1.proId diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml index 7b06e908..66ea27ab 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml @@ -44,13 +44,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" IFNULL(lad.audit_num,0) as audit_num, IFNULL(lad.al_num,0) as al_num, IFNULL(lad.status,0) as status, mt.unit_name,mt.unit_value, - lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id + lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id, + mt4.type_id as firstId from lease_apply_details lad left join ma_type mt on lad.type_id = mt.type_id and mt.`level` = '4' and mt.del_flag = '0' left join ma_type mt2 on mt2.type_id = mt.parent_id and mt2.`level` = '3' and mt2.del_flag = '0' + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' left join (SELECT mt.type_id, mt2.type_name AS typeName, mt.type_name AS typeModelName, @@ -79,6 +82,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and lad.al_num = #{alNum} and lad.status = #{status} and lad.company_id = #{companyId} + + and mt4.type_id in + + #{item} + + @@ -439,13 +448,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" IFNULL(subquery0.num, 0) ELSE IFNULL(mt.storage_num, 0) - END as storageNum + END as storageNum, + mt4.type_id as firstId FROM lease_publish_details lpd LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id AND mt.del_flag = '0' LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0' + left join ma_type mt3 ON mt1.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' left join (SELECT mt.type_id, mt2.type_name AS typeName, mt.type_name AS typeModelName, @@ -460,12 +472,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND lpd.publish_task = lod.publish_task LEFT JOIN (SELECT id, parent_id, type_id from lease_apply_details GROUP BY parent_id, type_id) a on lpd.parent_id = a.parent_id and a.type_id = lpd.type_id + + JOIN ma_type_keeper mtk ON mtk.type_id = lpd.new_type AND mtk.user_id = #{userId} + WHERE lpd.publish_task = #{publishTask} AND (mt1.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%') OR mt.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%')) + + and mt4.type_id in + + #{item} + + GROUP BY lpd.new_type diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml index 26e4f6f4..31317899 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml @@ -57,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames, bp.contract_part as contractPart, sd.dept_name as impUnitName, - tt.task_type as taskType + tt.task_type as taskType, + mt3.type_id as firstId from lease_apply_info lai left join tm_task tt on lai.task_id = tt.task_id @@ -71,6 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sda.dict_type = 'lease_task_status' left join ma_type mt on lad.type_id = mt.type_id and mt.del_flag = '0' left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0' + left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0' + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId} @@ -334,7 +337,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lai.material_man AS materialMan, lai.confirm_time AS confirmTime, lai.is_confirm AS isConfirm, - lai.confirm_remark AS confirmRemark + lai.confirm_remark AS confirmRemark, + mt3.type_id AS firstId FROM lease_publish_details lpd LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id @@ -349,6 +353,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND mt.del_flag = '0' LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0' + left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0' + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' LEFT JOIN bm_agreement_info bai ON lpd.unit_id = bai.unit_id AND lpd.project_id = bai.project_id @@ -558,6 +564,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lod.create_time DESC + + update lease_out_details