2024-09-27 15:26:57 +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.lease.mapper.LeaseApplyInfoMapper" >
2024-12-11 14:57:08 +08:00
<resultMap type= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" id= "LeaseApplyInfoResult" >
2024-09-27 15:26:57 +08:00
<result property= "id" column= "id" />
<result property= "code" column= "code" />
<result property= "taskId" column= "task_id" />
<result property= "leasePerson" column= "lease_person" />
<result property= "phone" column= "phone" />
<result property= "type" column= "type" />
<result property= "companyAuditBy" column= "company_audit_by" />
<result property= "companyAuditTime" column= "company_audit_time" />
<result property= "companyAuditRemark" column= "company_audit_remark" />
<result property= "deptAuditBy" column= "dept_audit_by" />
<result property= "deptAuditTime" column= "dept_audit_time" />
<result property= "deptAuditRemark" column= "dept_audit_remark" />
<result property= "directAuditBy" column= "direct_audit_by" />
<result property= "directAuditTime" column= "direct_audit_time" />
<result property= "directAuditRemark" column= "direct_audit_remark" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
<result property= "remark" column= "remark" />
2025-07-26 13:27:16 +08:00
<result property= "cno" column= "cno" />
2024-09-27 15:26:57 +08:00
<result property= "companyId" column= "company_id" />
<result property= "directId" column= "direct_id" />
<result property= "leaseType" column= "lease_type" />
<result property= "estimateLeaseTime" column= "estimate_lease_time" />
<result property= "costBearingParty" column= "cost_bearing_party" />
2024-11-13 10:15:03 +08:00
<result property= "leaseProject" column= "pro_name" />
2024-11-13 11:16:25 +08:00
<result property= "leaseProjectId" column= "project_id" />
2024-11-13 10:15:03 +08:00
<result property= "leaseUnit" column= "unit_name" />
2024-11-13 11:16:25 +08:00
<result property= "leaseUnitId" column= "unit_id" />
2024-11-13 10:15:03 +08:00
<result property= "agreementCode" column= "agreement_code" />
2025-01-09 11:13:03 +08:00
<result property= "leaseSignUrl" column= "lease_sign_url" />
<result property= "leaseSignType" column= "lease_sign_type" />
2025-06-19 16:17:08 +08:00
<result property= "materialMan" column= "material_man" />
<result property= "confirmTime" column= "confirm_time" />
<result property= "isConfirm" column= "is_confirm" />
<result property= "confirmRemark" column= "confirm_remark" />
2024-09-27 15:26:57 +08:00
</resultMap>
<sql id= "selectLeaseApplyInfoVo" >
2024-11-13 10:15:03 +08:00
select
lai.id, lai.code, lai.task_id, lai.lease_person, lai.phone, lai.type, lai.company_audit_by,
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id,
2025-08-21 20:04:14 +08:00
lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party,
2025-06-19 16:17:08 +08:00
lai.material_man, lai.confirm_time, lai.is_confirm, lai.confirm_remark,
2025-07-09 14:14:31 +08:00
bai.unit_id,bai.project_id,bu.unit_name, bp.pro_name, bai.agreement_code, tt.task_status as taskStatus,
2024-12-23 14:06:52 +08:00
sda.dict_label as taskStatusName,
2024-11-14 13:47:12 +08:00
IFNULL(sum(lad.pre_num),0) as preCountNum,
2024-12-27 18:35:02 +08:00
IFNULL(sum(lad.al_num),0) as alNum,
2025-06-21 11:00:18 +08:00
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
2025-01-08 13:33:45 +08:00
bp.contract_part as contractPart,
2025-06-21 21:04:32 +08:00
sd.dept_name as impUnitName,
2025-07-16 18:49:44 +08:00
tt.task_type as taskType,
2025-07-25 18:37:34 +08:00
COALESCE(lai.release_time, lai.create_time) as releaseTime,
2025-07-25 14:14:19 +08:00
GROUP_CONCAT(DISTINCT mt3.type_id) as firstId,
su.sign_type as lease_sign_type,
su.sign_url as lease_sign_url
2024-11-13 10:15:03 +08:00
from
lease_apply_info lai
2024-11-14 09:57:49 +08:00
left join tm_task tt on lai.task_id = tt.task_id
left join lease_apply_details lad on lai.id = lad.parent_id
left join tm_task_agreement tta on lai.task_id = tta.task_id
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
2025-01-08 13:33:45 +08:00
left join sys_dept sd on sd.dept_id = bp.imp_unit
2024-12-23 14:06:52 +08:00
left join sys_dict_data sda on tt.task_status = sda.dict_value
and sda.dict_type = 'lease_task_status'
2025-07-25 14:14:19 +08:00
left join sys_user su on lai.publisher = su.user_id
2024-12-27 18:35:02 +08:00
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'
2025-07-16 18:49:44 +08:00
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'
2024-12-27 18:35:02 +08:00
<if test= "userId != null" >
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId}
</if>
2024-09-27 15:26:57 +08:00
</sql>
2025-07-08 19:03:15 +08:00
<sql id= "selectLeaseApplyInfoVoTwo" >
select
2025-07-28 15:56:11 +08:00
lai.id, lai.code, lai.task_id, lai.lease_person as leasePerson, lai.phone, lai.type, lai.company_audit_by,
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
lai.create_by, lai.create_time as createTime, lai.update_by, lai.update_time, lai.remark, lai.company_id,
lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party, lai.lease_sign_url, lai.lease_sign_type,
lai.material_man, lai.confirm_time, lai.is_confirm, lai.confirm_remark,
bai.unit_id,bai.project_id,bu.unit_name as unitName, bp.pro_name as projectName,bp.external_id as externalId, bai.agreement_code as agreementCode, tt.task_status as taskStatus,
sda.dict_label as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(lod.num,0) as alNum,
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
bp.contract_part as contractPart,
sd.dept_name as impUnitName,
tt.task_type as taskType
2025-07-08 19:03:15 +08:00
from
2025-07-28 15:56:11 +08:00
lease_apply_info lai
2025-07-08 19:03:15 +08:00
left join tm_task tt on lai.task_id = tt.task_id
left join lease_apply_details lad on lai.id = lad.parent_id
2025-07-28 15:56:11 +08:00
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task, is_confirm, confirm_remark, confirm_time, lease_sign_id from lease_out_details
GROUP BY parent_id) lod ON lai.id = lod.parent_id
2025-07-08 19:03:15 +08:00
left join tm_task_agreement tta on lai.task_id = tta.task_id
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 sys_dict_data sda on tt.task_status = sda.dict_value
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'
</sql>
2024-12-11 14:57:08 +08:00
<select id= "selectLeaseApplyInfoList" parameterType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" resultMap= "LeaseApplyInfoResult" >
2024-09-27 15:26:57 +08:00
<include refid= "selectLeaseApplyInfoVo" />
2025-07-25 18:34:36 +08:00
<where >
2024-11-13 10:15:03 +08:00
<if test= "code != null and code != ''" > and lai.code = #{code}</if>
<if test= "taskId != null " > and lai.task_id = #{taskId}</if>
<if test= "leasePerson != null and leasePerson != ''" > and lai.lease_person = #{leasePerson}</if>
<if test= "phone != null and phone != ''" > and lai.phone = #{phone}</if>
<if test= "type != null and type != ''" > and lai.type = #{type}</if>
<if test= "companyAuditBy != null " > and lai.company_audit_by = #{companyAuditBy}</if>
<if test= "companyAuditTime != null " > and lai.company_audit_time = #{companyAuditTime}</if>
<if test= "companyAuditRemark != null and companyAuditRemark != ''" > and lai.company_audit_remark = #{companyAuditRemark}</if>
<if test= "deptAuditBy != null " > and lai.dept_audit_by = #{deptAuditBy}</if>
<if test= "deptAuditTime != null " > and lai.dept_audit_time = #{deptAuditTime}</if>
<if test= "deptAuditRemark != null and deptAuditRemark != ''" > and lai.dept_audit_remark = #{deptAuditRemark}</if>
<if test= "directAuditBy != null " > and lai.direct_audit_by = #{directAuditBy}</if>
<if test= "directAuditTime != null " > and lai.direct_audit_time = #{directAuditTime}</if>
<if test= "directAuditRemark != null and directAuditRemark != ''" > and lai.direct_audit_remark = #{directAuditRemark}</if>
<if test= "companyId != null " > and lai.company_id = #{companyId}</if>
2025-08-23 19:22:18 +08:00
<!-- <if test="statusList != null and statusList.size() > 0">
2024-11-14 11:28:27 +08:00
and tt.task_status in
<foreach item= "item" collection= "statusList" open= "(" separator= "," close= ")" >
#{item}
</foreach>
2025-08-23 19:22:18 +08:00
</if> -->
2024-11-19 13:24:35 +08:00
<if test= "startTime != null and startTime != '' and endTime != null and endTime != ''" >
2025-07-25 18:37:34 +08:00
and COALESCE(lai.release_time, lai.create_time) BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
2024-11-19 13:24:35 +08:00
</if>
2024-11-13 10:15:03 +08:00
<if test= "directId != null " > and lai.direct_id = #{directId}</if>
<if test= "leaseType != null and leaseType != ''" > and lai.lease_type = #{leaseType}</if>
<if test= "estimateLeaseTime != null " > and lai.estimate_lease_time = #{estimateLeaseTime}</if>
<if test= "costBearingParty != null and costBearingParty != ''" > and lai.cost_bearing_party = #{costBearingParty}</if>
2025-07-25 18:37:34 +08:00
and tt.task_type = '2'
2024-09-27 15:26:57 +08:00
</where>
2024-11-14 13:47:12 +08:00
GROUP BY lai.id
ORDER BY tt.task_status,tt.create_time desc
2024-09-27 15:26:57 +08:00
</select>
2025-07-25 18:34:36 +08:00
2024-09-27 15:26:57 +08:00
<select id= "selectLeaseApplyInfoById" parameterType= "Long" resultMap= "LeaseApplyInfoResult" >
<include refid= "selectLeaseApplyInfoVo" />
2024-11-13 10:15:03 +08:00
where lai.id = #{id}
2024-09-27 15:26:57 +08:00
</select>
2025-07-25 18:34:36 +08:00
2024-12-11 14:57:08 +08:00
<insert id= "insertLeaseApplyInfo" parameterType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" useGeneratedKeys= "true" keyProperty= "id" >
2024-09-27 15:26:57 +08:00
insert into lease_apply_info
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "code != null" > code,</if>
<if test= "taskId != null" > task_id,</if>
<if test= "leasePerson != null" > lease_person,</if>
<if test= "phone != null" > phone,</if>
<if test= "type != null" > type,</if>
<if test= "companyAuditBy != null" > company_audit_by,</if>
<if test= "companyAuditTime != null" > company_audit_time,</if>
<if test= "companyAuditRemark != null" > company_audit_remark,</if>
<if test= "deptAuditBy != null" > dept_audit_by,</if>
<if test= "deptAuditTime != null" > dept_audit_time,</if>
<if test= "deptAuditRemark != null" > dept_audit_remark,</if>
<if test= "directAuditBy != null" > direct_audit_by,</if>
<if test= "directAuditTime != null" > direct_audit_time,</if>
<if test= "directAuditRemark != null" > direct_audit_remark,</if>
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
<if test= "remark != null" > remark,</if>
<if test= "companyId != null" > company_id,</if>
<if test= "directId != null" > direct_id,</if>
<if test= "leaseType != null" > lease_type,</if>
<if test= "estimateLeaseTime != null" > estimate_lease_time,</if>
<if test= "costBearingParty != null" > cost_bearing_party,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "code != null" > #{code},</if>
<if test= "taskId != null" > #{taskId},</if>
<if test= "leasePerson != null" > #{leasePerson},</if>
<if test= "phone != null" > #{phone},</if>
<if test= "type != null" > #{type},</if>
<if test= "companyAuditBy != null" > #{companyAuditBy},</if>
<if test= "companyAuditTime != null" > #{companyAuditTime},</if>
<if test= "companyAuditRemark != null" > #{companyAuditRemark},</if>
<if test= "deptAuditBy != null" > #{deptAuditBy},</if>
<if test= "deptAuditTime != null" > #{deptAuditTime},</if>
<if test= "deptAuditRemark != null" > #{deptAuditRemark},</if>
<if test= "directAuditBy != null" > #{directAuditBy},</if>
<if test= "directAuditTime != null" > #{directAuditTime},</if>
<if test= "directAuditRemark != null" > #{directAuditRemark},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "remark != null" > #{remark},</if>
<if test= "companyId != null" > #{companyId},</if>
<if test= "directId != null" > #{directId},</if>
<if test= "leaseType != null" > #{leaseType},</if>
<if test= "estimateLeaseTime != null" > #{estimateLeaseTime},</if>
<if test= "costBearingParty != null" > #{costBearingParty},</if>
</trim>
</insert>
2025-07-08 18:03:05 +08:00
<insert id= "insertLeaseSign" parameterType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" useGeneratedKeys= "true" keyProperty= "leaseSignId" >
insert into lease_sign_info
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "leaseSignUrl != null and leaseSignUrl != ''" > lease_sign_url,</if>
<if test= "leaseSignType != null" > lease_sign_type,</if>
<if test= "signPerson != null and signPerson != ''" > lease_user,</if>
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "leaseSignUrl != null and leaseSignUrl != ''" > #{leaseSignUrl},</if>
<if test= "leaseSignType != null" > #{leaseSignType},</if>
<if test= "signPerson != null and signPerson != ''" > #{signPerson},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
</trim>
</insert>
2024-12-11 14:57:08 +08:00
<update id= "updateLeaseApplyInfo" parameterType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
2024-09-27 15:26:57 +08:00
update lease_apply_info
<trim prefix= "SET" suffixOverrides= "," >
<if test= "code != null" > code = #{code},</if>
<if test= "taskId != null" > task_id = #{taskId},</if>
<if test= "leasePerson != null" > lease_person = #{leasePerson},</if>
<if test= "phone != null" > phone = #{phone},</if>
2024-11-29 18:05:50 +08:00
<if test= "type != null" > `type` = #{type},</if>
2024-09-27 15:26:57 +08:00
<if test= "companyAuditBy != null" > company_audit_by = #{companyAuditBy},</if>
<if test= "companyAuditTime != null" > company_audit_time = #{companyAuditTime},</if>
<if test= "companyAuditRemark != null" > company_audit_remark = #{companyAuditRemark},</if>
<if test= "deptAuditBy != null" > dept_audit_by = #{deptAuditBy},</if>
<if test= "deptAuditTime != null" > dept_audit_time = #{deptAuditTime},</if>
<if test= "deptAuditRemark != null" > dept_audit_remark = #{deptAuditRemark},</if>
<if test= "directAuditBy != null" > direct_audit_by = #{directAuditBy},</if>
<if test= "directAuditTime != null" > direct_audit_time = #{directAuditTime},</if>
<if test= "directAuditRemark != null" > direct_audit_remark = #{directAuditRemark},</if>
<if test= "updateBy != null" > update_by = #{updateBy},</if>
2024-11-29 18:05:50 +08:00
update_time = now(),
2024-09-27 15:26:57 +08:00
<if test= "remark != null" > remark = #{remark},</if>
<if test= "companyId != null" > company_id = #{companyId},</if>
<if test= "directId != null" > direct_id = #{directId},</if>
<if test= "leaseType != null" > lease_type = #{leaseType},</if>
<if test= "estimateLeaseTime != null" > estimate_lease_time = #{estimateLeaseTime},</if>
2025-07-25 18:34:36 +08:00
release_time = now(),
2024-09-27 15:26:57 +08:00
<if test= "costBearingParty != null" > cost_bearing_party = #{costBearingParty},</if>
2025-07-26 12:51:23 +08:00
<if test= "publisher != null " > publisher = #{publisher},</if>
2024-09-27 15:26:57 +08:00
</trim>
where id = #{id}
</update>
<delete id= "deleteLeaseApplyInfoById" parameterType= "Long" >
delete from lease_apply_info where id = #{id}
</delete>
<delete id= "deleteLeaseApplyInfoByIds" parameterType= "String" >
2025-07-25 18:34:36 +08:00
delete from lease_apply_info where id in
2024-09-27 15:26:57 +08:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
2024-11-19 10:33:56 +08:00
<select id= "getTaskId" resultType= "java.lang.String" >
select task_id
from lease_apply_info
where id = #{parentId}
</select>
2025-01-09 11:13:03 +08:00
<update id= "updateLeaseApplyInfoSign" >
update lease_apply_info
<trim prefix= "SET" suffixOverrides= "," >
<if test= "leaseSignUrl != null and leaseSignUrl != '' " > lease_sign_url = #{leaseSignUrl},</if>
<if test= "leaseSignType != null" > lease_sign_type = #{leaseSignType},</if>
</trim>
where id = #{id}
</update>
2025-01-16 18:06:58 +08:00
<!-- 设置审批人为默认的董班长 防止代码冲突 -->
<select id= "getDirectAuditBy" resultType= "Long" >
select
sc.people_id as peopleId
from sign_config sc
where sc.process_id = 0 and sc.sign_type = 0 and sc.del_flag = 0
</select>
<!-- 设置审批人签名url 防止代码冲突 -->
<select id= "getDirectAuditUrl" resultType= "java.lang.String" >
select
su.sign_url as directAuditSignUrl
from sys_user su
where su.user_id = #{directAuditBy} and su.del_flag = 0
</select>
2025-02-10 17:21:16 +08:00
<!-- 设置发料单位 防止代码冲突 -->
<select id= "getSendUnit" resultType= "java.lang.String" >
select
sd.dept_name as sendUnit
from sys_user su
left join sys_dept sd on su.dept_id = sd.dept_id and sd.del_flag = 0
where su.user_id = #{directAuditBy} and su.del_flag = 0
</select>
2025-03-06 10:26:16 +08:00
<select id= "selectPublishList" resultType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
SELECT
lai.id AS id,
2025-07-25 14:14:19 +08:00
lpd.code AS code,
lai.code AS businessCode,
2025-03-06 10:26:16 +08:00
lai.create_by AS createBy,
lai.create_time AS createTime,
sd.dept_name AS impUnitName,
bp.contract_part AS contractPart,
lpd.lease_person AS leasePerson,
lpd.phone AS phone,
lpd.unit_id AS leaseUnitId,
lpd.project_id AS leaseProjectId,
bu.unit_name AS leaseUnit,
bp.pro_name AS leaseProject,
bai.agreement_code AS agreementCode,
IFNULL( sum( lpd.num ), 0 ) AS preCountNum,
2025-03-08 15:59:33 +08:00
IFNULL(lod.num, 0) AS alNum,
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
2025-03-10 16:39:12 +08:00
lpd.publish_task AS publishTask,
2025-06-15 13:52:25 +08:00
lai.task_id AS taskId,
2025-07-25 14:14:19 +08:00
su.sign_url AS leaseSignUrl,
su.sign_type AS leaseSignType,
2025-07-07 15:25:25 +08:00
tt.task_type AS taskType,
lai.material_man AS materialMan,
lai.confirm_time AS confirmTime,
lai.is_confirm AS isConfirm,
2025-07-16 18:49:44 +08:00
lai.confirm_remark AS confirmRemark,
2025-07-25 14:14:19 +08:00
mt3.type_id AS firstId,
lpd.create_time AS releaseTime
2025-03-06 10:26:16 +08:00
FROM
lease_publish_details lpd
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
2025-07-26 12:51:23 +08:00
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task from lease_out_details a
<if test= "userId != null" >
JOIN ma_type_keeper mtk ON mtk.type_id = a.type_id AND mtk.user_id = #{userId}
</if>
2025-03-08 15:59:33 +08:00
GROUP BY parent_id, publish_task) lod ON lpd.parent_id = lod.parent_id
2025-03-06 10:26:16 +08:00
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
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
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'
2025-07-16 18:49:44 +08:00
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'
2025-03-06 10:26:16 +08:00
LEFT JOIN bm_agreement_info bai ON lpd.unit_id = bai.unit_id
AND lpd.project_id = bai.project_id
2025-07-25 14:14:19 +08:00
left join sys_user su on lpd.create_by = su.user_id
2025-03-08 15:59:33 +08:00
<if test= "userId != null" >
JOIN ma_type_keeper mtk ON mtk.type_id = lpd.type_id AND mtk.user_id = #{userId}
</if>
2025-03-08 10:26:22 +08:00
where 1 = 1
<if test= "startTime != null and startTime != '' and endTime != null and endTime != ''" >
2025-07-25 14:14:19 +08:00
<![CDATA[ AND DATE_FORMAT( lpd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
2025-03-08 10:26:22 +08:00
</if>
2025-03-08 15:59:33 +08:00
<if test= "id != null " >
AND lai.id = #{id}
</if>
<if test= "publishTask != null and publishTask != ''" >
AND lpd.publish_task = #{publishTask}
</if>
2025-03-06 10:26:16 +08:00
GROUP BY
lpd.publish_task
2025-08-21 19:48:01 +08:00
ORDER BY lpd.code DESC;
2025-03-06 10:26:16 +08:00
</select>
2025-06-15 13:52:25 +08:00
2025-06-21 11:00:18 +08:00
<select id= "selectLeaseApplyOutList" resultType= "com.bonus.common.biz.domain.lease.LeaseOutSign" >
SELECT
su.sign_type AS outSignType,
su.sign_url AS outSignUrl
FROM
sys_user su
LEFT JOIN lease_out_details lod ON su.user_id = lod.create_by
WHERE
2025-06-21 21:04:32 +08:00
lod.parent_id = #{id} AND su.sign_url IS NOT NULL
2025-06-21 11:00:18 +08:00
GROUP BY
su.user_id
</select>
2025-07-08 19:03:15 +08:00
<select id= "selectCompleteOutList" resultType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
<include refid= "selectLeaseApplyInfoVoTwo" />
where
2025-07-28 15:56:11 +08:00
lod.num >0 and lod.lease_sign_id is not null and bp.external_id is not null
2025-07-26 12:51:23 +08:00
and tt.task_type = 2
2025-07-08 19:03:15 +08:00
<if test= "code != null and code != ''" > and lai.code = #{code}</if>
<if test= "taskId != null " > and lai.task_id = #{taskId}</if>
<if test= "leasePerson != null and leasePerson != ''" > and lai.lease_person = #{leasePerson}</if>
<if test= "phone != null and phone != ''" > and lai.phone = #{phone}</if>
<if test= "type != null and type != ''" > and lai.type = #{type}</if>
<if test= "companyAuditBy != null " > and lai.company_audit_by = #{companyAuditBy}</if>
<if test= "companyAuditTime != null " > and lai.company_audit_time = #{companyAuditTime}</if>
<if test= "companyAuditRemark != null and companyAuditRemark != ''" > and lai.company_audit_remark = #{companyAuditRemark}</if>
<if test= "deptAuditBy != null " > and lai.dept_audit_by = #{deptAuditBy}</if>
<if test= "deptAuditTime != null " > and lai.dept_audit_time = #{deptAuditTime}</if>
<if test= "deptAuditRemark != null and deptAuditRemark != ''" > and lai.dept_audit_remark = #{deptAuditRemark}</if>
<if test= "directAuditBy != null " > and lai.direct_audit_by = #{directAuditBy}</if>
<if test= "directAuditTime != null " > and lai.direct_audit_time = #{directAuditTime}</if>
<if test= "directAuditRemark != null and directAuditRemark != ''" > and lai.direct_audit_remark = #{directAuditRemark}</if>
<if test= "companyId != null " > and lai.company_id = #{companyId}</if>
<if test= "statusList != null and statusList.size() > 0" >
and tt.task_status in
<foreach item= "item" collection= "statusList" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<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= "directId != null " > and lai.direct_id = #{directId}</if>
<if test= "leaseType != null and leaseType != ''" > and lai.lease_type = #{leaseType}</if>
<if test= "estimateLeaseTime != null " > and lai.estimate_lease_time = #{estimateLeaseTime}</if>
<if test= "costBearingParty != null and costBearingParty != ''" > and lai.cost_bearing_party = #{costBearingParty}</if>
GROUP BY lai.id
2025-07-28 15:56:11 +08:00
ORDER BY tt.task_status,lai.create_time desc
2025-07-08 19:03:15 +08:00
</select>
<select id= "checkPermission" resultType= "java.lang.Integer" >
SELECT COUNT(1)
FROM `sbd_audit`.sg_project_post_personnel sgp
LEFT JOIN `data_center`.dx_fb_son dfs ON sgp.depart_id = dfs.project_dept_id
WHERE sgp.post_id = '3de0eb390f3611efa1940242ac130004'
AND sgp.cno = #{username}
AND dfs.id = #{externalId}
</select>
<select id= "selectOutDetailsList" resultType= "com.bonus.material.lease.domain.LeaseApplyDetails" >
select
lod.id as id,
lod.parent_id as parentId,
sum(lod.out_num) as outNum,
DATE_FORMAT(lod.confirm_time, '%Y-%m-%d') as confirmTime,
lod.is_confirm as isConfirm,
su.nick_name as confirmPerson,
lod.confirm_remark as confirmRemark,
GROUP_CONCAT(DISTINCT mt2.type_name) as maTypeNames,
2025-07-26 12:51:23 +08:00
lod.lease_sign_id as leaseSignId,
lod.publish_task as publishTask
2025-07-08 19:03:15 +08:00
from lease_out_details lod
left join ma_type mt1 on lod.type_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join sys_user su on lod.confirm_person = su.user_id
2025-07-19 17:48:40 +08:00
where lod.parent_id = #{id}
2025-07-08 19:03:15 +08:00
and lod.out_num > 0
and lod.lease_sign_id is not null
<if test= "keyWord != null and keyWord != ''" >
AND GROUP_CONCAT(DISTINCT mt2.type_name) LIKE CONCAT(CONCAT('%', #{keyWord}), '%')
</if>
group by lod.lease_sign_id
order by lod.is_confirm
</select>
<select id= "getLeaseInfoById" resultType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
select
lai.id, lai.code, lai.task_id, lai.lease_person as leasePerson, lai.phone, lai.type, lai.company_audit_by,
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by as directAuditBy, lai.dept_audit_time,
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
lai.create_by, DATE_FORMAT(lai.create_time, '%Y-%m-%d') as createTime, lai.update_by, lai.update_time, lai.remark, lai.company_id,
2025-08-21 20:04:14 +08:00
lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party,
2025-07-08 19:03:15 +08:00
lai.material_man, lai.confirm_time, lai.is_confirm, lai.confirm_remark,
bai.unit_id,bai.project_id,bu.unit_name as unitName, bp.pro_name as projectName,bp.external_id as externalId, bai.agreement_code as agreementCode, tt.task_status as taskStatus,
sda.dict_label as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(sum(lod.out_num),0) as alNum,
CASE
WHEN IFNULL(sum(lad.pre_num),0) = SUM(CASE WHEN lod.is_confirm = 2 THEN lod.out_num ELSE 0 END) THEN 2
ELSE 1
END as isConfirm,
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
bp.contract_part as contractPart,
sd.dept_name as impUnitName,
2025-07-25 14:14:19 +08:00
tt.task_type as taskType,
2025-08-21 20:04:14 +08:00
su.sign_type as leaseSignType,
su.sign_url as leaseSignUrl
2025-07-08 19:03:15 +08:00
from
lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id
left join lease_apply_details lad on lai.id = lad.parent_id
left join lease_out_details lod on lai.id = lod.parent_id
left join tm_task_agreement tta on lai.task_id = tta.task_id
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 sys_dict_data sda on tt.task_status = sda.dict_value
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'
2025-07-25 14:14:19 +08:00
left join sys_user su on lai.publisher = su.user_id
2025-07-08 19:03:15 +08:00
where lai.id = #{id}
</select>
<select id= "getDetailsLeaseList" resultType= "com.bonus.material.lease.domain.LeaseApplyDetails" >
select
lod.id as id,
lod.type_id as typeId,
lod.parent_id as parentId,
2025-07-25 18:37:34 +08:00
IFNULL( SUM( lod.out_num ), 0 ) as outNum,
2025-07-08 19:03:15 +08:00
DATE_FORMAT(lod.confirm_time, '%Y-%m-%d') as confirmTime,
mt2.type_name as maTypeName,
mt1.type_name as typeName,
lod.remark as remark,
mt1.manage_type as manageType,
lod.confirm_person as confirmPerson,
2025-07-25 14:14:19 +08:00
mt1.unit_name as unitName,
su.sign_url as signUrl,
su.sign_type as signType
2025-07-08 19:03:15 +08:00
from lease_out_details lod
left join ma_type mt1 on lod.type_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
2025-07-25 14:14:19 +08:00
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 sys_user su on su.user_id = mt3.keep_user_id
2025-07-08 19:03:15 +08:00
where lod.parent_id = #{id}
and lod.out_num > 0
and lod.lease_sign_id = #{leaseSignId}
2025-07-25 18:37:34 +08:00
GROUP BY lod.type_id
2025-07-19 17:48:40 +08:00
ORDER BY lod.create_time DESC
2025-07-08 19:03:15 +08:00
</select>
<select id= "getLeaseConfirmSign" resultType= "com.bonus.common.biz.domain.lease.LeaseConfirmSign" >
select
su.sign_url as confirmSignUrl,
su.sign_type as confirmSignType
from sys_user su
where su.user_id = #{confirmPerson} and su.del_flag = 0
</select>
2025-06-21 11:00:18 +08:00
2025-07-08 18:03:05 +08:00
<select id= "selectNoSignList" resultType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
SELECT
GROUP_CONCAT( DISTINCT lod.id ) AS ids,
lai.id AS id,
lai.CODE AS CODE,
lai.create_by AS createBy,
lai.create_time AS createTime,
lai.lease_person AS leasePerson,
lai.phone AS phone,
bai.unit_id AS leaseUnitId,
bai.project_id AS leaseProjectId,
bu.unit_name AS leaseUnit,
bp.pro_name AS leaseProject,
bai.agreement_code AS agreementCode,
IFNULL( sum( lod.out_num ), 0 ) AS alNum,
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
lai.task_id AS taskId,
tt.task_type AS taskType,
bp.external_id AS externalId,
2025-07-19 16:13:55 +08:00
bu.bzz_idcard AS idCard,
2025-07-25 18:37:34 +08:00
mt4.type_id AS firstId,
COALESCE(lai.release_time, lai.create_time) as releaseTime
2025-07-08 18:03:05 +08:00
FROM
lease_out_details lod
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
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_unit bu ON bu.unit_id = bai.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN ma_type mt ON lod.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'
2025-07-19 16:13:55 +08:00
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'
2025-07-08 18:03:05 +08:00
WHERE
2025-07-08 18:30:57 +08:00
lod.lease_sign_id is null
2025-07-25 18:37:34 +08:00
and tt.task_type = '2'
2025-07-08 18:03:05 +08:00
<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>
GROUP BY
lod.parent_id
ORDER BY
lod.create_time DESC
</select>
2025-07-16 18:49:44 +08:00
<select id= "selectTypeIdList" resultType= "java.lang.Long" >
select
2025-07-23 09:04:57 +08:00
DISTINCT
2025-07-16 18:49:44 +08:00
type_id
from
ma_type_manage
where
user_id = #{userId}
</select>
2025-07-19 16:13:55 +08:00
<select id= "selectOutList" resultType= "com.bonus.common.biz.domain.lease.LeaseOutSign" >
SELECT
2025-07-25 14:14:19 +08:00
lsi.lease_sign_type as outSignType,
lsi.lease_sign_url as outSignUrl
2025-07-19 16:13:55 +08:00
FROM
2025-07-25 14:14:19 +08:00
lease_out_details lod
LEFT JOIN lease_sign_info lsi ON lod.lease_sign_id = lsi.id
2025-07-19 16:13:55 +08:00
WHERE
2025-07-25 14:14:19 +08:00
lsi.lease_sign_url IS NOT NULL
and lod.parent_id = #{id}
<if test= "leaseSignId != null" >
2025-07-19 17:48:40 +08:00
and lsi.id = #{leaseSignId}
2025-07-25 14:14:19 +08:00
</if>
2025-07-19 16:13:55 +08:00
GROUP BY
2025-07-25 14:14:19 +08:00
lod.lease_sign_id
2025-07-19 16:13:55 +08:00
</select>
2025-07-23 09:04:57 +08:00
<select id= "selectLeaseApplyInfoPublishList" parameterType= "Long" resultMap= "LeaseApplyInfoResult" >
select
lai.id, lai.code, lai.task_id, lai.lease_person, lai.phone, lai.type, lai.company_audit_by,
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id,
lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party, lai.lease_sign_url, lai.lease_sign_type,
lai.material_man, lai.confirm_time, lai.is_confirm, lai.confirm_remark,
bu.unit_name, bp.pro_name, tt.task_status as taskStatus,
sda.dict_label as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(sum(lad.al_num),0) as alNum,
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
bp.contract_part as contractPart,
sd.dept_name as impUnitName,
tt.task_type as taskType
from
lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id
left join lease_apply_details lad on lai.id = lad.parent_id
left join bm_unit bu on bu.unit_id = lai.unit_id
left join bm_project bp on bp.pro_id = lai.project_id
left join sys_dept sd on sd.dept_id = bp.imp_unit
left join sys_dict_data sda on tt.task_status = sda.dict_value
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'
where lai.id = #{id}
</select>
2025-07-25 18:37:34 +08:00
<select id= "selectLeaseOutList" resultType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
SELECT
GROUP_CONCAT( DISTINCT lod.id ) AS ids,
lai.id AS id,
lai.CODE AS CODE,
lai.create_by AS createBy,
lai.create_time AS createTime,
lai.lease_person AS leasePerson,
lai.phone AS phone,
a.unit_id AS leaseUnitId,
a.project_id AS leaseProjectId,
bu.unit_name AS leaseUnit,
bp.pro_name AS leaseProject,
bai.agreement_code AS agreementCode,
IFNULL( sum( lod.out_num ), 0 ) AS alNum,
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
lai.task_id AS taskId,
tt.task_type AS taskType,
bp.external_id AS externalId,
bu.bzz_idcard AS idCard,
mt4.type_id AS firstId,
a.create_time AS releaseTime
FROM
lease_out_details lod
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN (SELECT parent_id, unit_id,project_id,create_time from lease_publish_details
GROUP BY parent_id) a ON a.parent_id = lod.parent_id
LEFT JOIN bm_unit bu ON bu.unit_id = a.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = a.project_id
LEFT JOIN bm_agreement_info bai ON a.unit_id = bai.unit_id
AND a.project_id = bai.project_id
LEFT JOIN ma_type mt ON lod.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 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'
WHERE
lod.lease_sign_id is null
and tt.task_type = '19'
<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>
GROUP BY
lod.parent_id
ORDER BY
lod.create_time DESC
</select>
<select id= "selectPublish" resultType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
SELECT
lai.id AS id,
lpd.code AS code,
lai.code AS businessCode,
lai.create_by AS createBy,
lai.create_time AS createTime,
sd.dept_name AS impUnitName,
bp.contract_part AS contractPart,
lpd.lease_person AS leasePerson,
lpd.phone AS phone,
lpd.unit_id AS leaseUnitId,
lpd.project_id AS leaseProjectId,
bu.unit_name AS unitName,
bp.pro_name AS projectName,
bai.agreement_code AS agreementCode,
2025-07-27 14:50:47 +08:00
IFNULL(SUM(lpd.num), 0) AS preCountNum,
2025-07-25 18:37:34 +08:00
IFNULL(lod.num, 0) AS alNum,
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
lpd.publish_task AS publishTask,
lai.task_id AS taskId,
su.sign_url AS leaseSignUrl,
su.sign_type AS leaseSignType,
tt.task_type AS taskType,
mt3.type_id AS firstId,
lpd.create_time AS releaseTime,
2025-08-23 19:22:18 +08:00
bp.external_id as externalId
2025-07-25 18:37:34 +08:00
FROM
2025-08-23 19:22:18 +08:00
lease_publish_details lpd
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
2025-07-25 18:37:34 +08:00
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task, is_confirm, confirm_remark, confirm_time, lease_sign_id from lease_out_details
2025-07-26 12:51:23 +08:00
GROUP BY parent_id) lod ON lpd.parent_id = lod.parent_id
2025-07-25 18:37:34 +08:00
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 sys_dept sd ON sd.dept_id = bp.imp_unit
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 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
left join sys_user su on lpd.create_by = su.user_id
where
2025-07-26 12:51:23 +08:00
lod.lease_sign_id is not null and bp.external_id is not null and tt.task_type = '19'
2025-07-25 18:37:34 +08:00
<if test= "startTime != null and startTime != '' and endTime != null and endTime != ''" >
<![CDATA[ AND DATE_FORMAT( lpd.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
2025-08-23 19:22:18 +08:00
lpd.publish_task
ORDER BY lpd.create_time DESC
2025-07-25 18:37:34 +08:00
</select>
2025-07-26 12:51:23 +08:00
<select id= "getOutList" resultType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
SELECT
parent_id as id,
2025-08-23 19:22:18 +08:00
SUM(out_num) as alNum
2025-07-26 12:51:23 +08:00
FROM
2025-08-23 19:22:18 +08:00
lease_out_details
2025-07-26 12:51:23 +08:00
WHERE
2025-08-23 19:22:18 +08:00
parent_id = #{id}
HAVING
SUM( out_num ) > 0
2025-07-26 12:51:23 +08:00
</select>
2025-06-19 16:17:08 +08:00
<update id= "confirmLeaseTask" >
update
2025-07-08 19:03:15 +08:00
lease_out_details
2025-06-19 16:17:08 +08:00
set
2025-07-08 19:03:15 +08:00
is_confirm = #{isConfirm}, confirm_time = #{confirmTime}, confirm_person = #{confirmPerson},
2025-06-19 16:17:08 +08:00
confirm_remark = #{confirmRemark}
where
2025-07-08 19:03:15 +08:00
parent_id = #{id} and lease_sign_id = #{leaseSignId}
2025-06-19 16:17:08 +08:00
</update>
2025-06-21 21:04:32 +08:00
<update id= "updateLeasePublishInfoSign" >
update lease_publish_details
<trim prefix= "SET" suffixOverrides= "," >
<if test= "leaseSignUrl != null and leaseSignUrl != '' " > lease_sign_url = #{leaseSignUrl},</if>
<if test= "leaseSignType != null" > lease_sign_type = #{leaseSignType},</if>
</trim>
where parent_id = #{id}
<if test= "publishTask != null and publishTask != ''" >
and publish_task = #{publishTask}
</if>
</update>
2025-07-08 19:03:15 +08:00
<update id= "updateLeaseApplyInfoConfirm" >
update lease_apply_info
is_confirm = 2
where id = #{id}
</update>
2025-07-26 13:22:31 +08:00
<select id= "getUserList" resultMap= "LeaseApplyInfoResult" >
SELECT
sgp.cno
FROM
bm_project bp
LEFT JOIN `data_center`.dx_fb_son dfs on bp.external_id = dfs.id
LEFT JOIN `sbd_audit`.sg_project_post_personnel sgp on sgp.depart_id = dfs.project_dept_id
WHERE sgp.post_id = '3de0eb390f3611efa1940242ac130004'
AND bp.pro_id = #{leaseProjectId}
</select>
<select id= "getUserPhoneById" resultMap= "LeaseApplyInfoResult" >
select
user_id,
phonenumber AS phone
from
sys_user
where user_name = #{cno}
</select>
2025-08-12 15:09:12 +08:00
<select id= "selectLeaseApplyInfoIsTeam" resultType= "java.lang.Long" >
select
bu.type_id as typeId
from
lease_apply_info lai
left join bm_unit bu on lai.unit_id = bu.unit_id
where
lai.id = #{leaseId}
</select>
<select id= "selectLeaseApplyInfoUnitIdByLeaseId" resultType= "java.lang.Long" >
select
lai.unit_id as unitId
from
lease_apply_info lai
where
lai.id = #{leaseId}
</select>
<select id= "selectUnitTypeByUnitId" resultType= "java.lang.Long" >
select type_id as typeId
from bm_unit
where unit_id = #{unitId}
</select>
2025-08-14 18:36:09 +08:00
<select id= "selectProjectUnitAgreementIdByTeamAndProject" resultType= "com.bonus.common.biz.domain.lease.LeaseOutDetails" >
2025-08-12 15:09:12 +08:00
SELECT
2025-08-14 18:36:09 +08:00
baii.agreement_id AS projectUnitAgreementId, bai.project_unit_id AS projectUnitId
2025-08-12 15:09:12 +08:00
FROM
bm_agreement_info bai
LEFT JOIN bm_agreement_info baii ON baii.unit_id = bai.project_unit_id AND baii.project_id = #{projectId}
WHERE
bai.unit_id = #{teamId} AND bai.project_id = #{projectId}
</select>
2025-08-21 20:04:14 +08:00
<select id= "getOutNum" resultType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
SELECT
IFNULL(SUM(out_num), 0) as alNum
FROM
lease_out_details
where 1 = 1
<if test= "startTime != null and startTime != '' and endTime != null and endTime != ''" >
and create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
</select>
2025-08-23 19:22:18 +08:00
<select id= "getInfoList" resultType= "com.bonus.common.biz.domain.lease.LeaseApplyInfo" >
SELECT
parent_id AS id,
SUM( out_num ) AS alNum
FROM
lease_out_details
WHERE
is_confirm = 2
AND parent_id = #{id}
HAVING
SUM( out_num ) > 0
</select>
2025-07-25 18:34:36 +08:00
</mapper>