Merge remote-tracking branch 'origin/master'

This commit is contained in:
liang.chao 2025-07-17 14:20:01 +08:00
commit f6bdfe2af9
16 changed files with 145 additions and 24 deletions

View File

@ -318,4 +318,9 @@ public class LeaseApplyInfo extends BaseEntity{
private String ids; private String ids;
private Long leaseSignId; private Long leaseSignId;
private List<Long> typeIdList;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
} }

View File

@ -7,9 +7,12 @@ import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult; 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.*;
import com.bonus.material.basic.domain.vo.MaTypeSelectInfo; import com.bonus.material.basic.domain.vo.MaTypeSelectInfo;
import com.bonus.material.basic.service.ComplexQueryService; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -39,6 +42,8 @@ public class ComplexQueryController extends BaseController {
@GetMapping("/getRetainedEquipmentList") @GetMapping("/getRetainedEquipmentList")
public AjaxResult getRetainedEquipmentList(RetainedEquipmentInfo bean) { public AjaxResult getRetainedEquipmentList(RetainedEquipmentInfo bean) {
bean.setIsExport(1); bean.setIsExport(1);
LoginUser loginUser = SecurityUtils.getLoginUser();
bean.setUserId(loginUser.getUserid());
if (bean.getIsApp() != null && bean.getIsApp() == 1) { if (bean.getIsApp() != null && bean.getIsApp() == 1) {
List<RetainedEquipmentInfo> pageList = complexQueryService.getRetainedEquipmentList(bean); List<RetainedEquipmentInfo> pageList = complexQueryService.getRetainedEquipmentList(bean);
return AjaxResult.success(pageList); return AjaxResult.success(pageList);
@ -284,6 +289,8 @@ public class ComplexQueryController extends BaseController {
@ApiOperation(value = "综合查询--工程机具使用列表") @ApiOperation(value = "综合查询--工程机具使用列表")
@GetMapping("/getProjUsingRecordList") @GetMapping("/getProjUsingRecordList")
public AjaxResult getProjUsingRecordList(ProjUsingRecord bean) { public AjaxResult getProjUsingRecordList(ProjUsingRecord bean) {
LoginUser loginUser = SecurityUtils.getLoginUser();
bean.setUserId(loginUser.getUserid());
startPage(); startPage();
List<ProjUsingRecord> pageList = complexQueryService.getProjUsingRecordList(bean); List<ProjUsingRecord> pageList = complexQueryService.getProjUsingRecordList(bean);
return AjaxResult.success(getDataTable(pageList)); return AjaxResult.success(getDataTable(pageList));

View File

@ -113,4 +113,6 @@ public class ProjUsingRecord {
private String externalIds; private String externalIds;
@ApiModelProperty(value = "关联外部(第三方)的工程ID") @ApiModelProperty(value = "关联外部(第三方)的工程ID")
private String externalId; private String externalId;
}
private Long userId;
}

View File

@ -157,4 +157,6 @@ public class RetainedEquipmentInfo {
@ApiModelProperty(value = "三级类型id") @ApiModelProperty(value = "三级类型id")
private Integer thirdTypeId; private Integer thirdTypeId;
} @ApiModelProperty(value = "用户id")
private Long userId;
}

View File

@ -16,6 +16,7 @@ import com.bonus.material.clz.service.BmTeamService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -135,7 +136,10 @@ public class BmTeamServiceImpl implements BmTeamService {
// 根据i8工程id查询班组信息 // 根据i8工程id查询班组信息
List<String> ids = Collections.singletonList(tbTeam.getProjectId()); List<String> ids = Collections.singletonList(tbTeam.getProjectId());
iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(ids); iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(ids);
return AjaxResult.success(iwsTeamUserVos); if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) {
return AjaxResult.success(iwsTeamUserVos);
}
return AjaxResult.success(new ArrayList<>());
} }
/** /**

View File

@ -177,6 +177,17 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
@Override @Override
public List<MaterialRetainedEquipmentInfo> getRetainedEquipmentList(MaterialRetainedEquipmentInfo bean) { public List<MaterialRetainedEquipmentInfo> getRetainedEquipmentList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername(); String username = SecurityUtils.getLoginUser().getUsername();
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (teamData == null) {
// 根据用户名查询项目部信息
String departId = mapper.getDepartId(username);
// 根据项目部id查询工程信息
List<String> projectIdList = mapper.getProjectId(departId);
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
bean.setProjectIdList(projectIdList);
}
}
BigDecimal totalPrice = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); BigDecimal totalPrice = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
BigDecimal totalStoreNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalStoreNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalUsNum = 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 totalInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalRepairInputNum = 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); BigDecimal totalAllNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainedEquipmentList(bean);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(recordList) && deptId != null) { if (deptId != null) {
// 删除元素 bean.setImpUnit(deptId.toString());
recordList.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
} }
// 根据用户名判断用户是否为班组长 List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainedEquipmentList(bean);
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (!org.springframework.util.CollectionUtils.isEmpty(recordList)) { if (!org.springframework.util.CollectionUtils.isEmpty(recordList)) {
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理

View File

@ -179,6 +179,11 @@ public class LeaseApplyDetails extends BaseEntity {
private String leaseSignId; private String leaseSignId;
@ApiModelProperty(value = "一级类型id")
private Long firstId;
private List<Long> typeIdList;
@ApiModelProperty(value = "领料物资名称汇总") @ApiModelProperty(value = "领料物资名称汇总")
private String maTypeNames; private String maTypeNames;
public LeaseApplyDetails(Long id, Long parentId, Long typeId, BigDecimal preNum, BigDecimal auditNum, BigDecimal alNum, String status, Long companyId) { 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() {}
public LeaseApplyDetails(Long parentId, String keyword, Long userId) { public LeaseApplyDetails(Long parentId, String keyword, Long userId, List<Long> typeIdList) {
this.parentId = parentId; this.parentId = parentId;
this.keyword = keyword; this.keyword = keyword;
this.userId = userId; this.userId = userId;
this.typeIdList = typeIdList;
} }
} }

View File

@ -141,7 +141,8 @@ public interface LeaseApplyDetailsMapper {
* @param publishTask * @param publishTask
* @return * @return
*/ */
List<LeaseApplyDetails> getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask); List<LeaseApplyDetails> getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask,
@Param("list") List<Long> typeIdList);
/** /**
* 根据领料任务id查询领料任务详细 * 根据领料任务id查询领料任务详细

View File

@ -134,4 +134,11 @@ public interface LeaseApplyInfoMapper {
List<LeaseApplyDetails> getDetailsLeaseList(LeaseApplyDetails bean); List<LeaseApplyDetails> getDetailsLeaseList(LeaseApplyDetails bean);
LeaseConfirmSign getLeaseConfirmSign(LeaseApplyDetails bean); LeaseConfirmSign getLeaseConfirmSign(LeaseApplyDetails bean);
/**
* 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
* @param userId
* @return
*/
List<Long> selectTypeIdList(Long userId);
} }

