This commit is contained in:
hongchao 2025-03-10 08:57:30 +08:00
commit 28d494fcf1
9 changed files with 214 additions and 54 deletions

View File

@ -152,6 +152,12 @@ public class LeaseApplyDetails extends BaseEntity {
@ApiModelProperty(value = "发布批次") @ApiModelProperty(value = "发布批次")
private String publishTask; private String publishTask;
@ApiModelProperty(value = "领料单位")
private String leaseUnit;
@ApiModelProperty(value = "租赁工程")
private String leaseProject;
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) {
this.id = id; this.id = id;
this.parentId = parentId; this.parentId = parentId;

View File

@ -142,4 +142,17 @@ public interface LeaseApplyDetailsMapper {
*/ */
List<LeaseApplyDetails> getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask); List<LeaseApplyDetails> getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask);
/**
* 根据领料任务id查询领料任务详细
* @param leaseApplyDetails
* @return
*/
LeaseApplyDetails selectInfo(LeaseApplyDetails leaseApplyDetails);
/**
* 根据领用任务批次查询领用任务详细
* @param leaseApplyDetails
* @return
*/
List<LeaseApplyDetails> selectPublishDetails(LeaseApplyDetails leaseApplyDetails);
} }

View File

@ -88,7 +88,21 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
leaseApplyInfo.setUserId(userId); 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();
// 查询领用出库数据
if (StringUtils.isNotBlank(publishTask)) {
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublishList(leaseApplyInfo);
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
LeaseApplyInfo applyInfo = leaseApplyOutList.get(0);
if (applyInfo.getPreCountNum().compareTo(applyInfo.getAlNum()) == 0) {
applyInfo.setTaskStatus(LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus());
applyInfo.setTaskStatusName(LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatusName());
} else {
applyInfo.setTaskStatus(LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus());
applyInfo.setTaskStatusName(LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatusName());
}
optionalInfo = Optional.of(leaseApplyOutList.get(0));
}
}
optionalInfo.ifPresent(info -> { optionalInfo.ifPresent(info -> {
BmFileInfo bmFileInfo = new BmFileInfo(); BmFileInfo bmFileInfo = new BmFileInfo();
bmFileInfo.setModelId(id); bmFileInfo.setModelId(id);
@ -113,7 +127,26 @@ 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 = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, userId));
// 走单独的领用详情查询
if (StringUtils.isNotBlank(publishTask)) {
// 根据领用批次查询领用详情
details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask);
if (!CollectionUtils.isEmpty(details)) { if (!CollectionUtils.isEmpty(details)) {
for (LeaseApplyDetails detail : details) {
if (detail.getPreNum().compareTo(detail.getAlNum()) == 0) {
detail.setStatus("2");
} else {
detail.setStatus("1");
}
}
}
}
if (!CollectionUtils.isEmpty(details)) {
/*if (StringUtils.isNotBlank(keyword)) {
details = details.stream()
.filter(item -> containsDetailsKeyword(item, keyword))
.collect(Collectors.toList());
}*/
leaseApplyRequestVo.setLeaseApplyDetailsList(details); leaseApplyRequestVo.setLeaseApplyDetailsList(details);
for (LeaseApplyDetails detail : details) { for (LeaseApplyDetails detail : details) {
// 获取编码详情 // 获取编码详情
@ -125,23 +158,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
} }
}); });
// 走单独的领用详情查询
if (StringUtils.isNotBlank(publishTask)) {
LeaseApplyRequestVo info = new LeaseApplyRequestVo();
// 根据领用批次查询领用详情
List<LeaseApplyDetails> details = leaseApplyDetailsMapper.getDetailsPublish(keyword,publishTask);
if (!CollectionUtils.isEmpty(details)) {
for (LeaseApplyDetails detail : details) {
if (detail.getOutNum().compareTo(detail.getAlNum()) == 0) {
detail.setStatus("2");
} else {
detail.setStatus("1");
}
}
info.setLeaseApplyDetailsList(details);
}
return info;
}
return leaseApplyRequestVo; return leaseApplyRequestVo;
} catch (Exception e) { } catch (Exception e) {
@ -151,7 +167,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
} }
} }
/** /**
* 查询领料任务列表 * 查询领料任务列表
* *
@ -164,7 +179,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
// 如果statusList包含345则为领料出库查询需查询领用出库数据进行拼接 // 如果statusList包含345则为领料出库查询需查询领用出库数据进行拼接
if (leaseApplyInfo.getStatusList() != null && leaseApplyInfo.getStatusList().contains(3) if (leaseApplyInfo.getStatusList() != null && leaseApplyInfo.getStatusList().contains(3)
&& leaseApplyInfo.getStatusList().contains(4) && leaseApplyInfo.getStatusList().contains(5)) { || leaseApplyInfo.getStatusList().contains(4) || leaseApplyInfo.getStatusList().contains(5)) {
// 查询领用出库数据 // 查询领用出库数据
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublishList(leaseApplyInfo); List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublishList(leaseApplyInfo);
if (!CollectionUtils.isEmpty(leaseApplyOutList)) { if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
@ -192,6 +207,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
.filter(item -> containsKeyword(item, keyWord)) .filter(item -> containsKeyword(item, keyWord))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
// 判断状态
if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) {
// 将集合sortedList中状态taskStatus包含在leaseApplyInfo.getStatusList()中的元素
sortedList = sortedList.stream()
.filter(item -> leaseApplyInfo.getStatusList().contains(item.getTaskStatus()))
.collect(Collectors.toList());
}
} }
return sortedList; return sortedList;
} }
@ -734,7 +756,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
*/ */
@Override @Override
public LeaseApplyDetails getInnerById(LeaseApplyDetails leaseApplyDetails) { public LeaseApplyDetails getInnerById(LeaseApplyDetails leaseApplyDetails) {
return leaseApplyDetailsMapper.getInnerById(leaseApplyDetails); LeaseApplyDetails info = leaseApplyDetailsMapper.getInnerById(leaseApplyDetails);
// 根据领用批次查询领用详情
if (StringUtils.isNotBlank(leaseApplyDetails.getPublishTask())) {
info = leaseApplyDetailsMapper.selectInfo(leaseApplyDetails);
}
return info;
} }
/** /**
@ -744,7 +771,11 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
*/ */
@Override @Override
public List<LeaseApplyDetails> getDetailsById(LeaseApplyDetails leaseApplyDetails) { public List<LeaseApplyDetails> getDetailsById(LeaseApplyDetails leaseApplyDetails) {
return leaseApplyDetailsMapper.getDetailsById(leaseApplyDetails); List<LeaseApplyDetails> list = leaseApplyDetailsMapper.getDetailsById(leaseApplyDetails);
if (StringUtils.isNotBlank(leaseApplyDetails.getPublishTask())) {
list = leaseApplyDetailsMapper.selectPublishDetails(leaseApplyDetails);
}
return list;
} }
/** /**

View File

@ -163,7 +163,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult leaseOut(LeaseOutDetails record) { public AjaxResult leaseOut(LeaseOutDetails record) {
int res = 0; int res = 0;
try { /*try {*/
// 1判断库存是否足够 // 1判断库存是否足够
boolean isEnough = checkStorageIsEnough(record); boolean isEnough = checkStorageIsEnough(record);
record.setPreStoreNum(getStorageNum(record)); record.setPreStoreNum(getStorageNum(record));
@ -209,10 +209,10 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
} else { } else {
return AjaxResult.error("已领数量大于预领数量或该机具未在库"); return AjaxResult.error("已领数量大于预领数量或该机具未在库");
} }
} catch (Exception e) { /*} catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
return AjaxResult.error("出库失败"); return AjaxResult.error("出库失败");
} }*/
return AjaxResult.success("出库成功"); return AjaxResult.success("出库成功");
} }
@ -364,7 +364,11 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId()); String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
// 领用任务状态改为已完成 // 领用任务状态改为已完成
res = tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus()); res = tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus());
if (res == 0) {
throw new RuntimeException("领用任务状态修改失败");
} }
}
res = 1;
return res; return res;
} }
// 进行状态判断 // 进行状态判断

