2025-02-18 18:58:20 +08:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
|
<mapper namespace="com.bonus.material.ma.mapper.DirectRotationMapper">
|
|
|
|
|
|
<update id="updateDirectApplyInfo">
|
|
|
|
|
|
update direct_apply_info
|
|
|
|
|
|
set
|
|
|
|
|
|
<if test="backAgreementId != null">
|
|
|
|
|
|
back_agreement_id = #{backAgreementId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backMan != null">
|
|
|
|
|
|
back_man = #{backMan},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backPhone != null">
|
|
|
|
|
|
back_phone = #{backPhone},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="leaseAgreementId != null">
|
|
|
|
|
|
lease_agreement_id = #{leaseAgreementId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="leaseMan != null">
|
|
|
|
|
|
lease_man = #{leaseMan},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="leasePhone != null">
|
|
|
|
|
|
lease_phone = #{leasePhone},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="dirUrl != null">
|
|
|
|
|
|
dir_url = #{dirUrl},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
|
status = #{status},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="auditor != null">
|
|
|
|
|
|
auditor = #{auditor},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="auditTime != null">
|
|
|
|
|
|
audit_time = #{auditTime},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
update_time= NOW()
|
|
|
|
|
|
where id = #{id}
|
|
|
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteDirectApplyDetails">
|
|
|
|
|
|
delete
|
|
|
|
|
|
from direct_apply_details
|
|
|
|
|
|
where direct_id = #{id}
|
|
|
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteDirectApply">
|
|
|
|
|
|
delete
|
|
|
|
|
|
from direct_apply_info
|
|
|
|
|
|
where id = #{id};
|
|
|
|
|
|
delete
|
|
|
|
|
|
from direct_apply_details
|
|
|
|
|
|
where direct_id = #{id}
|
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getUseringData" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
mt2.type_name AS typeName,
|
|
|
|
|
|
mt.type_name AS typeModelName,
|
|
|
|
|
|
mt.unit_name as unitName,
|
|
|
|
|
|
sum( sai.num ) AS useNum ,
|
|
|
|
|
|
mm.ma_code AS maCode,
|
|
|
|
|
|
lai.lease_person as leasePerson,
|
|
|
|
|
|
DATE(sai.start_time) as startTime,
|
2025-10-10 21:39:19 +08:00
|
|
|
|
mm.next_check_time as nextCheckTime,
|
2025-02-18 18:58:20 +08:00
|
|
|
|
sai.ma_id as maId,
|
|
|
|
|
|
sai.type_id as typeId,
|
2025-10-16 18:47:21 +08:00
|
|
|
|
sai.agreement_id as agreementId,
|
2025-02-20 20:40:53 +08:00
|
|
|
|
lai.create_time as createTime,
|
2025-09-24 16:15:16 +08:00
|
|
|
|
mt.unit_value as unitValue,
|
2025-02-18 18:58:20 +08:00
|
|
|
|
sai.*
|
|
|
|
|
|
FROM
|
|
|
|
|
|
slt_agreement_info sai
|
|
|
|
|
|
LEFT JOIN ma_type mt on sai.type_id = mt.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
|
|
|
|
|
LEFT JOIN ma_machine mm on sai.ma_id = mm.ma_id
|
|
|
|
|
|
LEFT JOIN lease_apply_info lai on lai.id=sai.lease_id
|
|
|
|
|
|
where sai.agreement_id = #{agreementId} and sai.status = '0'
|
|
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
|
and sai.type_id = #{typeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="maId != null">
|
|
|
|
|
|
and mt.parent_id = #{maId}
|
|
|
|
|
|
</if>
|
2025-02-20 20:40:53 +08:00
|
|
|
|
<if test="startDate != null and endDate != ''">
|
|
|
|
|
|
AND DATE_FORMAT(lai.create_time, '%Y-%m-%d' ) BETWEEN #{startDate} AND #{endDate}
|
|
|
|
|
|
</if>
|
2025-02-18 18:58:20 +08:00
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
|
and (mt2.type_name like concat('%', #{keyWord}, '%') or
|
2025-02-20 20:40:53 +08:00
|
|
|
|
mt.type_name like concat('%', #{keyWord}, '%') or
|
2025-10-13 18:31:45 +08:00
|
|
|
|
mm.ma_code like concat('%', #{keyWord}, '%')
|
2025-02-20 20:40:53 +08:00
|
|
|
|
)
|
2025-02-18 18:58:20 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
sai.ma_id,sai.type_id
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-06-17 17:55:47 +08:00
|
|
|
|
<select id="getList" resultType="com.bonus.material.ma.domain.DirectApplyExportInfo">
|
2025-03-19 11:28:52 +08:00
|
|
|
|
SELECT * FROM (
|
|
|
|
|
|
SELECT DISTINCT
|
2025-03-19 13:48:06 +08:00
|
|
|
|
dai.id AS id,
|
2025-03-19 11:28:52 +08:00
|
|
|
|
dai.create_time AS createTime,
|
2025-09-25 12:07:43 +08:00
|
|
|
|
su.nick_name AS createName,
|
2025-03-19 11:28:52 +08:00
|
|
|
|
bui.unit_id AS backUnitId,
|
|
|
|
|
|
bui.unit_name AS backUnitName,
|
|
|
|
|
|
bpl.pro_id AS backProId,
|
|
|
|
|
|
bpl.pro_name AS backProName,
|
|
|
|
|
|
bui1.unit_id AS leaseUnitId,
|
|
|
|
|
|
bui1.unit_name AS leaseUnitName,
|
|
|
|
|
|
bpl1.pro_id AS leaseProId,
|
|
|
|
|
|
bpl1.pro_name AS leaseProName,
|
|
|
|
|
|
GROUP_CONCAT(DISTINCT mt2.type_name) as typeName,
|
2025-12-03 16:08:23 +08:00
|
|
|
|
IFNULL(swr.workflow_status,2) as status,
|
|
|
|
|
|
dai.business_code as businessCode
|
2025-03-19 11:28:52 +08:00
|
|
|
|
FROM
|
|
|
|
|
|
direct_apply_info dai
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bai ON dai.back_agreement_id = bai.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bai1 ON dai.lease_agreement_id = bai1.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_project bpl ON bpl.pro_id = bai.project_id
|
|
|
|
|
|
LEFT JOIN bm_project bpl1 ON bpl1.pro_id = bai1.project_id
|
|
|
|
|
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
|
|
|
|
|
LEFT JOIN bm_unit bui1 ON bui1.unit_id = bai1.unit_id
|
|
|
|
|
|
LEFT JOIN direct_apply_details dad on dad.direct_id=dai.id
|
|
|
|
|
|
LEFT JOIN ma_type mt1 on mt1.type_id=dad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 on mt2.type_id=mt1.parent_id
|
|
|
|
|
|
left join sys_user su on dai.create_by = su.user_id
|
|
|
|
|
|
left join sys_workflow_record swr on swr.task_id = dai.id
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="lotId != null and lotId != ''">
|
|
|
|
|
|
and bpl.pro_id = #{lotId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="unitId != null and unitId != ''">
|
|
|
|
|
|
and bui.unit_id = #{unitId}
|
|
|
|
|
|
</if>
|
2025-12-29 17:41:53 +08:00
|
|
|
|
<if test="auditProId != null and auditProId != ''">
|
|
|
|
|
|
and (bpl.pro_id = #{auditProId} OR bpl1.pro_id = #{auditProId})
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="auditUnitId != null and auditUnitId != ''">
|
|
|
|
|
|
and (bui.unit_id = #{auditUnitId} OR bui1.unit_id = #{auditUnitId})
|
|
|
|
|
|
</if>
|
2025-03-19 11:28:52 +08:00
|
|
|
|
<if test="status != null and status != ''">
|
2025-06-15 17:19:31 +08:00
|
|
|
|
and swr.workflow_status = #{status}
|
2025-03-19 11:28:52 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="isApp != null and taskStatus==0">and dai.status = 0 </if>
|
|
|
|
|
|
<if test="isApp != null and taskStatus==1">and (dai.status = 1 or dai.status = 2)</if>
|
2025-03-24 10:22:00 +08:00
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
|
AND DATE_FORMAT( dai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
|
|
|
|
|
|
</if>
|
2025-03-19 11:28:52 +08:00
|
|
|
|
</where>
|
|
|
|
|
|
GROUP BY dai.id
|
|
|
|
|
|
order by dai.create_time desc
|
|
|
|
|
|
) a
|
2025-02-18 18:58:20 +08:00
|
|
|
|
<where>
|
2025-03-19 11:28:52 +08:00
|
|
|
|
<if test="keyWord!=null and keyWord!=''">
|
|
|
|
|
|
AND (
|
|
|
|
|
|
INSTR(a.typeName,#{keyWord}) > 0 OR
|
|
|
|
|
|
INSTR(a.backUnitName,#{keyWord}) > 0 OR
|
|
|
|
|
|
INSTR(a.backProName,#{keyWord}) > 0 OR
|
|
|
|
|
|
INSTR(a.leaseUnitName,#{keyWord}) > 0 OR
|
2025-12-03 16:08:23 +08:00
|
|
|
|
INSTR(a.leaseProName,#{keyWord}) > 0 OR
|
|
|
|
|
|
INSTR(a.businessCode,#{keyWord}) > 0
|
2025-03-19 11:28:52 +08:00
|
|
|
|
)
|
2025-02-18 18:58:20 +08:00
|
|
|
|
</if>
|
2025-03-19 11:28:52 +08:00
|
|
|
|
|
2025-02-18 18:58:20 +08:00
|
|
|
|
</where>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getInfoById" resultType="com.bonus.material.ma.domain.DirectApplyInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
dai.id,
|
|
|
|
|
|
dai.`code`,
|
|
|
|
|
|
bui.unit_id AS backUnitId,
|
|
|
|
|
|
bui.unit_name AS backUnitName,
|
|
|
|
|
|
bpl.pro_id AS backProId,
|
|
|
|
|
|
bpl.pro_name AS backProName,
|
|
|
|
|
|
dai.back_agreement_id AS backAgreementId,
|
|
|
|
|
|
bai.agreement_code AS backAgreementCode,
|
|
|
|
|
|
dai.back_man AS backMan,
|
|
|
|
|
|
dai.back_phone AS backPhone,
|
|
|
|
|
|
bui1.unit_id AS leaseUnitId,
|
|
|
|
|
|
bui1.unit_name AS leaseUnitName,
|
|
|
|
|
|
bpl1.pro_id AS leaseProId,
|
|
|
|
|
|
bpl1.pro_name AS leaseProName,
|
|
|
|
|
|
dai.lease_agreement_id AS leaseAgreementId,
|
|
|
|
|
|
bai1.agreement_code AS leaseAgreementCode,
|
|
|
|
|
|
dai.lease_man AS leaseMan,
|
|
|
|
|
|
dai.lease_phone AS leasePhone,
|
|
|
|
|
|
dai.dir_url AS dirUrl,
|
2025-10-30 18:33:15 +08:00
|
|
|
|
dai.`status`,
|
|
|
|
|
|
bpl.external_id AS backExternalId,
|
2025-12-03 16:08:23 +08:00
|
|
|
|
bpl1.external_id AS leaseExternalId,
|
|
|
|
|
|
dai.business_code AS businessCode
|
2025-02-18 18:58:20 +08:00
|
|
|
|
FROM
|
|
|
|
|
|
direct_apply_info dai
|
|
|
|
|
|
LEFT JOIN direct_apply_details dad ON dai.id = dad.direct_id
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bai ON dai.back_agreement_id = bai.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bai1 ON dai.lease_agreement_id = bai1.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_project bpl ON bpl.pro_id = bai.project_id
|
|
|
|
|
|
LEFT JOIN bm_project bpl1 ON bpl1.pro_id = bai1.project_id
|
|
|
|
|
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
|
|
|
|
|
LEFT JOIN bm_unit bui1 ON bui1.unit_id = bai1.unit_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
dai.id = #{id}
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
dai.id
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getDetailById" resultType="com.bonus.material.ma.domain.DirectApplyDetails">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
dad.direct_num AS directNum,
|
|
|
|
|
|
dad.type_id AS typeId,
|
|
|
|
|
|
mt2.type_name AS typeName,
|
|
|
|
|
|
mt.type_name AS typeModelName,
|
|
|
|
|
|
mt.unit_name AS unitName,
|
|
|
|
|
|
sum( sai.num ) AS useNum,
|
|
|
|
|
|
mm.ma_code AS maCode,
|
|
|
|
|
|
mm.ma_id AS maId,
|
|
|
|
|
|
lai.lease_person as leasePerson,
|
2025-03-25 18:19:14 +08:00
|
|
|
|
DATE(sai.start_time) as startTime,
|
|
|
|
|
|
mt.manage_type as manageType,
|
|
|
|
|
|
dai.back_agreement_id as backAgreementId,
|
|
|
|
|
|
dai.lease_agreement_id as leaseAgreementId
|
2025-02-18 18:58:20 +08:00
|
|
|
|
FROM
|
|
|
|
|
|
direct_apply_info dai
|
|
|
|
|
|
LEFT JOIN direct_apply_details dad ON dai.id = dad.direct_id
|
2025-10-20 18:32:21 +08:00
|
|
|
|
LEFT JOIN slt_agreement_info sai ON dai.back_agreement_id = sai.agreement_id and sai.status =0
|
2025-09-25 16:56:20 +08:00
|
|
|
|
AND sai.type_id = dad.type_id and IFNULL(dad.ma_id,0)=IFNULL(sai.ma_id,0)
|
2025-02-18 18:58:20 +08:00
|
|
|
|
LEFT JOIN lease_apply_info lai on lai.id=sai.lease_id
|
|
|
|
|
|
LEFT JOIN ma_type mt ON mt.type_id = dad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
|
|
|
|
|
LEFT JOIN ma_machine mm ON dad.ma_id = mm.ma_id
|
|
|
|
|
|
WHERE
|
2025-09-24 17:54:39 +08:00
|
|
|
|
dai.id = #{id}
|
2025-02-18 18:58:20 +08:00
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
|
and sai.type_id = #{typeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="maId != null">
|
|
|
|
|
|
and mt.parent_id = #{maId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
|
and (mt2.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
|
mt.type_name like concat('%', #{keyWord}, '%'))
|
|
|
|
|
|
</if>
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
dad.id,
|
|
|
|
|
|
sai.type_id
|
|
|
|
|
|
</select>
|
2025-09-25 13:23:07 +08:00
|
|
|
|
|
2025-02-18 18:58:20 +08:00
|
|
|
|
<select id="getTypeNameList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
|
|
|
|
|
SELECT mt2.type_name AS typeName,
|
|
|
|
|
|
mt.type_name AS typeModelName,
|
|
|
|
|
|
mt.unit_name as unitName,
|
|
|
|
|
|
sum(sai.num) AS useNum,
|
|
|
|
|
|
mm.ma_code AS maCode,
|
|
|
|
|
|
lai.lease_person as leasePerson, DATE (sai.start_time) as startTime, sai.ma_id as maId, sai.type_id as typeId, mt.parent_id as parentId, sai.*
|
|
|
|
|
|
FROM
|
|
|
|
|
|
slt_agreement_info sai
|
|
|
|
|
|
LEFT JOIN ma_type mt
|
|
|
|
|
|
on sai.type_id = mt.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
|
|
|
|
|
LEFT JOIN ma_machine mm on sai.ma_id = mm.ma_id
|
|
|
|
|
|
LEFT JOIN lease_apply_info lai on lai.id=sai.lease_id
|
|
|
|
|
|
where sai.agreement_id = #{agreementId} and sai.status = '0'
|
|
|
|
|
|
<if test="parentId != null">
|
|
|
|
|
|
and mt.parent_id=#{parentId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
|
and sai.type_id=#{typeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="type != null and type==1">
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
mt.parent_id
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="type != null and type==2">
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
sai.ma_id,sai.type_id
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
</select>
|
2025-03-25 18:19:14 +08:00
|
|
|
|
<select id="selectDetails" resultType="com.bonus.material.ma.domain.DirectApplyDetails">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
dad.type_id AS typeId,
|
|
|
|
|
|
mt2.type_name AS typeName,
|
|
|
|
|
|
mt.type_name AS typeModelName,
|
|
|
|
|
|
mt.unit_name AS unitName,
|
|
|
|
|
|
mt.manage_type AS manageType,
|
|
|
|
|
|
SUM( dad.direct_num ) AS directNum
|
|
|
|
|
|
FROM
|
|
|
|
|
|
direct_apply_info dai
|
|
|
|
|
|
LEFT JOIN direct_apply_details dad ON dai.id = dad.direct_id
|
|
|
|
|
|
LEFT JOIN ma_type mt ON mt.type_id = dad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
dai.id = #{id}
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
dad.type_id
|
|
|
|
|
|
</select>
|
2025-10-10 21:39:19 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getprojectId" resultType="java.lang.Integer">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
project_id
|
|
|
|
|
|
FROM
|
|
|
|
|
|
bm_agreement_info
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
agreement_id = #{agreementId}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getUseringDataByClz" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
mt2.type_name AS typeName,
|
|
|
|
|
|
mt.type_name AS typeModelName,
|
|
|
|
|
|
mt.unit_name as unitName,
|
|
|
|
|
|
ifnull(sum( sai.num ) ,0 ) AS useNum,
|
|
|
|
|
|
mm.ma_code AS maCode,
|
|
|
|
|
|
lai.lease_person as leasePerson,
|
|
|
|
|
|
DATE(sai.start_time) as startTime,
|
|
|
|
|
|
sai.ma_id as maId,
|
|
|
|
|
|
sai.type_id as typeId,
|
|
|
|
|
|
lai.create_time as createTime,
|
|
|
|
|
|
mt.unit_value as unitValue,
|
|
|
|
|
|
sai.*
|
|
|
|
|
|
FROM
|
|
|
|
|
|
clz_slt_agreement_info sai
|
|
|
|
|
|
LEFT JOIN ma_type mt on sai.type_id = mt.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
|
|
|
|
|
LEFT JOIN ma_machine mm on sai.ma_id = mm.ma_id
|
|
|
|
|
|
LEFT JOIN clz_lease_apply_info lai on lai.id=sai.lease_id
|
|
|
|
|
|
left join clz_bm_agreement_info col on col.agreement_id=sai.agreement_id
|
|
|
|
|
|
left join bm_project pro on pro.pro_id=col.project_id
|
|
|
|
|
|
where pro.pro_id = #{projectId} and sai.status = '0'
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
sai.ma_id,sai.type_id
|
|
|
|
|
|
</select>
|
2025-10-11 11:25:06 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getApproveList" resultType="com.bonus.common.biz.domain.lease.LeaseOutSign">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
su.sign_type as outSignType,
|
|
|
|
|
|
su.sign_url as outSignUrl
|
|
|
|
|
|
FROM
|
|
|
|
|
|
sys_workflow_record_history swh
|
|
|
|
|
|
LEFT JOIN sys_workflow_record swr ON swh.record_id = swr.id
|
|
|
|
|
|
LEFT JOIN sys_user su ON swh.create_by = su.user_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
swr.task_id = #{id}
|
|
|
|
|
|
</select>
|
2025-10-13 21:31:42 +08:00
|
|
|
|
<select id="getSignatureList" resultType="com.bonus.material.clz.domain.direct.ClzDirectApplyInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
swh.node_id AS nodeId,
|
|
|
|
|
|
su.sign_type AS outSignType,
|
|
|
|
|
|
su.sign_url AS outSignUrl,
|
|
|
|
|
|
swn.type_id as typeId,
|
|
|
|
|
|
swn.node_sort as nodeSort
|
|
|
|
|
|
FROM
|
|
|
|
|
|
sys_workflow_record_history swh
|
|
|
|
|
|
LEFT JOIN sys_workflow_record swr ON swh.record_id = swr.id
|
|
|
|
|
|
LEFT JOIN sys_user su ON swh.create_by = su.user_id
|
|
|
|
|
|
LEFT JOIN sys_workflow_node swn on swn.id=swh.node_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
swr.task_id = #{id}
|
|
|
|
|
|
ORDER BY swh.create_time ASC
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getSignById" resultType="com.bonus.material.clz.domain.direct.ClzDirectApplyInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
swr.id,
|
|
|
|
|
|
su.sign_type AS outSignType,
|
|
|
|
|
|
su.sign_url AS outSignUrl
|
|
|
|
|
|
FROM
|
|
|
|
|
|
direct_apply_info dai
|
|
|
|
|
|
LEFT JOIN sys_workflow_record swr on swr.task_id=dai.id
|
|
|
|
|
|
LEFT JOIN sys_user su on su.user_id=dai.create_by
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
dai.id=#{id}
|
|
|
|
|
|
</select>
|
2025-10-16 18:47:21 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
da.id AS id,
|
|
|
|
|
|
SUM(IFNULL(dad.direct_num, 0)) AS waitTransNum
|
|
|
|
|
|
FROM
|
|
|
|
|
|
direct_apply_info da
|
|
|
|
|
|
LEFT JOIN direct_apply_details dad ON da.id = dad.direct_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
da.`status` = '0'
|
|
|
|
|
|
AND da.id IN (SELECT task_id FROM sys_workflow_record)
|
|
|
|
|
|
AND da.back_agreement_id = #{agreementId}
|
|
|
|
|
|
AND dad.type_id = #{typeId}
|
|
|
|
|
|
<if test="maId != null">
|
|
|
|
|
|
AND dad.ma_id = #{maId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
da.id
|
|
|
|
|
|
HAVING
|
|
|
|
|
|
waitTransNum > 0
|
|
|
|
|
|
</select>
|
2025-10-18 22:02:43 +08:00
|
|
|
|
<select id="getBatchInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
da.back_agreement_id AS agreementId,
|
|
|
|
|
|
dad.type_id AS typeId,
|
|
|
|
|
|
dad.ma_id AS maId,
|
|
|
|
|
|
da.id AS id,
|
|
|
|
|
|
SUM(IFNULL(dad.direct_num, 0)) AS waitTransNum -- 待转数量
|
|
|
|
|
|
FROM
|
|
|
|
|
|
direct_apply_info da
|
|
|
|
|
|
INNER JOIN direct_apply_details dad ON da.id = dad.direct_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
da.`status` = '0'
|
|
|
|
|
|
AND EXISTS (
|
|
|
|
|
|
SELECT 1 FROM sys_workflow_record swr
|
|
|
|
|
|
WHERE swr.task_id = da.id
|
|
|
|
|
|
)
|
|
|
|
|
|
AND da.back_agreement_id = #{agreementId}
|
|
|
|
|
|
AND (
|
|
|
|
|
|
<foreach collection="pairs" item="pair" separator="OR">
|
|
|
|
|
|
(dad.type_id = #{pair.typeId}
|
|
|
|
|
|
<if test="pair.maId != null">AND dad.ma_id = #{pair.maId}</if>
|
|
|
|
|
|
<if test="pair.maId == null">AND dad.ma_id IS NULL</if>)
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
)
|
|
|
|
|
|
AND IFNULL(dad.direct_num, 0) > 0 -- 提前过滤0值,减少计算
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
da.back_agreement_id, dad.type_id, dad.ma_id, da.id;
|
|
|
|
|
|
</select>
|
2025-10-30 18:33:15 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getDeptInfo" resultType="com.bonus.material.ma.domain.DirectApplyInfo">
|
|
|
|
|
|
SELECT DISTINCT
|
|
|
|
|
|
df.project_dept AS leaseDepartName,
|
|
|
|
|
|
sd.dept_name AS leaseImpUnitName
|
|
|
|
|
|
FROM
|
|
|
|
|
|
bm_project bp
|
|
|
|
|
|
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
|
|
|
|
|
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
bp.pro_center IS NOT NULL
|
|
|
|
|
|
AND bp.external_id IS NOT NULL
|
|
|
|
|
|
AND bp.pro_id NOT IN ( 3414, 1192, 3321, 3595 )
|
|
|
|
|
|
AND bp.external_id = #{leaseExternalId}
|
|
|
|
|
|
AND bp.del_flag = '0'
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
bp.pro_name
|
|
|
|
|
|
LIMIT 1
|
|
|
|
|
|
</select>
|
2025-11-24 17:03:33 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getTeam" resultType="com.bonus.material.basic.domain.BmUnit">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
bai.unit_id as unitId,
|
|
|
|
|
|
bu.type_id as typeId
|
|
|
|
|
|
FROM
|
|
|
|
|
|
bm_agreement_info bai
|
|
|
|
|
|
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
agreement_id = #{agreementId}
|
|
|
|
|
|
</select>
|
2025-12-03 16:08:23 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getCodeList" resultType="com.bonus.material.ma.domain.DirectApplyInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
lai.`code` as businessCode
|
|
|
|
|
|
FROM
|
|
|
|
|
|
lease_apply_info lai
|
|
|
|
|
|
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
tt.task_type = 19
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
lai.`code`
|
|
|
|
|
|
ORDER BY
|
|
|
|
|
|
lai.create_time DESC
|
|
|
|
|
|
</select>
|
2026-01-12 11:20:58 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getXmList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
id AS id,
|
|
|
|
|
|
agreement_id AS agreementId,
|
|
|
|
|
|
type_id AS typeId,
|
|
|
|
|
|
ma_id AS maId,
|
|
|
|
|
|
num AS backNum,
|
|
|
|
|
|
start_time AS startTime,
|
|
|
|
|
|
end_time AS endTime,
|
|
|
|
|
|
status AS status,
|
|
|
|
|
|
lease_id AS leaseId,
|
|
|
|
|
|
lease_type AS leaseType,
|
|
|
|
|
|
back_id AS backId,
|
|
|
|
|
|
lease_price AS leasePrice,
|
|
|
|
|
|
buy_price AS buyPrice,
|
|
|
|
|
|
company_id AS companyId
|
|
|
|
|
|
FROM
|
|
|
|
|
|
slt_agreement_info
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
status = 0
|
|
|
|
|
|
AND source = '1'
|
|
|
|
|
|
AND type_id = #{typeId}
|
|
|
|
|
|
AND agreement_id = #{agreementId}
|
|
|
|
|
|
<if test="maId != null">
|
|
|
|
|
|
AND ma_id = #{maId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
order by start_time asc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getClzList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
id AS id,
|
|
|
|
|
|
agreement_id AS agreementId,
|
|
|
|
|
|
type_id AS typeId,
|
|
|
|
|
|
ma_id AS maId,
|
|
|
|
|
|
num AS backNum,
|
|
|
|
|
|
start_time AS startTime,
|
|
|
|
|
|
end_time AS endTime,
|
|
|
|
|
|
status AS status,
|
|
|
|
|
|
lease_id AS leaseId,
|
|
|
|
|
|
lease_type AS leaseType,
|
|
|
|
|
|
back_id AS backId,
|
|
|
|
|
|
lease_price AS leasePrice,
|
|
|
|
|
|
buy_price AS buyPrice,
|
|
|
|
|
|
company_id AS companyId
|
|
|
|
|
|
FROM
|
|
|
|
|
|
clz_slt_agreement_info
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
status = 0
|
|
|
|
|
|
AND source = '2'
|
|
|
|
|
|
AND type_id = #{typeId}
|
|
|
|
|
|
AND agreement_id = #{agreementId}
|
|
|
|
|
|
<if test="maId != null">
|
|
|
|
|
|
AND ma_id = #{maId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
order by start_time asc
|
|
|
|
|
|
</select>
|
2025-03-18 18:20:27 +08:00
|
|
|
|
</mapper>
|