View File

@ -88,7 +88,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo(); LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo();
leaseApplyInfo.setId(id); leaseApplyInfo.setId(id);
Long userId = SecurityUtils.getLoginUser().getUserid(); Long userId = SecurityUtils.getLoginUser().getUserid();
leaseApplyInfo.setUserId(userId); // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId);
if (!CollectionUtils.isEmpty(typeIdList)) {
leaseApplyInfo.setTypeIdList(typeIdList);
} else {
leaseApplyInfo.setUserId(userId);
}
Optional<LeaseApplyInfo> optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo)); Optional<LeaseApplyInfo> optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo));
LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo(); LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo();
// 查询领用出库数据 // 查询领用出库数据
@ -134,11 +140,16 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
leaseApplyRequestVo.setLeaseApplyInfo(info); leaseApplyRequestVo.setLeaseApplyInfo(info);
// 获取领料单详情 // 获取领料单详情
List<LeaseApplyDetails> details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, userId)); List<LeaseApplyDetails> 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)) { if (StringUtils.isNotBlank(publishTask)) {
// 根据领用批次查询领用详情 // 根据领用批次查询领用详情
details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask); details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask, typeIdList);
if (!CollectionUtils.isEmpty(details)) { if (!CollectionUtils.isEmpty(details)) {
for (LeaseApplyDetails detail : details) { for (LeaseApplyDetails detail : details) {
if (detail.getPreNum().compareTo(detail.getAlNum()) == 0) { if (detail.getPreNum().compareTo(detail.getAlNum()) == 0) {
@ -270,7 +281,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
*/ */
@Override @Override
public List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { public List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) {
leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid()); Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId);
if (CollectionUtils.isEmpty(typeIdList)) {
leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid());
}
List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
// 如果statusList包含345则为领料出库查询需查询领用出库数据进行拼接 // 如果statusList包含345则为领料出库查询需查询领用出库数据进行拼接
if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) {
@ -291,6 +307,11 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) Comparator.nullsFirst(Comparator.naturalOrder())).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
if (!CollectionUtils.isEmpty(sortedList)) { if (!CollectionUtils.isEmpty(sortedList)) {
if (!CollectionUtils.isEmpty(typeIdList)) {
sortedList = sortedList.stream()
.filter(item -> typeIdList.contains(item.getFirstId()))
.collect(Collectors.toList());
}
String keyWord = leaseApplyInfo.getKeyWord(); String keyWord = leaseApplyInfo.getKeyWord();
// 如果关键字不为空进行过滤 // 如果关键字不为空进行过滤
if (!StringUtils.isBlank(keyWord)) { if (!StringUtils.isBlank(keyWord)) {
@ -946,7 +967,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
*/ */
@Override @Override
public List<LeaseApplyDetails> selectLeaseApplyDetailsList(LeaseApplyInfo leaseApplyInfo) { public List<LeaseApplyDetails> 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));
} }
/** /**

View File

@ -448,7 +448,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
if (StringUtils.isNotBlank(record.getPublishTask())) { if (StringUtils.isNotBlank(record.getPublishTask())) {
// 根据领用批次查询领用详情 // 根据领用批次查询领用详情
boolean isFinished = true; boolean isFinished = true;
List<LeaseApplyDetails> details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask()); List<LeaseApplyDetails> details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask(), null);
if (!CollectionUtils.isEmpty(details)) { if (!CollectionUtils.isEmpty(details)) {
for (LeaseApplyDetails bean : details) { for (LeaseApplyDetails bean : details) {
if (bean.getAlNum().compareTo(bean.getPreNum()) != 0) { if (bean.getAlNum().compareTo(bean.getPreNum()) != 0) {

View File

@ -361,7 +361,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
leaseApplyRequestVo.setLeaseApplyInfo(info); leaseApplyRequestVo.setLeaseApplyInfo(info);
// 获取领料单详情 // 获取领料单详情
List<LeaseApplyDetails> details = mapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyWord, userId)); List<LeaseApplyDetails> details = mapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyWord, userId, null));
if (!CollectionUtils.isEmpty(details)) { if (!CollectionUtils.isEmpty(details)) {
leaseApplyRequestVo.setLeaseApplyDetailsList(details); leaseApplyRequestVo.setLeaseApplyDetailsList(details);
for (LeaseApplyDetails detail : details) { for (LeaseApplyDetails detail : details) {

View File

@ -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 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 mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_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 WHERE
1=1 1=1
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
@ -52,6 +55,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sd.dept_name like concat('%', #{keyWord}, '%') sd.dept_name like concat('%', #{keyWord}, '%')
) )
</if> </if>
<if test="userId != null">
and mtm.user_id = #{userId}
</if>
<if test="unitId != null"> <if test="unitId != null">
and bu.unit_id = #{unitId} and bu.unit_id = #{unitId}
</if> </if>
@ -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 mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
WHERE WHERE
sai.`status` = '0' sai.`status` = '0' and sai.`is_slt` = '0'
AND sai.end_time IS NULL AND sai.end_time IS NULL
AND sai.back_id IS NULL AND sai.back_id IS NULL
GROUP BY mt.type_id 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 mt2 on mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.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 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 WHERE mt.`level` = 4
and mt.del_flag = '0' and mt.del_flag = '0'
<if test="userId != null ">
and mtm.user_id = #{userId}
</if>
<if test="typeId != null"> <if test="typeId != null">
<if test="level == 3"> <if test="level == 3">
and mt.parent_id = #{typeId} and mt.parent_id = #{typeId}
@ -474,6 +486,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name like concat('%',#{keyWord},'%') mt.type_name like concat('%',#{keyWord},'%')
) )
</if> </if>
<if test="typeName != null and typeName != ''"> <if test="typeName != null and typeName != ''">
and mt2.type_name like concat('%',#{typeName},'%') and mt2.type_name like concat('%',#{typeName},'%')
</if> </if>
@ -493,7 +506,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bs.create_time as inputTime, bs.create_time as inputTime,
CASE CASE
WHEN tt.`code` LIKE 'XG%' THEN '新购入库' WHEN tt.`code` LIKE 'XG%' THEN '新购入库'
WHEN tt.`code` LIKE 'R%' THEN '修入库' WHEN tt.`code` LIKE 'R%' THEN '修入库'
WHEN tt.`code` LIKE 'PD%' THEN '盘点入库' WHEN tt.`code` LIKE 'PD%' THEN '盘点入库'
ELSE '未知入库类型' ELSE '未知入库类型'
END AS inputType, END AS inputType,

View File

@ -169,6 +169,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeModelName != null and typeModelName != ''"> <if test="typeModelName != null and typeModelName != ''">
and mt.type_name like concat('%',#{typeModelName},'%') and mt.type_name like concat('%',#{typeModelName},'%')
</if> </if>
<if test="impUnit != null and impUnit != ''">
and subquery1.impUnit = #{impUnit}
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and subquery1.externalId in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY GROUP BY
mt.type_id, mt.type_id,
subquery1.proId subquery1.proId

View File

@ -44,13 +44,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(lad.audit_num,0) as audit_num, IFNULL(lad.audit_num,0) as audit_num,
IFNULL(lad.al_num,0) as al_num, IFNULL(lad.al_num,0) as al_num,
IFNULL(lad.status,0) as status, mt.unit_name,mt.unit_value, 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 from
lease_apply_details lad lease_apply_details lad
left join left join
ma_type mt on lad.type_id = mt.type_id and mt.`level` = '4' and mt.del_flag = '0' ma_type mt on lad.type_id = mt.type_id and mt.`level` = '4' and mt.del_flag = '0'
left join left join
ma_type mt2 on mt2.type_id = mt.parent_id and mt2.`level` = '3' and mt2.del_flag = '0' 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, left join (SELECT mt.type_id,
mt2.type_name AS typeName, mt2.type_name AS typeName,
mt.type_name AS typeModelName, mt.type_name AS typeModelName,
@ -79,6 +82,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="alNum != null "> and lad.al_num = #{alNum}</if> <if test="alNum != null "> and lad.al_num = #{alNum}</if>
<if test="status != null and status != ''"> and lad.status = #{status}</if> <if test="status != null and status != ''"> and lad.status = #{status}</if>
<if test="companyId != null "> and lad.company_id = #{companyId}</if> <if test="companyId != null "> and lad.company_id = #{companyId}</if>
<if test="typeIdList != null and typeIdList.size() > 0">
and mt4.type_id in
<foreach item="item" collection="typeIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
</select> </select>
@ -439,13 +448,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(subquery0.num, 0) IFNULL(subquery0.num, 0)
ELSE ELSE
IFNULL(mt.storage_num, 0) IFNULL(mt.storage_num, 0)
END as storageNum END as storageNum,
mt4.type_id as firstId
FROM FROM
lease_publish_details lpd lease_publish_details lpd
LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id
AND mt.del_flag = '0' AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0' 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, left join (SELECT mt.type_id,
mt2.type_name AS typeName, mt2.type_name AS typeName,
mt.type_name AS typeModelName, mt.type_name AS typeModelName,
@ -460,12 +472,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND lpd.publish_task = lod.publish_task 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 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 on lpd.parent_id = a.parent_id and a.type_id = lpd.type_id
<if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lpd.new_type AND mtk.user_id = #{userId}
</if>
WHERE WHERE
lpd.publish_task = #{publishTask} lpd.publish_task = #{publishTask}
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
AND (mt1.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%') AND (mt1.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%')
OR mt.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%')) OR mt.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%'))
</if> </if>
<if test="typeIdList != null and typeIdList.size() > 0">
and mt4.type_id in
<foreach item="item" collection="typeIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY GROUP BY
lpd.new_type lpd.new_type
</select> </select>

View File

@ -57,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames, GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
bp.contract_part as contractPart, bp.contract_part as contractPart,
sd.dept_name as impUnitName, sd.dept_name as impUnitName,
tt.task_type as taskType tt.task_type as taskType,
mt3.type_id as firstId
from from
lease_apply_info lai lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id 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' 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 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 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'
<if test="userId != null"> <if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId} JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId}
</if> </if>
@ -334,7 +337,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lai.material_man AS materialMan, lai.material_man AS materialMan,
lai.confirm_time AS confirmTime, lai.confirm_time AS confirmTime,
lai.is_confirm AS isConfirm, lai.is_confirm AS isConfirm,
lai.confirm_remark AS confirmRemark lai.confirm_remark AS confirmRemark,
mt3.type_id AS firstId
FROM FROM
lease_publish_details lpd lease_publish_details lpd
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id 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' AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0' 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 LEFT JOIN bm_agreement_info bai ON lpd.unit_id = bai.unit_id
AND lpd.project_id = bai.project_id AND lpd.project_id = bai.project_id
<if test="userId != null"> <if test="userId != null">
@ -558,6 +564,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lod.create_time DESC lod.create_time DESC
</select> </select>
<select id="selectTypeIdList" resultType="java.lang.Long">
select
type_id
from
ma_type_manage
where
user_id = #{userId}
</select>
<update id="confirmLeaseTask"> <update id="confirmLeaseTask">
update update
lease_out_details lease_out_details