View File

@ -719,7 +719,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
boolean allMatch = true; boolean allMatch = true;
if (!CollectionUtils.isEmpty(leaseApplyDetails)) { if (!CollectionUtils.isEmpty(leaseApplyDetails)) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
if (leaseApplyDetail.getPreNum().compareTo(leaseApplyDetail.getPublishNum()) <= 0) { if (leaseApplyDetail.getPreNum().compareTo(leaseApplyDetail.getPublishNum()) > 0) {
allMatch = false; allMatch = false;
break; break;
} }

View File

@ -277,7 +277,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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 tm_task tt ON bs.task_id = tt.task_id LEFT JOIN tm_task tt ON bs.task_id = tt.task_id
WHERE bs.in_num != 0 WHERE bs.in_num != 0 and and bs.result_msg = '操作成功'
<if test="inputType != null and inputType != ''"> <if test="inputType != null and inputType != ''">
and ( and (
CASE CASE
@ -320,7 +320,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHEN bs.out_type = '1' THEN '数量' WHEN bs.out_type = '1' THEN '数量'
WHEN bs.out_type = '2' THEN '二维码' WHEN bs.out_type = '2' THEN '二维码'
WHEN bs.out_type = '3' THEN '标准箱' WHEN bs.out_type = '3' THEN '标准箱'
ELSE '未知库方式' ELSE '未知库方式'
END AS outStyle, END AS outStyle,
mt3.type_id as firstTypeId, mt3.type_id as firstTypeId,
mt2.type_id as secondTypeId mt2.type_id as secondTypeId
@ -339,7 +339,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
AND mt3.del_flag = '0' AND mt3.del_flag = '0'
LEFT JOIN tm_task tt ON bs.task_id = tt.task_id LEFT JOIN tm_task tt ON bs.task_id = tt.task_id
WHERE bs.out_num != 0 WHERE bs.out_num != 0 and bs.result_msg = '操作成功'
<if test="unitId != null"> <if test="unitId != null">
and bui.unit_id = #{unitId} and bui.unit_id = #{unitId}
</if> </if>
@ -353,7 +353,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHEN bs.out_type = '1' THEN '数量' WHEN bs.out_type = '1' THEN '数量'
WHEN bs.out_type = '2' THEN '二维码' WHEN bs.out_type = '2' THEN '二维码'
WHEN bs.out_type = '3' THEN '标准箱' WHEN bs.out_type = '3' THEN '标准箱'
ELSE '未知库方式' ELSE '未知库方式'
END = #{outStyle} END = #{outStyle}
) )
</if> </if>
@ -633,7 +633,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN tm_task tt ON bs.task_id = tt.task_id LEFT JOIN tm_task tt ON bs.task_id = tt.task_id
LEFT JOIN ma_type_keeper mtk ON mtk.type_id = bs.type_id LEFT JOIN ma_type_keeper mtk ON mtk.type_id = bs.type_id
LEFT JOIN sys_user su ON mtk.user_id = su.user_id LEFT JOIN sys_user su ON mtk.user_id = su.user_id
WHERE bs.in_num != 0 WHERE bs.in_num != 0 and bs.result_msg = '操作成功'
<if test="typeId != null"> <if test="typeId != null">
AND bs.type_id = #{typeId} AND bs.type_id = #{typeId}
</if> </if>

View File

@ -414,7 +414,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getDetailsPublish" resultType="com.bonus.material.lease.domain.LeaseApplyDetails"> <select id="getDetailsPublish" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT SELECT
lpd.id AS id, a.id AS id,
lpd.parent_id AS parentId, lpd.parent_id AS parentId,
mt1.type_name AS maTypeName, mt1.type_name AS maTypeName,
mt.type_name AS typeName, mt.type_name AS typeName,
@ -423,15 +423,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL( lpd.num, 0 ) AS preNum, IFNULL( lpd.num, 0 ) AS preNum,
IFNULL( lpd.num, 0 ) - IFNULL( SUM( lod.out_num ), 0 ) AS outNum, IFNULL( lpd.num, 0 ) - IFNULL( SUM( lod.out_num ), 0 ) AS outNum,
IFNULL( SUM( lod.out_num ), 0 ) AS alNum, IFNULL( SUM( lod.out_num ), 0 ) AS alNum,
lpd.publish_task AS publishTask lpd.publish_task AS publishTask,
mt.manage_type AS manageType,
CASE mt.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)
ELSE
IFNULL(mt.storage_num, 0)
END as storageNum
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 lease_out_details lod ON lpd.parent_id = lod.parent_id left join (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count(mm.ma_id) num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null
and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
LEFT JOIN lease_out_details lod ON lpd.type_id = lod.type_id
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
on lpd.parent_id = a.parent_id and a.type_id = lpd.type_id
WHERE WHERE
lpd.publish_task = #{publishTask} lpd.publish_task = #{publishTask}
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
@ -442,4 +461,77 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lpd.new_type lpd.new_type
</select> </select>
<select id="selectInfo" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT
lpd.id AS id,
lpd.parent_id AS parentId,
mt1.type_name AS maTypeName,
mt.type_name AS typeName,
mt.unit_name AS unitName,
lpd.new_type AS typeId,
IFNULL( lpd.num, 0 ) AS preNum,
IFNULL( lpd.num, 0 ) - IFNULL( SUM( lod.out_num ), 0 ) AS outNum,
IFNULL( SUM( lod.out_num ), 0 ) AS alNum,
lpd.publish_task AS publishTask,
lpd.unit_id AS unitId,
lpd.project_id AS projectId,
bu.unit_name AS leaseUnit,
bp.pro_name AS leaseProject,
CASE mt.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)
ELSE
IFNULL(mt.storage_num, 0)
END as storageNum
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 (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count(mm.ma_id) num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null
and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
LEFT JOIN lease_out_details lod ON lpd.parent_id = lod.parent_id
AND lpd.publish_task = lod.publish_task
LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id
WHERE
lpd.publish_task = #{publishTask}
<if test="typeId != null ">
AND lpd.new_type = #{typeId}
</if>
GROUP BY
lpd.new_type
</select>
<select id="selectPublishDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT
mt1.type_name as maTypeName,
mt.type_name as typeName,
mm.ma_code as maCode,
lod.create_by as createBy,
lod.create_time as createTime,
lod.ma_id as maId
FROM
lease_out_details lod
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt1.type_id = mt.parent_id
AND mt1.del_flag = '0'
LEFT JOIN lease_publish_details lpd on lod.publish_task = lpd.publish_task
and lod.type_id = lpd.type_id
LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id
where lod.publish_task = #{publishTask} and lod.type_id = #{typeId}
ORDER BY
lod.create_time DESC
</select>
</mapper> </mapper>

View File

@ -264,14 +264,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.pro_name AS leaseProject, bp.pro_name AS leaseProject,
bai.agreement_code AS agreementCode, bai.agreement_code AS agreementCode,
IFNULL( sum( lpd.num ), 0 ) AS preCountNum, IFNULL( sum( lpd.num ), 0 ) AS preCountNum,
IFNULL( sum( lod.out_num ), 0 ) AS alNum, IFNULL(lod.num, 0) AS alNum,
GROUP_CONCAT( mt1.type_name ) AS maTypeNames, GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
lpd.publish_task AS publishTask lpd.publish_task AS publishTask
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
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN lease_out_details lod ON lpd.parent_id = lod.parent_id LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task from lease_out_details
GROUP BY parent_id, publish_task) lod ON lpd.parent_id = lod.parent_id
AND lpd.publish_task = lod.publish_task AND lpd.publish_task = lod.publish_task
LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id
@ -282,6 +283,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt1.del_flag = '0' AND mt1.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">
JOIN ma_type_keeper mtk ON mtk.type_id = lpd.type_id AND mtk.user_id = #{userId}
</if>
where 1 = 1
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="id != null ">
AND lai.id = #{id}
</if>
<if test="publishTask != null and publishTask != ''">
AND lpd.publish_task = #{publishTask}
</if>
GROUP BY GROUP BY
lpd.publish_task lpd.publish_task
ORDER BY ORDER BY

View File

@ -106,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectAgreementId" resultType="java.lang.String"> <select id="selectAgreementId" resultType="java.lang.String">
SELECT bai.agreement_id SELECT DISTINCT bai.agreement_id
FROM bm_agreement_info bai FROM bm_agreement_info bai
LEFT JOIN lease_publish_details lpd ON bai.unit_id = lpd.unit_id LEFT JOIN lease_publish_details lpd ON bai.unit_id = lpd.unit_id
AND bai.project_id = lpd.project_id AND bai.project_id = lpd.project_id