工程页面增加分公司字段

This commit is contained in:
mashuai 2025-11-20 14:33:20 +08:00
parent 90853274b2
commit d9ccc42c98
19 changed files with 139 additions and 23 deletions

View File

@ -1,6 +1,7 @@
package com.bonus.material.push.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@ -29,6 +30,10 @@ public class CostPushBean implements java.io.Serializable {
private String unitId;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司", sort = 0)
private String impUnitName;
@Excel(name = "工程名称", sort = 1)
private String projectName;

View File

@ -28,6 +28,11 @@ public class IwsCostPushBean implements Serializable {
private String id;
private Long parentId;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司", sort = 0)
private String impUnitName;
// 协议号
@Excel(name = "协议号", sort = 1)
private String agreementCode;

View File

@ -27,6 +27,10 @@ public class PartDetails extends BaseEntity {
*/
private Long id;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司", sort = 1)
private String impUnitName;
/**
* 任务ID
*/

View File

@ -25,6 +25,10 @@ public class RepairProjectInfo extends BaseEntity {
/** $column.columnComment */
private Long id;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
/** 维修时间 */
@Excel(name = "维修时间", width = 20)
@ApiModelProperty(value = "维修时间")

View File

@ -12,6 +12,11 @@ import java.util.Date;
public class TestRecord implements Serializable {
private String id;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
/**
* 退回单位名称
*/

View File

@ -27,6 +27,10 @@ public class SltAgreementInfo extends BaseEntity {
/** ID */
private Long id;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
/** 协议id */
@Excel(name = "协议id")
@ApiModelProperty(value = "协议id")

View File

@ -33,6 +33,10 @@ public class SltAgreementReduce extends BaseEntity {
@ApiModelProperty(value = "协议id")
private Long agreementId;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司", sort = 1)
private String impUnitName;
private List<Long> agreementIds;
/** 结算单号例如JM202402-1 */

View File

@ -32,6 +32,10 @@ public class SltAgreementReduceRecord {
@ApiModelProperty(value = "创建人")
private String creator;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
@Excel(name = "申请时间", sort = 1, dateFormat = "yyyy-MM-dd HH:mm:ss", width = 30)

View File

@ -20,6 +20,9 @@ public class PeriodCostResultVo {
@ApiModelProperty(value = "协议ID")
private Long agreementId;
@ApiModelProperty(value = "分公司")
private String impUnitName;
@ApiModelProperty(value = "协议编号")
private String agreementCode;

View File

@ -22,6 +22,10 @@ public class PeriodCostSummaryVo {
@ApiModelProperty(value = "协议ID")
private Long agreementId;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
@ApiModelProperty(value = "协议编号")
@Excel(name = "协议编号")
private String agreementCode;

View File

@ -22,6 +22,10 @@ import java.util.List;
@Accessors(chain = true)
public class SltInfoVo {
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
/**
* 结算单位
*/

View File

@ -263,6 +263,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
@Override
public SltInfoVo getSltInfoReportBatch(SltAgreementInfo info) {
SltInfoVo sltInfoVo = new SltInfoVo();
sltInfoVo.setImpUnitName(info.getImpUnitName());
sltInfoVo.setUnitName(info.getUnitName());
sltInfoVo.setProjectName(info.getProjectName());
BigDecimal leaseCost = BigDecimal.ZERO, repairCost= BigDecimal.ZERO ;
@ -1753,6 +1754,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
PeriodCostSummaryVo summary = new PeriodCostSummaryVo();
summary.setAgreementId(agreementId);
summary.setAgreementCode(firstDetail.getAgreementCode());
summary.setImpUnitName(firstDetail.getImpUnitName());
summary.setUnitId(firstDetail.getUnitId());
summary.setUnitName(firstDetail.getUnitName());
summary.setProjectId(firstDetail.getProjectId());

View File

@ -529,7 +529,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and (
lai.create_by like concat('%',#{keyWord},'%') or
bp.pro_name like concat('%',#{keyWord},'%') or
lai.lease_person like concat('%',#{keyWord},'%')
lai.lease_person like concat('%',#{keyWord},'%') or
lai.code like concat('%',#{keyWord},'%')
)
</if>
<if test="taskStatus != null"> and tt.task_status = #{taskStatus}</if>

View File

@ -10,10 +10,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bu.unit_name AS unitName,
bma.agreement_id AS agreementId,bma.`agreement_code` AS agreementCode, bma.sign_time AS signTime, bma.is_push AS isPush,
IF(saa.audit_time IS NULL,0,1) AS isSettlement, saa.audit_time AS settlementTime,
IF(saas.audit_time IS NULL,0,1) AS safetyIsSettlement, saas.audit_time AS safetySettlementTime
IF(saas.audit_time IS NULL,0,1) AS safetyIsSettlement, saas.audit_time AS safetySettlementTime,
sd.dept_name AS impUnitName
FROM
bm_agreement_info bma
LEFT JOIN bm_project bp ON bp.pro_id = bma.project_id
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bu ON bu.unit_id = bma.unit_id
LEFT JOIN slt_agreement_apply saa ON saa.agreement_id = bma.agreement_id AND saa.`status` = '2' AND saa.settlement_type = 1
LEFT JOIN slt_agreement_apply saas ON saas.agreement_id = bma.agreement_id AND saas.`status` = '2' AND saas.settlement_type = 2
@ -52,12 +54,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ifnull( pmc.LEASE_MONEY, 0 )+ ifnull( pmc.LOST_MONEY, 0 )+ ifnull( pmc.REPAIR_MONEY, 0 )+ ifnull( pmc.SCRAP_MONEY, 0 ), 2
) AS money,
a.pushStatus AS pushStatus,
a.pushRemark AS pushRemark
a.pushRemark AS pushRemark,
sd.dept_name AS impUnitName
FROM
project_month_costs pmc
LEFT JOIN calc_project_month cpm on pmc.task_id = cpm.id
LEFT JOIN bm_agreement_info bma ON pmc.AGREEMENT_ID = bma.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bma.project_id
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bu ON bu.unit_id = bma.unit_id
LEFT JOIN (
@ -130,6 +134,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="settlementType != null">
AND pmc.TYPE = #{settlementType}
</if>
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
</if>
GROUP BY
pmc.AGREEMENT_ID, pmc.TYPE

View File

@ -24,13 +24,15 @@
a.pushStatus as pushStatus,
a.pushRemark as pushRemark,
ROUND(ifnull(pmc.LEASE_MONEY,0)+ifnull(pmc.LOST_MONEY,0)+ifnull(pmc.SCRAP_MONEY,0),2) as money,
pmc.CHECK_STATUS as checkStatus
pmc.CHECK_STATUS as checkStatus,
sd.dept_name AS impUnitName
from
project_month_costs pmc
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = pmc.AGREEMENT_ID
LEFT JOIN calc_project_month cpm on pmc.task_id=cpm.id
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
LEFT JOIN (
SELECT
pmi.agreementId,pmi.id,pmi.push_status as pushStatus,
@ -102,13 +104,15 @@
pmia.push_status AS pushStatus,
pmia.push_remark AS pushRemark,
ifnull( pmc.CONSUME_MONEY, 0 ) AS leaseMoney,
pmc.CHECK_STATUS AS checkStatus
pmc.CHECK_STATUS AS checkStatus,
sd.dept_name AS impUnitName
FROM
project_month_costs pmc
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = pmc.AGREEMENT_ID
LEFT JOIN calc_project_month cpm ON pmc.task_id = cpm.id
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
LEFT JOIN (
SELECT
pmi.type,

View File

@ -14,13 +14,15 @@
SUM(srd.lease_price * srd.num) as leasePrice,
SUM(srd.lease_money) as leaseMoney,
swr.workflow_status as status,
a.leaseMoneyAll as leaseMoneyAll
a.leaseMoneyAll as leaseMoneyAll,
sd.dept_name AS impUnitName
FROM
slt_reduce_apply sra
LEFT JOIN slt_reduce_details srd on sra.id=srd.apply_id
LEFT JOIN sys_user su on su.user_id=sra.creator
LEFT JOIN bm_agreement_info bai on bai.agreement_id=sra.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
LEFT JOIN sys_workflow_record swr ON swr.task_id = sra.id
LEFT JOIN
@ -129,13 +131,15 @@
swrs.node_id AS nodeId,
swrs.next_node_id AS nextNodeId,
swrs.record_id AS recordId,
swn.node_sign_type as nodeSignType
swn.node_sign_type as nodeSignType,
sd.dept_name as impUnitName
FROM
slt_reduce_apply sra
LEFT JOIN slt_reduce_details srd on sra.id=srd.apply_id
LEFT JOIN sys_user su on su.user_id=sra.creator
LEFT JOIN bm_agreement_info bai on bai.agreement_id=sra.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
LEFT JOIN sys_workflow_record swr on sra.id = swr.task_id
LEFT JOIN sys_workflow_type swt on swr.workflow_id = swt.id

View File

@ -15,12 +15,14 @@
bai.agreement_code AS agreementCode,
saa.cost AS costs,
saa.`status`,
saa.remark
saa.remark,
sd.dept_name AS impUnitName
FROM slt_agreement_apply saa
LEFT JOIN sys_user su on su.user_id = saa.creator and su.del_flag = 0
LEFT JOIN bm_agreement_info bai on bai.agreement_id = saa.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
WHERE saa.status in ('1', '2', '3')
@ -31,7 +33,8 @@
bui.unit_name LIKE concat('%', #{keyWord}, '%') or
bp.pro_name LIKE concat('%', #{keyWord}, '%') or
bai.agreement_code LIKE concat('%', #{keyWord}, '%') or
saa.remark LIKE concat('%', #{keyWord}, '%')
saa.remark LIKE concat('%', #{keyWord}, '%') or
sd.dept_name LIKE concat('%', #{keyWord}, '%')
)
</if>
<if test="startTime != null and endTime != null ">

View File

@ -1200,7 +1200,8 @@
mt2.type_name AS typeName,
mt1.type_name AS typeModelName,
rad.create_time AS repairTime ,
mm.ma_code AS maCode
mm.ma_code AS maCode,
sd.dept_name AS impUnitName
FROM
repair_apply_details rad
LEFT JOIN repair_audit_details rd ON rad.id = rd.repair_id
@ -1210,6 +1211,7 @@
AND bagi.`status` = '1'
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id
AND bp.del_flag = '0'
left join sys_dept sd on sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bu ON bu.unit_id = bagi.unit_id
AND bu.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt1.type_id = rad.type_id
@ -1229,6 +1231,9 @@
<if test="proId != null and proId != ''">
and bp.pro_id = #{proId}
</if>
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
</if>
<if test="typeName != null and typeName != ''">
and mt2.type_name like CONCAT('%', #{typeName}, '%')
</if>
@ -1473,7 +1478,8 @@
subquery2.taskCode AS repairCode,
subquery2.unitName AS backUnitName,
subquery2.proName AS backProjectName,
subquery2.createTime AS repairTime
subquery2.createTime AS repairTime,
subquery2.impUnitName AS impUnitName
FROM ma_type mt
LEFT JOIN (
SELECT
@ -1486,7 +1492,8 @@
tt.code AS taskCode,
bu.unit_name AS unitName,
bp.pro_name AS proName,
tt.create_time AS createTime
tt.create_time AS createTime,
sd.dept_name AS impUnitName
FROM repair_apply_details rad
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
@ -1496,6 +1503,7 @@
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
WHERE
tt.task_status IN (0, 4) and tt.code is not null
@ -1516,11 +1524,15 @@
OR subquery2.proName like concat('%', #{keyWord}, '%')
OR mt2.type_name like concat('%', #{keyWord}, '%')
OR mt.type_name like concat('%', #{keyWord}, '%')
OR subquery2.impUnitName like concat('%', #{keyWord}, '%')
)
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[AND DATE_FORMAT( subquery2.createTime, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="impUnitName != null and impUnitName != ''">
and subquery2.impUnitName LIKE CONCAT('%', #{impUnitName}, '%')
</if>
GROUP BY mt.type_id,
subquery2.taskCode
</select>
@ -1612,7 +1624,8 @@
rpd.part_num as partNum,
COALESCE(IFNULL(rpd.part_num,0) * IFNULL(mpt1.buy_price,0),0) as partCost,
IFNULL(rpd.part_type,0) as partType,
COALESCE(su.nick_name, rpd.create_by) as createBy
COALESCE(su.nick_name, rpd.create_by) as createBy,
sd.dept_name as impUnitName
from
repair_part_details rpd
left join tm_task tt on rpd.task_id = tt.task_id
@ -1620,6 +1633,7 @@
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
left join bm_unit bu on bu.unit_id = bai.unit_id
left join bm_project bp on bp.pro_id = bai.project_id
left join sys_dept sd on sd.dept_id = bp.imp_unit
left join ma_type mt1 on mt1.type_id = rpd.type_id
left join ma_type mt2 on mt2.type_id = mt1.parent_id
left join ma_machine mm on mm.ma_id = rpd.ma_id and mt1.manage_type = 0
@ -1653,6 +1667,9 @@
<if test="projectId != null">
AND bp.pro_id = #{projectId}
</if>
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
order by rpd.create_time desc
</select>
<select id="getRepairNumByTaskId" resultType="com.bonus.material.repair.domain.vo.RepairDeviceVO">

View File

@ -52,6 +52,7 @@
<result property="leaseDays" column="lease_day"/>
<result property="markTime" column="mark_time"/>
<result property="leaseCost" column="lease_cost"/>
<result property="impUnitName" column="impUnit_name"/>
</resultMap>
<sql id="selectSltAgreementInfoVo">
@ -230,9 +231,11 @@
when saa.status = '1' then '1'
when saa.status = '2' then '2'
when saa.status = '3' then '3'
end as sltStatus
end as sltStatus,
sd.dept_name AS impUnitName
FROM bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id and saa.settlement_type = #{settlementType}
WHERE bai.status = '1' AND bui.type_id != '1731'
@ -631,9 +634,11 @@
saa.id as id, bai.agreement_id as agreementId, bai.agreement_code as agreementCode, saa.settlement_type as settlementType,
bui.unit_id as unitId,bui.unit_name as unitName, bp.pro_id as projectId , bp.pro_name as projectName,
saa.remark,bai.protocol,saa.cost as costs,su.nick_name as auditor,saa.audit_time as auditTime,
case when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus
case when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus,
sd.dept_name AS impUnitName
FROM bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
LEFT JOIN sys_user su ON saa.auditor = su.user_id and su.del_flag = 0
@ -862,10 +867,12 @@
SUM(IF(sad.slt_type = '2',sad.money,0)) AS loseCost,
SUM(IF(sad.slt_type = '3' AND sad.is_charge = '1',sad.money,0)) AS repairCost,
SUM(IF(sad.slt_type = '4' AND sad.is_charge = '1',sad.money,0)) AS scrapCost,
case when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus
case when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus,
sd.dept_name AS impUnitName
FROM
bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
<if test="settlementType != null">
@ -907,6 +914,9 @@
</when>
</choose>
</if>
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
</if>
GROUP BY bai.agreement_id, saa.settlement_type
ORDER BY saa.create_time desc
</select>
@ -933,10 +943,12 @@
CASE
WHEN bp.actual_end_date is not null THEN '1'
ELSE '0'
END as isFinish
END as isFinish,
sd.dept_name AS impUnitName
FROM bm_agreement_info bai
INNER JOIN bm_unit bui ON bui.unit_id = bai.unit_id AND bui.type_id != '1731'
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN slt_agreement_apply saa ON saa.agreement_id = bai.agreement_id AND (saa.status IS NULL OR saa.status != '2')
WHERE bai.status = '1'
AND (bai.is_slt = '0' OR bai.is_slt IS NULL)
@ -1083,12 +1095,14 @@
case rc.part_type when '0' then '不收费' when '1' then '收费' else '' end as partType,
case rc.repair_type when '1' then '内部维修' when '2' then '返厂维修' else '' end as repairType,
rc.company_id as companyId,
case rc.status when '0' then '未审核' when '1' then '已审核' when '2' then '已驳回' else '' end as repairStatus
case rc.status when '0' then '未审核' when '1' then '已审核' when '2' then '已驳回' else '' end as repairStatus,
sd.dept_name AS impUnitName
from repair_cost rc
left join tm_task_agreement tta on rc.task_id = tta.task_id
left join tm_task tt on rc.task_id = tt.task_id
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
left join bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
left join bm_unit bui ON bui.unit_id = bai.unit_id
left join ma_type mt on rc.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
@ -1111,6 +1125,9 @@
<if test="info.agreementCode != null and info.agreementCode != ''">
and bai.agreement_code like concat('%',#{info.agreementCode},'%')
</if>
<if test="info.impUnitName != null and info.impUnitName != ''">
AND sd.dept_name = #{info.impUnitName}
</if>
</select>
<select id="getRepairDetailsListBatchExport" resultType="com.bonus.material.settlement.domain.vo.SltAgreementInfoRepair">
@ -1172,12 +1189,14 @@
case rc.part_type when '0' then '不收费' when '1' then '收费' else '' end as partType,
case rc.repair_type when '1' then '内部维修' when '2' then '返厂维修' when '3' then '其他维修' else '' end as repairType,
rc.company_id as companyId,
case rc.status when '0' then '未审核' when '1' then '已审核' when '2' then '已驳回' else '' end as repairStatus
case rc.status when '0' then '未审核' when '1' then '已审核' when '2' then '已驳回' else '' end as repairStatus,
sd.dept_name AS impUnitName
from repair_cost rc
LEFT JOIN tm_task_agreement tta on rc.task_id = tta.task_id
LEFT JOIN tm_task tt on rc.task_id = tt.task_id
LEFT JOIN bm_agreement_info bai on tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt on rc.type_id = mt.type_id
LEFT JOIN ma_type mt1 on mt.parent_id = mt1.type_id
@ -1200,6 +1219,9 @@
<if test="info.agreementCode != null and info.agreementCode != ''">
and bai.agreement_code like concat('%',#{info.agreementCode},'%')
</if>
<if test="info.impUnitName != null and info.impUnitName != ''">
AND sd.dept_name = #{info.impUnitName}
</if>
</select>
<select id="getScrapDetailsListBatchExport" resultType="com.bonus.material.settlement.domain.vo.SltAgreementInfoScrap">
@ -1299,7 +1321,8 @@
res.startTime,
res.endTime,
res.leaseDays,
res. loseCost
res. loseCost,
res.impUnitName
FROM (SELECT bai.agreement_id AS agreementId,
bai.agreement_code as agreementCode,
ifnull(sad.unit_name ,bui.unit_name) as unitName,
@ -1315,13 +1338,15 @@
DATE (sad.start_time) as startTime,
DATE(ifnull(saa.create_time, sad.end_time)) as endTime,
DATEDIFF(
IF(sad.end_time is null, saa.create_time,sad.end_time), sad.start_time) + 1 as leaseDays
IF(sad.end_time is null, saa.create_time,sad.end_time), sad.start_time) + 1 as leaseDays,
sd.dept_name AS impUnitName
FROM
bm_agreement_info bai
LEFT JOIN slt_agreement_apply saa
ON bai.agreement_id = saa.agreement_id AND saa.settlement_type = #{settlementType}
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id AND sad.slt_type = '2'
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
left join ma_type mt on sad.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
@ -1336,6 +1361,9 @@
<if test="agreementCode != null and agreementCode != ''">
and bai.agreement_code like concat('%',#{agreementCode},'%')
</if>
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
</if>
</where>
) res
@ -1447,11 +1475,13 @@
sai.is_slt AS is_settled,
sai.slt_time AS settlement_time, sai.status,
mt.unit_name as mt_unit_name, mt.comsumable,
bai.remark
bai.remark,
sd.dept_name AS impUnit_name
FROM bm_agreement_info bai
INNER JOIN slt_agreement_info sai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id AND mt.`level` = '4'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.`level` = '3'
<where>
@ -1598,12 +1628,14 @@
mt1.type_name as type_name,
sai.ma_id, sai.num, sai.price as lease_price, sai.start_time, IFNULL(sai.end_time,saa.create_time) as end_time,
mt.unit_name as mt_unit_name, mt.comsumable,
bai.remark
bai.remark,
sd.dept_name AS impUnit_name
FROM bm_agreement_info bai
LEFT JOIN slt_agreement_apply saa on bai.agreement_id = saa.agreement_id
LEFT JOIN slt_agreement_details sai ON saa.ID = sai.apply_id
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id AND mt.`level` = '4'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.`level` = '3'
<where>