2023-12-21 20:17:36 +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.sgzb.material.mapper.BackApplyMapper">
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.bonus.sgzb.material.domain.AgreementInfo" id="BmAgreementInfoResult">
|
|
|
|
|
|
<result property="agreementId" column="agreement_id"/>
|
|
|
|
|
|
<result property="agreementCode" column="agreement_code"/>
|
|
|
|
|
|
<result property="signTime" column="sign_time"/>
|
|
|
|
|
|
<result property="unitId" column="unit_id"/>
|
|
|
|
|
|
<result property="unitName" column="unit_name"/>
|
|
|
|
|
|
<result property="projectId" column="project_id"/>
|
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
|
<result property="leaseDay" column="lease_day"/>
|
|
|
|
|
|
<result property="planStartTime" column="plan_start_time"/>
|
|
|
|
|
|
<result property="contractCode" column="contract_code"/>
|
|
|
|
|
|
<result property="authPerson" column="auth_person"/>
|
|
|
|
|
|
<result property="phone" column="phone"/>
|
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
|
<result property="companyId" column="company_id"/>
|
|
|
|
|
|
<result property="fileName" column="file_name"/>
|
|
|
|
|
|
<result property="fileUrl" column="file_url"/>
|
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
<insert id="insertTask" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.material.domain.BackApplyInfo" useGeneratedKeys="true">
|
2023-12-22 00:13:15 +08:00
|
|
|
|
insert into tm_task (
|
|
|
|
|
|
<if test="taskType != null">task_type, </if>
|
|
|
|
|
|
<if test="taskStatus != null">task_status, </if>
|
|
|
|
|
|
<if test="code != null and code != ''">code, </if>
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">create_by, </if>
|
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by, </if>
|
|
|
|
|
|
<if test="updateTime != null">update_time, </if>
|
|
|
|
|
|
<if test="remark != null and remark != ''">remark, </if>
|
|
|
|
|
|
<if test="companyId != null">company_id, </if>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
create_time
|
|
|
|
|
|
) values (
|
2023-12-22 00:13:15 +08:00
|
|
|
|
<if test="taskType != null">#{taskType}, </if>
|
|
|
|
|
|
<if test="taskStatus != null">#{taskStatus}, </if>
|
|
|
|
|
|
<if test="code != null and code != ''">#{code}, </if>
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">#{createBy}, </if>
|
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy}, </if>
|
|
|
|
|
|
<if test="updateTime != null">#{updateTime}, </if>
|
|
|
|
|
|
<if test="remark != null and remark != ''">#{remark}, </if>
|
|
|
|
|
|
<if test="companyId != null">#{companyId}, </if>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
NOW()
|
2023-12-22 00:13:15 +08:00
|
|
|
|
)
|
2023-12-21 20:17:36 +08:00
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertTaskAgreement">
|
|
|
|
|
|
insert into tm_task_agreement
|
|
|
|
|
|
(
|
|
|
|
|
|
<if test="taskId != null">
|
|
|
|
|
|
task_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="agreementId != null">
|
|
|
|
|
|
agreement_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
create_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">
|
|
|
|
|
|
update_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
|
update_time,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
remark,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
company_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
create_time
|
|
|
|
|
|
) values (
|
|
|
|
|
|
<if test="taskId != null">
|
|
|
|
|
|
#{taskId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="agreementId != null">
|
|
|
|
|
|
#{agreementId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
#{createBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">
|
|
|
|
|
|
#{updateBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
|
#{updateTime},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
#{remark},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
#{companyId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
NOW()
|
|
|
|
|
|
)
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertBackApply" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.material.domain.BackApplyInfo" useGeneratedKeys="true">
|
|
|
|
|
|
insert into back_apply_info
|
|
|
|
|
|
(
|
|
|
|
|
|
<if test="code != null">
|
|
|
|
|
|
code,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="taskId != null">
|
|
|
|
|
|
task_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backPerson != null and backPerson != ''">
|
|
|
|
|
|
back_person,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backTime != null and backTime != ''">
|
|
|
|
|
|
back_time,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="phone != null and phone != ''">
|
|
|
|
|
|
phone,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditBy != null">
|
|
|
|
|
|
direct_audit_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditTime != null and directAuditTime != ''">
|
|
|
|
|
|
direct_audit_time,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditRemark != null">
|
|
|
|
|
|
direct_audit_remark,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
create_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">
|
|
|
|
|
|
update_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
|
update_time,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
remark,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
company_id,
|
|
|
|
|
|
</if>
|
2024-03-22 15:23:57 +08:00
|
|
|
|
<if test="status != null and status != ''">
|
|
|
|
|
|
status,
|
|
|
|
|
|
</if>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
create_time
|
|
|
|
|
|
) values (
|
|
|
|
|
|
<if test="code != null">
|
|
|
|
|
|
#{code},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="taskId != null">
|
|
|
|
|
|
#{taskId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backPerson != null and backPerson != ''">
|
|
|
|
|
|
#{backPerson},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backTime != null and backTime != ''">
|
|
|
|
|
|
#{backTime},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="phone != null and phone != ''">
|
|
|
|
|
|
#{phone},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditBy != null">
|
|
|
|
|
|
#{directAuditBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditTime != null and directAuditTime != ''">
|
|
|
|
|
|
#{directAuditTime},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditRemark != null">
|
|
|
|
|
|
#{directAuditRemark},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
#{createBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">
|
|
|
|
|
|
#{updateBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
|
#{updateTime},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
#{remark},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
#{companyId},
|
|
|
|
|
|
</if>
|
2024-03-22 15:23:57 +08:00
|
|
|
|
<if test="status != null and status != ''">
|
|
|
|
|
|
#{status},
|
|
|
|
|
|
</if>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
NOW()
|
|
|
|
|
|
)
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
2023-12-23 10:24:00 +08:00
|
|
|
|
<insert id="upload" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
2023-12-21 20:17:36 +08:00
|
|
|
|
insert into back_apply_details
|
|
|
|
|
|
(
|
|
|
|
|
|
<if test="id != null">
|
|
|
|
|
|
parent_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
|
type_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="num != null">
|
|
|
|
|
|
pre_num,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
status,
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
create_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
update_time,
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
remark,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
company_id,
|
|
|
|
|
|
</if>
|
2024-03-29 17:48:02 +08:00
|
|
|
|
<if test="auditNum != null">
|
|
|
|
|
|
audit_num,
|
|
|
|
|
|
</if>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
create_time
|
|
|
|
|
|
)
|
|
|
|
|
|
values (
|
|
|
|
|
|
<if test="id != null">
|
|
|
|
|
|
#{id},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
|
#{typeId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="num != null">
|
|
|
|
|
|
#{num},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
'0',
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
#{createBy},
|
|
|
|
|
|
</if>
|
2024-03-22 15:23:57 +08:00
|
|
|
|
NOW(),
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
#{remark},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
#{companyId},
|
|
|
|
|
|
</if>
|
2024-03-29 17:48:02 +08:00
|
|
|
|
<if test="auditNum != null">
|
|
|
|
|
|
#{auditNum},
|
|
|
|
|
|
</if>
|
2024-03-22 15:23:57 +08:00
|
|
|
|
NOW()
|
|
|
|
|
|
)
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="uploadByCq" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
|
|
|
|
|
insert into back_apply_details
|
|
|
|
|
|
(
|
|
|
|
|
|
<if test="id != null">
|
|
|
|
|
|
parent_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
|
type_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="num != null">
|
|
|
|
|
|
pre_num,audit_num,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
status,
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
create_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
update_time,
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
remark,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
company_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
create_time
|
|
|
|
|
|
)
|
|
|
|
|
|
values (
|
|
|
|
|
|
<if test="id != null">
|
|
|
|
|
|
#{id},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
|
#{typeId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="num != null">
|
|
|
|
|
|
#{num},#{num},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
'0',
|
2023-12-21 20:17:36 +08:00
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
#{createBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
NOW(),
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
#{remark},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
#{companyId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
NOW()
|
|
|
|
|
|
)
|
|
|
|
|
|
</insert>
|
2024-06-27 16:19:49 +08:00
|
|
|
|
<insert id="insertBackApplyInfo" parameterType="com.bonus.sgzb.material.domain.po.BackApplyInfoPo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
|
insert into back_apply_info
|
|
|
|
|
|
(
|
|
|
|
|
|
<if test="code != null">
|
|
|
|
|
|
code,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="taskId != null">
|
|
|
|
|
|
task_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backPerson != null and backPerson != ''">
|
|
|
|
|
|
back_person,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backTime != null and backTime != ''">
|
|
|
|
|
|
back_time,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="phone != null and phone != ''">
|
|
|
|
|
|
phone,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditBy != null">
|
|
|
|
|
|
direct_audit_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditTime != null and directAuditTime != ''">
|
|
|
|
|
|
direct_audit_time,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditRemark != null">
|
|
|
|
|
|
direct_audit_remark,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
create_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">
|
|
|
|
|
|
update_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
|
update_time,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
remark,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
company_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="status != null and status != ''">
|
|
|
|
|
|
status,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backSource != null and backSource != ''">
|
|
|
|
|
|
back_source,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="parentId != null and parentId != ''">
|
|
|
|
|
|
parent_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
create_time
|
|
|
|
|
|
) values (
|
|
|
|
|
|
<if test="code != null">
|
|
|
|
|
|
#{code},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="taskId != null">
|
|
|
|
|
|
#{taskId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backPerson != null and backPerson != ''">
|
|
|
|
|
|
#{backPerson},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backTime != null and backTime != ''">
|
|
|
|
|
|
#{backTime},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="phone != null and phone != ''">
|
|
|
|
|
|
#{phone},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditBy != null">
|
|
|
|
|
|
#{directAuditBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditTime != null and directAuditTime != ''">
|
|
|
|
|
|
#{directAuditTime},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="directAuditRemark != null">
|
|
|
|
|
|
#{directAuditRemark},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
#{createBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">
|
|
|
|
|
|
#{updateBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
|
#{updateTime},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
#{remark},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
#{companyId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="status != null and status != ''">
|
|
|
|
|
|
#{status},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="backSource != null and backSource != ''">
|
|
|
|
|
|
#{backSource},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="parentId != null and parentId != ''">
|
|
|
|
|
|
#{parentId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
NOW()
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
<insert id="insertBackApplyDetails">
|
|
|
|
|
|
insert into back_apply_details
|
|
|
|
|
|
(
|
|
|
|
|
|
<if test="parentId != null">
|
|
|
|
|
|
parent_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
|
type_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="preNum != null">
|
|
|
|
|
|
pre_num,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
status,
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
create_by,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
update_time,
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
remark,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
company_id,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="auditNum != null">
|
|
|
|
|
|
audit_num,
|
|
|
|
|
|
</if>
|
|
|
|
|
|
create_time
|
|
|
|
|
|
)
|
|
|
|
|
|
values (
|
|
|
|
|
|
<if test="parentId != null">
|
|
|
|
|
|
#{parentId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
|
#{typeId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="preNum != null">
|
|
|
|
|
|
#{preNum},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
'0',
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
#{createBy},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
NOW(),
|
|
|
|
|
|
<if test="remark != null and remark != ''">
|
|
|
|
|
|
#{remark},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
|
#{companyId},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="auditNum != null">
|
|
|
|
|
|
#{auditNum},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
NOW()
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
</insert>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
|
|
|
|
|
|
<update id="setModify">
|
|
|
|
|
|
update back_apply_details
|
|
|
|
|
|
set pre_num =#{num}
|
|
|
|
|
|
where id = #{detailsId}
|
|
|
|
|
|
</update>
|
2023-12-22 00:13:15 +08:00
|
|
|
|
|
|
|
|
|
|
<update id="audit">
|
|
|
|
|
|
UPDATE tm_task tt
|
|
|
|
|
|
LEFT JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
|
|
|
|
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
2024-04-10 17:48:09 +08:00
|
|
|
|
SET bad.audit_num=#{auditNum},bai.direct_audit_by=#{createBy},bai.status=#{status},bai.direct_audit_time=NOW()
|
2023-12-22 00:13:15 +08:00
|
|
|
|
WHERE
|
2024-06-19 11:34:47 +08:00
|
|
|
|
bai.id = #{id} and bad.type_id = #{typeId}
|
2024-02-26 09:03:07 +08:00
|
|
|
|
<if test="companyId != null and companyId != ''">
|
2024-02-29 19:24:27 +08:00
|
|
|
|
and bai.company_id = #{companyId}
|
2024-02-26 09:03:07 +08:00
|
|
|
|
</if>
|
2023-12-22 00:13:15 +08:00
|
|
|
|
</update>
|
2024-01-15 15:32:06 +08:00
|
|
|
|
|
|
|
|
|
|
<update id="refuse">
|
|
|
|
|
|
UPDATE tm_task tt
|
2024-02-26 09:03:07 +08:00
|
|
|
|
LEFT JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
|
|
|
|
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
2024-02-29 19:24:27 +08:00
|
|
|
|
SET bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status=#{status},bai.direct_audit_time=NOW()
|
2024-02-26 09:03:07 +08:00
|
|
|
|
WHERE
|
|
|
|
|
|
bai.id = #{id}
|
|
|
|
|
|
<if test="companyId != null and companyId != ''">
|
2024-02-29 19:24:27 +08:00
|
|
|
|
and bai.company_id = #{companyId}
|
2024-01-18 15:48:18 +08:00
|
|
|
|
</if>
|
2024-02-26 09:03:07 +08:00
|
|
|
|
</update>
|
|
|
|
|
|
<update id="updateTmTask">
|
|
|
|
|
|
UPDATE tm_task tt
|
|
|
|
|
|
INNER JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
|
|
|
|
|
SET tt.task_status = #{taskStatus}
|
2024-01-15 15:32:06 +08:00
|
|
|
|
WHERE
|
|
|
|
|
|
bai.id = #{id}
|
|
|
|
|
|
</update>
|
2024-03-08 17:40:02 +08:00
|
|
|
|
<update id="updateTmTaskBytaskId">
|
|
|
|
|
|
UPDATE tm_task tt
|
|
|
|
|
|
SET tt.task_status = #{taskStatus}
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
tt.task_id = #{taskId}
|
|
|
|
|
|
</update>
|
2024-04-22 10:20:29 +08:00
|
|
|
|
<update id="auditAll">
|
|
|
|
|
|
UPDATE tm_task tt
|
|
|
|
|
|
LEFT JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
|
|
|
|
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
|
|
|
|
|
SET bad.audit_num=#{auditNum},bai.direct_audit_by=#{createBy},bai.status=#{status},bai.direct_audit_time=NOW()
|
|
|
|
|
|
WHERE
|
2024-06-19 11:34:47 +08:00
|
|
|
|
bai.id = #{innerId} and bad.type_id = #{typeId}
|
2024-04-22 10:20:29 +08:00
|
|
|
|
<if test="companyId != null and companyId != ''">
|
|
|
|
|
|
and bai.company_id = #{companyId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</update>
|
|
|
|
|
|
<update id="updateTmTaskAll">
|
|
|
|
|
|
UPDATE tm_task tt
|
|
|
|
|
|
INNER JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
|
|
|
|
|
SET tt.task_status = #{taskStatus}
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
bai.id = #{id}
|
|
|
|
|
|
</update>
|
2024-06-28 16:35:01 +08:00
|
|
|
|
<update id="updateBackApplyDetailsByParentId">
|
|
|
|
|
|
UPDATE back_apply_details set pre_num = #{preNum} ,audit_num = #{auditNum}
|
|
|
|
|
|
WHERE parent_id = #{parentId} and type_id = #{typeId}
|
|
|
|
|
|
</update>
|
2024-01-15 15:32:06 +08:00
|
|
|
|
|
2023-12-21 20:17:36 +08:00
|
|
|
|
<delete id="del">
|
|
|
|
|
|
DELETE
|
2023-12-22 00:13:15 +08:00
|
|
|
|
FROM tm_task_agreement
|
|
|
|
|
|
WHERE task_id IN (SELECT task_id FROM back_apply_info WHERE id = #{id});
|
2023-12-21 20:17:36 +08:00
|
|
|
|
|
|
|
|
|
|
DELETE
|
2023-12-22 00:13:15 +08:00
|
|
|
|
FROM tm_task
|
|
|
|
|
|
WHERE task_id IN (SELECT task_id FROM back_apply_info WHERE id = #{id});
|
|
|
|
|
|
|
2023-12-21 20:17:36 +08:00
|
|
|
|
|
|
|
|
|
|
DELETE
|
2023-12-22 00:13:15 +08:00
|
|
|
|
FROM back_apply_details
|
|
|
|
|
|
WHERE parent_id IN (SELECT id FROM back_apply_info WHERE id = #{id});
|
2023-12-21 20:17:36 +08:00
|
|
|
|
|
|
|
|
|
|
DELETE
|
|
|
|
|
|
FROM back_apply_info
|
|
|
|
|
|
WHERE id = #{id};
|
|
|
|
|
|
</delete>
|
2024-03-08 17:47:21 +08:00
|
|
|
|
<delete id="delApply">
|
|
|
|
|
|
DELETE
|
|
|
|
|
|
FROM tm_task_agreement
|
|
|
|
|
|
WHERE task_id IN (SELECT task_id FROM back_apply_info WHERE id = #{id});
|
|
|
|
|
|
|
|
|
|
|
|
DELETE
|
|
|
|
|
|
FROM tm_task
|
|
|
|
|
|
WHERE task_id IN (SELECT task_id FROM back_apply_info WHERE id = #{id});
|
|
|
|
|
|
|
|
|
|
|
|
DELETE
|
|
|
|
|
|
FROM back_apply_details
|
|
|
|
|
|
WHERE parent_id IN
|
|
|
|
|
|
(select id FROM back_apply_info
|
|
|
|
|
|
WHERE task_id in (SELECT task_id FROM back_apply_info WHERE id = #{id}));
|
|
|
|
|
|
|
2024-03-08 18:16:36 +08:00
|
|
|
|
DELETE bai1
|
|
|
|
|
|
FROM back_apply_info bai1
|
|
|
|
|
|
JOIN (
|
|
|
|
|
|
SELECT task_id
|
2024-03-08 17:47:21 +08:00
|
|
|
|
FROM back_apply_info
|
2024-03-08 18:16:36 +08:00
|
|
|
|
WHERE id = #{id}) bai2 ON bai1.task_id = bai2.task_id;
|
2024-03-08 17:47:21 +08:00
|
|
|
|
|
|
|
|
|
|
</delete>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getBackApplyList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
bai.id,
|
|
|
|
|
|
bai.`code`,
|
|
|
|
|
|
bai.back_person as backPerson,
|
2024-02-29 19:24:27 +08:00
|
|
|
|
bai.`status` as applyStatus,
|
2023-12-21 20:17:36 +08:00
|
|
|
|
bai.phone,
|
|
|
|
|
|
bpl.lot_id as lotId,
|
|
|
|
|
|
bpl.lot_name as lotName,
|
|
|
|
|
|
bui.unit_id as unitId,
|
|
|
|
|
|
bui.unit_name as unitName,
|
|
|
|
|
|
bai.back_time as backTime,
|
|
|
|
|
|
bagi.agreement_code as agreementCode,
|
|
|
|
|
|
tt.task_status as taskStatus,
|
|
|
|
|
|
tta.agreement_id as agreementId,
|
|
|
|
|
|
GROUP_CONCAT(DISTINCT bad.type_id) as typeId,
|
2025-05-29 13:26:20 +08:00
|
|
|
|
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeName,
|
2024-01-18 15:48:18 +08:00
|
|
|
|
GROUP_CONCAT(bad.status) AS status
|
2023-12-21 20:17:36 +08:00
|
|
|
|
FROM
|
|
|
|
|
|
back_apply_info bai
|
|
|
|
|
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
|
|
|
|
|
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
|
|
|
|
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id=tt.task_id
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id=tta.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bagi.project_id
|
|
|
|
|
|
LEFT JOIN bm_unit_info bui on bui.unit_id=bagi.unit_id
|
|
|
|
|
|
LEFT JOIN sys_user us on us.user_id=bai.create_by
|
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
|
|
|
|
|
|
WHERE
|
2024-05-14 16:44:16 +08:00
|
|
|
|
1=1
|
|
|
|
|
|
<if test="createBy != null and createBy != ''">
|
|
|
|
|
|
and tt.create_by = #{createBy}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="companyId != null and companyId != ''">
|
|
|
|
|
|
and bai.company_id = #{companyId}
|
|
|
|
|
|
</if>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
2024-01-19 14:55:21 +08:00
|
|
|
|
and (bai.`code` like concat('%', #{keyWord}, '%') or
|
2023-12-22 14:13:53 +08:00
|
|
|
|
bai.back_person like concat('%', #{keyWord}, '%') or
|
2024-01-19 14:55:21 +08:00
|
|
|
|
bai.phone like concat('%', #{keyWord}, '%'))
|
2023-12-21 20:17:36 +08:00
|
|
|
|
</if>
|
2023-12-22 00:13:15 +08:00
|
|
|
|
<if test="unitId != null and unitId != ''">
|
|
|
|
|
|
and bui.unit_id = #{unitId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="lotId != null and lotId != ''">
|
|
|
|
|
|
and bpl.lot_id = #{lotId}
|
|
|
|
|
|
</if>
|
2024-01-12 16:05:33 +08:00
|
|
|
|
<if test="proId != null and proId != ''">
|
|
|
|
|
|
and bpl.lot_id = #{proId}
|
|
|
|
|
|
</if>
|
2023-12-22 00:13:15 +08:00
|
|
|
|
<if test="taskStatus != null and taskStatus != ''">
|
|
|
|
|
|
and tt.task_status = #{taskStatus}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="agreementCode != null and agreementCode != ''">
|
|
|
|
|
|
and bagi.agreement_code like concat('%', #{agreementCode}, '%')
|
|
|
|
|
|
</if>
|
2025-04-22 11:00:41 +08:00
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
|
<![CDATA[and DATE_FORMAT( bai.back_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
2023-12-22 11:05:45 +08:00
|
|
|
|
</if>
|
2024-06-27 16:19:49 +08:00
|
|
|
|
<if test="backSource != null and backSource != ''">
|
|
|
|
|
|
and bai.back_source =#{backSource}
|
|
|
|
|
|
</if>
|
2024-02-29 19:24:27 +08:00
|
|
|
|
GROUP BY bai.task_id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
|
2023-12-25 10:48:28 +08:00
|
|
|
|
ORDER BY bai.create_time desc
|
2023-12-21 20:17:36 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getMaterialList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
2023-12-22 14:13:53 +08:00
|
|
|
|
SELECT subquery1.type_id as typeId,
|
|
|
|
|
|
subquery1.typeName typeCode,
|
|
|
|
|
|
subquery1.typeNames as typeName,
|
|
|
|
|
|
subquery1.out_num - COALESCE(subquery2.audit_num, 0) AS num
|
2023-12-21 20:17:36 +08:00
|
|
|
|
FROM (
|
2023-12-22 14:13:53 +08:00
|
|
|
|
-- 第一个查询作为子查询
|
|
|
|
|
|
SELECT mt.type_id,
|
|
|
|
|
|
mt.type_name as typeName,
|
|
|
|
|
|
mt2.type_name AS typeNames,
|
|
|
|
|
|
SUM(lod.out_num) as out_num
|
|
|
|
|
|
FROM lease_apply_info lai
|
|
|
|
|
|
LEFT JOIN tm_task_agreement tta on lai.task_id = tta.task_id
|
|
|
|
|
|
LEFT JOIN lease_out_details lod on lod.parent_id = lai.id
|
|
|
|
|
|
LEFT JOIN tm_task tt on tt.task_id = tta.task_id
|
|
|
|
|
|
LEFT JOIN ma_type mt on lod.type_id=mt.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id = lod.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
|
|
|
|
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
|
|
|
|
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
|
|
|
|
|
WHERE tta.agreement_id = #{agreementId}
|
|
|
|
|
|
and tt.task_type = '29'
|
|
|
|
|
|
and mt.`level`='4'
|
|
|
|
|
|
|
2023-12-22 00:13:15 +08:00
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
2024-01-19 14:55:21 +08:00
|
|
|
|
and (mt.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
|
mt2.type_name like concat('%', #{keyWord}, '%'))
|
2023-12-22 14:13:53 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
GROUP BY mt.type_id
|
|
|
|
|
|
) AS subquery1
|
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
|
(
|
|
|
|
|
|
-- 第二个查询作为子查询
|
|
|
|
|
|
SELECT mt.type_id,
|
|
|
|
|
|
mt.type_name,
|
|
|
|
|
|
mt2.type_name AS typeNames,
|
|
|
|
|
|
SUM(bad.audit_num) as audit_num
|
|
|
|
|
|
FROM back_apply_info bai
|
|
|
|
|
|
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
|
|
|
|
|
|
LEFT JOIN back_apply_details bad on bad.parent_id = bai.id
|
|
|
|
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id = tt.task_id
|
|
|
|
|
|
LEFT JOIN ma_type mt on mt.type_id = bad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
|
|
|
|
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
|
|
|
|
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
|
|
|
|
|
WHERE tta.agreement_id = #{agreementId}
|
|
|
|
|
|
and tt.task_type = '36'
|
|
|
|
|
|
and mt.`level`='4'
|
|
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
2024-01-19 14:55:21 +08:00
|
|
|
|
and (mt.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
|
mt2.type_name like concat('%', #{keyWord}, '%'))
|
2023-12-22 14:13:53 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
GROUP BY mt.type_id
|
|
|
|
|
|
) AS subquery2
|
|
|
|
|
|
ON subquery1.type_id = subquery2.type_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
subquery1.out_num - COALESCE(subquery2.audit_num, 0)>0
|
2023-12-21 20:17:36 +08:00
|
|
|
|
</select>
|
2024-04-20 11:23:08 +08:00
|
|
|
|
<select id="selectTaskNumByMonth" resultType="java.lang.String">
|
|
|
|
|
|
SELECT SUBSTRING(`code`, - 4) as code
|
|
|
|
|
|
FROM tm_task
|
|
|
|
|
|
WHERE DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m')
|
|
|
|
|
|
AND task_type = #{taskType}
|
|
|
|
|
|
ORDER BY create_time DESC LIMIT 1
|
2023-12-21 20:17:36 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getView" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
|
|
|
|
|
SELECT
|
2025-07-11 16:27:40 +08:00
|
|
|
|
bai.id AS id,
|
2023-12-23 22:30:03 +08:00
|
|
|
|
bai.back_person AS backPerson,
|
|
|
|
|
|
bai.phone AS phone,
|
|
|
|
|
|
bai.back_time as backTime,
|
|
|
|
|
|
lot.lot_name AS lotName,
|
|
|
|
|
|
unit.unit_name AS unitName,
|
|
|
|
|
|
mt.type_name typeCode,
|
2024-04-20 10:42:49 +08:00
|
|
|
|
mt.manage_type as manageType,
|
2023-12-23 22:30:03 +08:00
|
|
|
|
mt2.type_name AS typeName,
|
|
|
|
|
|
bagi.agreement_code as agreementCode,
|
2024-04-12 17:18:48 +08:00
|
|
|
|
bad.pre_num AS preNum,
|
2024-04-20 10:42:49 +08:00
|
|
|
|
bad.type_id as typeId,
|
2025-04-11 18:24:51 +08:00
|
|
|
|
bad.audit_num AS num,
|
|
|
|
|
|
mtk.userId as userId
|
2023-12-21 20:17:36 +08:00
|
|
|
|
FROM
|
2023-12-23 22:30:03 +08:00
|
|
|
|
back_apply_details bad
|
|
|
|
|
|
LEFT JOIN back_apply_info bai ON bai.id = bad.parent_id
|
2024-02-29 19:24:27 +08:00
|
|
|
|
LEFT JOIN tm_task tt on bai.task_id = tt.task_id
|
2023-12-23 22:30:03 +08:00
|
|
|
|
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_project_lot lot ON lot.lot_id = bagi.project_id
|
|
|
|
|
|
LEFT JOIN bm_unit_info unit ON unit.unit_id = bagi.unit_id
|
|
|
|
|
|
LEFT JOIN ma_type mt ON mt.type_id = bad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
|
|
|
|
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
|
|
|
|
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
2025-04-11 18:24:51 +08:00
|
|
|
|
LEFT JOIN (
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
type_id as typeId,
|
|
|
|
|
|
GROUP_CONCAT(user_id) as userId
|
|
|
|
|
|
FROM
|
|
|
|
|
|
ma_type_keeper
|
|
|
|
|
|
GROUP BY type_id
|
|
|
|
|
|
) mtk ON mtk.typeId = bad.type_id
|
2023-12-23 22:30:03 +08:00
|
|
|
|
WHERE
|
2024-02-29 19:24:27 +08:00
|
|
|
|
bai.task_id = #{taskId}
|
2024-04-22 10:20:29 +08:00
|
|
|
|
<if test="split != null and split.length > 0">
|
2024-04-10 17:48:09 +08:00
|
|
|
|
and bad.id in
|
2024-04-22 10:20:29 +08:00
|
|
|
|
<foreach item="split" index="index" collection="split" open="(" separator="," close=")">
|
|
|
|
|
|
#{split}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
2024-02-29 19:24:27 +08:00
|
|
|
|
<if test="companyId != null and companyId != ''">
|
|
|
|
|
|
and bai.company_id = #{companyId}
|
|
|
|
|
|
</if>
|
2024-01-19 15:57:05 +08:00
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
|
and (mt2.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
|
mt.type_name like concat('%', #{keyWord}, '%'))
|
|
|
|
|
|
</if>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
</select>
|
2023-12-22 15:57:10 +08:00
|
|
|
|
<select id="getUseTypeTree" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
2024-04-26 17:00:29 +08:00
|
|
|
|
WITH RECURSIVE type_hierarchy AS (-- 基础情况:从第四级开始
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
mt.type_id,
|
|
|
|
|
|
mt.type_name,
|
|
|
|
|
|
mt.parent_id,
|
2024-04-26 17:52:15 +08:00
|
|
|
|
mt.unit_name as unitNames,
|
2024-04-26 17:00:29 +08:00
|
|
|
|
mt.company_id,
|
|
|
|
|
|
SUM( CASE WHEN sai.agreement_id = #{agreementId} AND sai.STATUS = '0' THEN sai.num ELSE 0 END ) AS num,
|
|
|
|
|
|
mt.LEVEL
|
|
|
|
|
|
FROM
|
|
|
|
|
|
ma_type mt
|
|
|
|
|
|
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
EXISTS ( SELECT 1 FROM slt_agreement_info sai2 WHERE sai2.type_id = mt.type_id AND sai2.agreement_id = #{agreementId} AND sai2.STATUS = '0' )
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
mt.type_id UNION ALL-- 递归情况:向上查找父级
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
mt.type_id,
|
|
|
|
|
|
mt.type_name,
|
|
|
|
|
|
mt.parent_id,
|
|
|
|
|
|
mt.unit_name,
|
|
|
|
|
|
mt.company_id,
|
|
|
|
|
|
0 AS num,-- 父级没有直接关联的 num,可以设为0或NULL
|
|
|
|
|
|
mt.LEVEL
|
|
|
|
|
|
FROM
|
|
|
|
|
|
ma_type mt
|
|
|
|
|
|
INNER JOIN type_hierarchy th ON mt.type_id = th.parent_id
|
|
|
|
|
|
) -- 查询结果,包括从第四级到第一级的所有元素
|
2023-12-25 09:59:55 +08:00
|
|
|
|
SELECT
|
2024-04-26 17:00:29 +08:00
|
|
|
|
*
|
2023-12-25 09:59:55 +08:00
|
|
|
|
FROM
|
2024-04-26 17:00:29 +08:00
|
|
|
|
type_hierarchy
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
type_id
|
|
|
|
|
|
ORDER BY
|
|
|
|
|
|
LEVEL ASC;
|
2023-12-22 15:57:10 +08:00
|
|
|
|
</select>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
|
2024-01-08 14:17:38 +08:00
|
|
|
|
<select id="exportList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
bai.`code`,
|
|
|
|
|
|
bai.back_person as backPerson,
|
|
|
|
|
|
bai.phone,
|
|
|
|
|
|
bpl.lot_name as lotName,
|
|
|
|
|
|
bui.unit_name as unitName,
|
|
|
|
|
|
bai.back_time as backTime,
|
|
|
|
|
|
bagi.agreement_code as agreementCode,
|
|
|
|
|
|
tt.task_status as taskStatus,
|
|
|
|
|
|
mt2.type_name AS typeName,
|
|
|
|
|
|
mt1.type_name as typeCode
|
|
|
|
|
|
FROM
|
|
|
|
|
|
back_apply_details bad
|
|
|
|
|
|
LEFT JOIN back_apply_info bai on bad.parent_id=bai.id
|
|
|
|
|
|
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
|
|
|
|
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id=tt.task_id
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id=tta.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bagi.project_id
|
|
|
|
|
|
LEFT JOIN bm_unit_info bui on bui.unit_id=bagi.unit_id
|
|
|
|
|
|
LEFT JOIN sys_user us on us.user_id=bai.create_by
|
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
|
|
|
|
|
|
where
|
|
|
|
|
|
1=1
|
|
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
2024-01-19 14:55:21 +08:00
|
|
|
|
and (bai.`code` like concat('%', #{keyWord}, '%') or
|
2024-01-08 14:17:38 +08:00
|
|
|
|
bai.back_person like concat('%', #{keyWord}, '%') or
|
2024-01-19 14:55:21 +08:00
|
|
|
|
bai.phone like concat('%', #{keyWord}, '%'))
|
2024-01-08 14:17:38 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="unitId != null and unitId != ''">
|
|
|
|
|
|
and bui.unit_id = #{unitId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="lotId != null and lotId != ''">
|
|
|
|
|
|
and bpl.lot_id = #{lotId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="taskStatus != null and taskStatus != ''">
|
|
|
|
|
|
and tt.task_status = #{taskStatus}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="agreementCode != null and agreementCode != ''">
|
|
|
|
|
|
and bagi.agreement_code like concat('%', #{agreementCode}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
|
and bai.back_time >=#{startTime}
|
|
|
|
|
|
and #{endTime} >=bai.back_time
|
|
|
|
|
|
</if>
|
|
|
|
|
|
ORDER BY bai.task_id desc
|
|
|
|
|
|
</select>
|
2024-02-23 17:26:16 +08:00
|
|
|
|
<select id="getBackApplyListByAdmin" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
bai.id,
|
|
|
|
|
|
bai.`code`,
|
2024-02-29 19:24:27 +08:00
|
|
|
|
bai.`status` as applyStatus,
|
2024-02-23 17:26:16 +08:00
|
|
|
|
bai.back_person as backPerson,
|
|
|
|
|
|
bai.phone,
|
2024-02-29 19:24:27 +08:00
|
|
|
|
bai.task_id as taskId,
|
2024-02-23 17:26:16 +08:00
|
|
|
|
bpl.lot_id as lotId,
|
|
|
|
|
|
bpl.lot_name as lotName,
|
|
|
|
|
|
bui.unit_id as unitId,
|
2024-04-25 15:52:01 +08:00
|
|
|
|
bai.remark as remark,
|
2024-02-23 17:26:16 +08:00
|
|
|
|
bui.unit_name as unitName,
|
|
|
|
|
|
bai.back_time as backTime,
|
|
|
|
|
|
bagi.agreement_code as agreementCode,
|
|
|
|
|
|
tt.task_status as taskStatus,
|
|
|
|
|
|
tta.agreement_id as agreementId,
|
|
|
|
|
|
GROUP_CONCAT(bai.company_id) as companyId,
|
2024-04-10 17:48:09 +08:00
|
|
|
|
GROUP_CONCAT(bad.id) as badId,
|
2024-04-20 16:01:30 +08:00
|
|
|
|
GROUP_CONCAT(DISTINCT mt2.type_id) as typeId,
|
2024-02-23 17:26:16 +08:00
|
|
|
|
GROUP_CONCAT(mt2.type_name) AS typeName,
|
|
|
|
|
|
GROUP_CONCAT(bad.status) AS status
|
|
|
|
|
|
FROM
|
|
|
|
|
|
back_apply_info bai
|
|
|
|
|
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
|
|
|
|
|
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
|
|
|
|
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id=tt.task_id
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id=tta.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bagi.project_id
|
|
|
|
|
|
LEFT JOIN bm_unit_info bui on bui.unit_id=bagi.unit_id
|
|
|
|
|
|
LEFT JOIN sys_user us on us.user_id=bai.create_by
|
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
1=1
|
|
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
|
and (bai.`code` like concat('%', #{keyWord}, '%') or
|
|
|
|
|
|
bai.back_person like concat('%', #{keyWord}, '%') or
|
|
|
|
|
|
bai.phone like concat('%', #{keyWord}, '%'))
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="unitId != null and unitId != ''">
|
|
|
|
|
|
and bui.unit_id = #{unitId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="lotId != null and lotId != ''">
|
|
|
|
|
|
and bpl.lot_id = #{lotId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="proId != null and proId != ''">
|
|
|
|
|
|
and bpl.lot_id = #{proId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="taskStatus != null and taskStatus != ''">
|
|
|
|
|
|
and tt.task_status = #{taskStatus}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="agreementCode != null and agreementCode != ''">
|
|
|
|
|
|
and bagi.agreement_code like concat('%', #{agreementCode}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="time != null and time != ''">
|
|
|
|
|
|
and bai.back_time =#{time}
|
|
|
|
|
|
</if>
|
2024-04-20 13:55:53 +08:00
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
|
<![CDATA[AND DATE_FORMAT( bai.back_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
|
|
|
|
|
</if>
|
2024-02-23 17:26:16 +08:00
|
|
|
|
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
|
2024-04-20 16:01:30 +08:00
|
|
|
|
<if test="typeId != null and typeId != ''">
|
|
|
|
|
|
HAVING FIND_IN_SET(#{typeId}, typeId) > 0
|
|
|
|
|
|
</if>
|
2024-02-23 17:26:16 +08:00
|
|
|
|
ORDER BY bai.create_time desc
|
|
|
|
|
|
</select>
|
2024-01-08 14:17:38 +08:00
|
|
|
|
|
2024-02-26 09:03:07 +08:00
|
|
|
|
<select id="getTaskIdById" resultType="java.lang.Integer">
|
|
|
|
|
|
SELECT bai1.status FROM back_apply_info bai1
|
|
|
|
|
|
INNER JOIN
|
|
|
|
|
|
(SELECT * FROM back_apply_info bai2 WHERE bai2.id = #{id}) dd
|
|
|
|
|
|
on bai1.task_id = dd.task_id
|
|
|
|
|
|
</select>
|
2024-02-29 19:24:27 +08:00
|
|
|
|
<select id="getViewByApply" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
|
|
|
|
|
SELECT
|
2024-03-08 17:40:02 +08:00
|
|
|
|
bai.back_person AS backPerson,
|
|
|
|
|
|
bai.phone AS phone,
|
|
|
|
|
|
bai.back_time as backTime,
|
|
|
|
|
|
lot.lot_name AS lotName,
|
|
|
|
|
|
lot.lot_id as proId,
|
|
|
|
|
|
bad.company_id as companyId,
|
|
|
|
|
|
bad.create_by as createBy,
|
|
|
|
|
|
lot.pro_id as projectId,
|
|
|
|
|
|
lot.lot_name as proName,
|
|
|
|
|
|
unit.unit_name AS unitName,
|
|
|
|
|
|
unit.unit_id AS unitId,
|
|
|
|
|
|
mt.type_name typeCode,
|
|
|
|
|
|
mt.type_id as typeId,
|
|
|
|
|
|
mt.unit_name as unitNames,
|
|
|
|
|
|
tt.task_id as taskId,
|
|
|
|
|
|
case WHEN mt.manage_type = '0' then '编号' else '计数' end manageTypeName,
|
|
|
|
|
|
mt2.type_name AS typeName,
|
|
|
|
|
|
bagi.agreement_code as agreementCode,
|
|
|
|
|
|
bagi.agreement_id as agreementId,
|
|
|
|
|
|
bai.`status` as `status`,
|
|
|
|
|
|
bad.id as detailsId,
|
2024-03-26 17:31:06 +08:00
|
|
|
|
bad.pre_num AS num,
|
2024-04-26 17:58:14 +08:00
|
|
|
|
bad.audit_num AS auditNum,
|
2024-06-27 16:19:49 +08:00
|
|
|
|
bad.remark AS remark,
|
2025-04-18 18:23:23 +08:00
|
|
|
|
IFNULL( aa.num, 0 ) AS useNum,
|
|
|
|
|
|
bai.code AS code
|
2024-02-29 19:24:27 +08:00
|
|
|
|
FROM
|
2024-03-08 17:40:02 +08:00
|
|
|
|
back_apply_details bad
|
|
|
|
|
|
LEFT JOIN back_apply_info bai ON bai.id = bad.parent_id
|
|
|
|
|
|
LEFT JOIN tm_task tt on bai.task_id = tt.task_id
|
|
|
|
|
|
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_project_lot lot ON lot.lot_id = bagi.project_id
|
|
|
|
|
|
LEFT JOIN bm_unit_info unit ON unit.unit_id = bagi.unit_id
|
|
|
|
|
|
LEFT JOIN ma_type mt ON mt.type_id = bad.type_id
|
2024-03-26 17:31:06 +08:00
|
|
|
|
LEFT JOIN (
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
SUM( sai.num ) AS num, sai.type_id FROM slt_agreement_info sai
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
sai.`status` = '0'
|
|
|
|
|
|
<if test = "agreementId!=null and agreementId!=''" >
|
|
|
|
|
|
AND sai.agreement_id = #{agreementId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
GROUP BY sai.type_id
|
|
|
|
|
|
) aa ON aa.type_id = mt.type_id
|
2024-03-08 17:40:02 +08:00
|
|
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
|
|
|
|
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
|
|
|
|
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
2024-02-29 19:24:27 +08:00
|
|
|
|
WHERE
|
2024-03-08 17:40:02 +08:00
|
|
|
|
bai.task_id in (SELECT task_id from back_apply_info WHERE id = #{id})
|
2024-02-29 19:24:27 +08:00
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
|
and (mt2.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
|
mt.type_name like concat('%', #{keyWord}, '%'))
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getBackApplyListByAdmin1" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
bai.id,
|
|
|
|
|
|
bai.`code`,
|
|
|
|
|
|
bai.`status` as applyStatus,
|
|
|
|
|
|
bai.back_person as backPerson,
|
|
|
|
|
|
bai.phone,
|
|
|
|
|
|
bai.task_id as taskId,
|
|
|
|
|
|
bpl.lot_id as lotId,
|
2024-04-25 15:52:01 +08:00
|
|
|
|
bai.remark as remark,
|
2024-02-29 19:24:27 +08:00
|
|
|
|
bpl.lot_name as lotName,
|
|
|
|
|
|
bui.unit_id as unitId,
|
|
|
|
|
|
bui.unit_name as unitName,
|
2025-01-14 15:32:36 +08:00
|
|
|
|
bai.create_time as backTime,
|
2024-02-29 19:24:27 +08:00
|
|
|
|
bagi.agreement_code as agreementCode,
|
|
|
|
|
|
tt.task_status as taskStatus,
|
|
|
|
|
|
tta.agreement_id as agreementId,
|
2024-06-27 16:19:49 +08:00
|
|
|
|
tt1.code as forecastWasteCode,
|
2024-02-29 19:24:27 +08:00
|
|
|
|
GROUP_CONCAT(bai.company_id) as companyId,
|
2024-04-10 17:48:09 +08:00
|
|
|
|
GROUP_CONCAT(DISTINCT mt2.type_id) as typeId,
|
2025-05-29 13:26:20 +08:00
|
|
|
|
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeName,
|
2024-02-29 19:24:27 +08:00
|
|
|
|
GROUP_CONCAT(bad.status) AS status
|
|
|
|
|
|
FROM
|
|
|
|
|
|
back_apply_info bai
|
|
|
|
|
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
|
|
|
|
|
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
|
|
|
|
|
|
LEFT JOIN tm_task_agreement tta on tta.task_id=tt.task_id
|
|
|
|
|
|
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id=tta.agreement_id
|
|
|
|
|
|
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bagi.project_id
|
|
|
|
|
|
LEFT JOIN bm_unit_info bui on bui.unit_id=bagi.unit_id
|
|
|
|
|
|
LEFT JOIN sys_user us on us.user_id=bai.create_by
|
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt1.type_id=bad.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
|
2024-06-27 16:19:49 +08:00
|
|
|
|
LEFT JOIN tm_task tt1 on tt1.task_id = bai.parent_id
|
2024-02-29 19:24:27 +08:00
|
|
|
|
WHERE
|
|
|
|
|
|
1=1
|
|
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
|
and (bai.`code` like concat('%', #{keyWord}, '%') or
|
|
|
|
|
|
bai.back_person like concat('%', #{keyWord}, '%') or
|
|
|
|
|
|
bai.phone like concat('%', #{keyWord}, '%'))
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="unitId != null and unitId != ''">
|
|
|
|
|
|
and bui.unit_id = #{unitId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="lotId != null and lotId != ''">
|
|
|
|
|
|
and bpl.lot_id = #{lotId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="proId != null and proId != ''">
|
|
|
|
|
|
and bpl.lot_id = #{proId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="taskStatus != null and taskStatus != ''">
|
|
|
|
|
|
and tt.task_status = #{taskStatus}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="agreementCode != null and agreementCode != ''">
|
|
|
|
|
|
and bagi.agreement_code like concat('%', #{agreementCode}, '%')
|
|
|
|
|
|
</if>
|
2025-04-22 11:00:41 +08:00
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
|
<![CDATA[and DATE_FORMAT( bai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
2024-02-29 19:24:27 +08:00
|
|
|
|
</if>
|
2024-06-27 16:19:49 +08:00
|
|
|
|
<if test="backSource != null and backSource != ''">
|
|
|
|
|
|
and bai.back_source =#{backSource}
|
|
|
|
|
|
</if>
|
2024-02-29 19:24:27 +08:00
|
|
|
|
GROUP BY bai.task_id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
|
2024-04-10 17:48:09 +08:00
|
|
|
|
<if test="typeId != null and typeId != ''">
|
|
|
|
|
|
HAVING FIND_IN_SET(#{typeId}, typeId) > 0
|
|
|
|
|
|
</if>
|
2024-02-29 19:24:27 +08:00
|
|
|
|
ORDER BY bai.create_time desc
|
|
|
|
|
|
</select>
|
2024-03-19 17:05:14 +08:00
|
|
|
|
<select id="selectIdByTaskId" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
|
|
|
|
|
select * from back_apply_info where task_id = #{taskId}
|
|
|
|
|
|
</select>
|
2024-04-11 18:00:57 +08:00
|
|
|
|
<select id="getUseNumByTypeId" resultType="java.lang.Integer">
|
|
|
|
|
|
select count(*) as useNum from ma_machine where type_id = #{typeId} and ma_status in (16,84)
|
|
|
|
|
|
</select>
|
2024-04-15 16:03:44 +08:00
|
|
|
|
<select id="getManageType" resultType="java.lang.Integer">
|
|
|
|
|
|
select mt.manage_type AS manageType FROM ma_type mt WHERE mt.type_id = #{typeId}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getLeaseOutNum" resultType="java.lang.Integer">
|
2024-04-20 10:42:49 +08:00
|
|
|
|
SELECT IFNULL(sum(lod.out_num),0) FROM lease_out_details lod WHERE lod.type_id = #{typeId}
|
2024-04-15 16:03:44 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getbackCheckNum" resultType="java.lang.Integer">
|
2024-04-20 10:42:49 +08:00
|
|
|
|
SELECT IFNULL(sum(bcd.back_num),0) FROM back_check_details bcd WHERE bcd.type_id = #{typeId}
|
2024-04-15 16:03:44 +08:00
|
|
|
|
</select>
|
2024-04-22 10:20:29 +08:00
|
|
|
|
<select id="getTaskIdByIdAll" resultType="java.lang.Integer">
|
|
|
|
|
|
SELECT bai1.status FROM back_apply_info bai1
|
|
|
|
|
|
INNER JOIN
|
|
|
|
|
|
(SELECT * FROM back_apply_info bai2 WHERE bai2.id = #{id}) dd
|
|
|
|
|
|
on bai1.task_id = dd.task_id
|
|
|
|
|
|
</select>
|
2024-06-27 16:19:49 +08:00
|
|
|
|
<select id="getBackApplyInfoById" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
|
|
|
|
|
select * from back_apply_info where id = #{parentId}
|
|
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getBackApplyDetailsByParentId" resultType="com.bonus.sgzb.material.domain.po.BackApplyDetailsPo">
|
|
|
|
|
|
select * from back_apply_details
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="parentId != null and parentId != ''">
|
|
|
|
|
|
and parent_id = #{parentId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="typeId != null and typeId != ''">
|
|
|
|
|
|
and type_id = #{typeId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</select>
|
2024-02-26 09:03:07 +08:00
|
|
|
|
|
2025-03-03 13:41:33 +08:00
|
|
|
|
<select id="getBackApplyDetailsTypeCount" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
2025-07-11 16:27:40 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
bcd.type_id AS typeId,
|
|
|
|
|
|
sum( bcd.back_num ) AS backNum
|
|
|
|
|
|
FROM
|
|
|
|
|
|
back_check_details bcd
|
|
|
|
|
|
LEFT JOIN back_apply_info bai ON bai.id = bcd.parent_id
|
|
|
|
|
|
LEFT JOIN tm_task tt ON bai.task_id = tt.task_id
|
|
|
|
|
|
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
tta.agreement_id = #{agreementId}
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
|
bcd.type_id
|
2025-03-03 13:41:33 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getLeaseApplyDetailsTypeCount" resultType="com.bonus.sgzb.material.domain.LeaseApplyDetails">
|
2025-03-19 10:40:56 +08:00
|
|
|
|
select lad.type_id as typeId, IFNULL(sum(lad.al_num),0) as alNum
|
2025-03-03 13:41:33 +08:00
|
|
|
|
from lease_apply_details lad
|
|
|
|
|
|
LEFT join lease_apply_info lai on lai.id = lad.parennt_id
|
|
|
|
|
|
LEFT join tm_task tt on lai.task_id = tt.task_id
|
|
|
|
|
|
LEFT join tm_task_agreement tta on tta.task_id = tt.task_id
|
|
|
|
|
|
where tta.agreement_id = #{agreementId} and lad.`status` = '2'
|
|
|
|
|
|
group by lad.type_id
|
|
|
|
|
|
</select>
|
2025-03-19 10:40:56 +08:00
|
|
|
|
<select id="getTypeName" resultType="java.lang.String">
|
|
|
|
|
|
select concat(mt2.type_name,'/',mt.type_name) as typeName
|
|
|
|
|
|
from ma_type mt
|
|
|
|
|
|
left join ma_type mt2 on mt2.type_id = mt.parent_id
|
|
|
|
|
|
where mt.type_id = #{typeId}
|
|
|
|
|
|
</select>
|
2025-03-20 14:47:36 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getUseTypeTreeL4" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
mt.type_id,
|
|
|
|
|
|
mt.type_name,
|
|
|
|
|
|
mt.parent_id,
|
|
|
|
|
|
mt.unit_name as unitNames,
|
|
|
|
|
|
mt.company_id,
|
|
|
|
|
|
SUM( CASE WHEN sai.agreement_id = #{agreementId} AND sai.STATUS = '0' THEN sai.num ELSE 0 END ) AS num,
|
|
|
|
|
|
mt.LEVEL
|
|
|
|
|
|
FROM
|
|
|
|
|
|
ma_type mt
|
|
|
|
|
|
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
EXISTS ( SELECT 1 FROM slt_agreement_info sai2 WHERE sai2.type_id = mt.type_id AND sai2.agreement_id = #{agreementId}
|
2025-05-20 15:34:19 +08:00
|
|
|
|
AND sai2.STATUS = '0' and sai2.num > 0 and sai2.end_time IS NULL)
|
2025-03-20 14:47:36 +08:00
|
|
|
|
GROUP BY
|
|
|
|
|
|
mt.type_id
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getUseTypeTreeL3" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
mt3.type_id,
|
|
|
|
|
|
mt3.type_name,
|
|
|
|
|
|
mt3.parent_id,
|
|
|
|
|
|
mt3.unit_name,
|
|
|
|
|
|
mt3.company_id,
|
|
|
|
|
|
0 AS num,
|
|
|
|
|
|
mt3.LEVEL
|
|
|
|
|
|
FROM
|
|
|
|
|
|
ma_type mt3 where type_id in
|
|
|
|
|
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getUseTypeTreeL21" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
mt2.type_id,
|
|
|
|
|
|
mt2.type_name,
|
|
|
|
|
|
mt2.parent_id,
|
|
|
|
|
|
mt2.unit_name,
|
|
|
|
|
|
mt2.company_id,
|
|
|
|
|
|
0 AS num,
|
|
|
|
|
|
mt2.LEVEL
|
|
|
|
|
|
FROM
|
|
|
|
|
|
ma_type mt2 where type_id in
|
|
|
|
|
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
|
|
|
|
union
|
|
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
mt1.type_id,
|
|
|
|
|
|
mt1.type_name,
|
|
|
|
|
|
mt1.parent_id,
|
|
|
|
|
|
mt1.unit_name,
|
|
|
|
|
|
mt1.company_id,
|
|
|
|
|
|
0 AS num,
|
|
|
|
|
|
mt1.LEVEL
|
|
|
|
|
|
FROM
|
|
|
|
|
|
ma_type mt1 left join (
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
mt2.type_id,
|
|
|
|
|
|
mt2.type_name,
|
|
|
|
|
|
mt2.parent_id,
|
|
|
|
|
|
mt2.unit_name,
|
|
|
|
|
|
mt2.company_id,
|
|
|
|
|
|
0 AS num,
|
|
|
|
|
|
mt2.LEVEL
|
|
|
|
|
|
FROM
|
|
|
|
|
|
ma_type mt2) mt2 on mt2.parent_id=mt1.type_id where mt2.type_id in
|
|
|
|
|
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</select>
|
2025-07-11 16:27:40 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="getList" resultType="com.bonus.sgzb.material.domain.BackApplyInfo">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
bai.id,
|
|
|
|
|
|
bai.task_id AS taskId,
|
|
|
|
|
|
bcd.type_id AS typeId,
|
|
|
|
|
|
SUM(bcd.back_num) AS num,
|
|
|
|
|
|
bcd.parent_id AS parentId,
|
|
|
|
|
|
bcd.create_by AS createBy,
|
|
|
|
|
|
mt2.type_name AS typeName,
|
|
|
|
|
|
mt.type_name AS typeCode
|
|
|
|
|
|
FROM
|
|
|
|
|
|
back_check_details bcd
|
|
|
|
|
|
LEFT JOIN back_apply_info bai ON bai.id = bcd.parent_id
|
|
|
|
|
|
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
|
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
bcd.is_finished = 1
|
|
|
|
|
|
and bcd.parent_id = #{id}
|
|
|
|
|
|
and bcd.type_id = #{typeId}
|
|
|
|
|
|
GROUP By bcd.type_id
|
|
|
|
|
|
</select>
|
2023-12-21 20:17:36 +08:00
|
|
|
|
</mapper>
|