493 lines
16 KiB
XML
493 lines
16 KiB
XML
|
|
<?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.app.mapper.BackApplyAppMapper">
|
||
|
|
<resultMap id="BaseResultMap" type="com.bonus.sgzb.app.domain.BmAgreementInfo">
|
||
|
|
<!--@mbg.generated-->
|
||
|
|
<!--@Table bm_agreement_info-->
|
||
|
|
<id column="agreement_id" jdbcType="INTEGER" property="agreementId" />
|
||
|
|
<result column="agreement_code" jdbcType="VARCHAR" property="agreementCode" />
|
||
|
|
<result column="sign_time" jdbcType="VARCHAR" property="signTime" />
|
||
|
|
<result column="unit_id" jdbcType="INTEGER" property="unitId" />
|
||
|
|
<result column="project_id" jdbcType="INTEGER" property="projectId" />
|
||
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||
|
|
<result column="lease_day" jdbcType="INTEGER" property="leaseDay" />
|
||
|
|
<result column="plan_start_time" jdbcType="TIMESTAMP" property="planStartTime" />
|
||
|
|
<result column="contract_code" jdbcType="VARCHAR" property="contractCode" />
|
||
|
|
<result column="auth_person" jdbcType="VARCHAR" property="authPerson" />
|
||
|
|
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
||
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||
|
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||
|
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||
|
|
<result column="company_id" jdbcType="INTEGER" property="companyId" />
|
||
|
|
<result column="unit_id" jdbcType="INTEGER" property="unitId" />
|
||
|
|
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
|
||
|
|
<result column="lot_id" jdbcType="INTEGER" property="lotId" />
|
||
|
|
<result column="lot_name" jdbcType="VARCHAR" property="lotName" />
|
||
|
|
|
||
|
|
</resultMap>
|
||
|
|
<insert id="insertTask" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.app.domain.TmTask" useGeneratedKeys="true">
|
||
|
|
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>
|
||
|
|
create_time
|
||
|
|
) values (
|
||
|
|
<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>
|
||
|
|
NOW()
|
||
|
|
)
|
||
|
|
</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">
|
||
|
|
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>
|
||
|
|
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>
|
||
|
|
NOW()
|
||
|
|
)
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<insert id="upload">
|
||
|
|
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>
|
||
|
|
<if test="createBy != null and createBy != ''">
|
||
|
|
update_by,
|
||
|
|
</if>
|
||
|
|
update_time,
|
||
|
|
<if test="remark != null and remark != ''">
|
||
|
|
remark,
|
||
|
|
</if>
|
||
|
|
<if test="companyId != null">
|
||
|
|
company_id,
|
||
|
|
</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>
|
||
|
|
<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>
|
||
|
|
<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
|
||
|
|
SET tt.task_status = '38',bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.direct_audit_time=NOW()
|
||
|
|
WHERE
|
||
|
|
bai.id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="refuse">
|
||
|
|
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
|
||
|
|
<if test="taskStatus == 108">
|
||
|
|
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='6',bai.direct_audit_time=NOW()
|
||
|
|
</if>
|
||
|
|
<if test="taskStatus == 110">
|
||
|
|
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='8',bai.direct_audit_time=NOW()
|
||
|
|
</if>
|
||
|
|
<if test="taskStatus == 104">
|
||
|
|
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='2',bai.direct_audit_time=NOW()
|
||
|
|
</if>
|
||
|
|
<if test="taskStatus == 106">
|
||
|
|
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='4',bai.direct_audit_time=NOW()
|
||
|
|
</if>
|
||
|
|
WHERE
|
||
|
|
bai.id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="del">
|
||
|
|
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 id = #{id});
|
||
|
|
|
||
|
|
DELETE
|
||
|
|
FROM back_apply_info
|
||
|
|
WHERE id = #{id};
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<select id="getbackUnit" resultType="com.bonus.sgzb.app.domain.BmAgreementInfo">
|
||
|
|
SELECT bui.unit_id,
|
||
|
|
bui.unit_name,
|
||
|
|
bai.agreement_id,
|
||
|
|
bai.agreement_code,
|
||
|
|
bpl.lot_id,
|
||
|
|
bpl.lot_name
|
||
|
|
FROM bm_unit_info bui
|
||
|
|
LEFT JOIN bm_unit_person bup on bup.unit_id = bui.unit_id
|
||
|
|
LEFT JOIN bm_agreement_info bai on bai.unit_id=bui.unit_id
|
||
|
|
LEFT JOIN bm_project_lot bpl on bpl.lot_id=bai.project_id
|
||
|
|
WHERE bup.user_id = #{userId}
|
||
|
|
and bui.del_flag = '0'
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getbackPro" resultType="com.bonus.sgzb.app.domain.BmAgreementInfo">
|
||
|
|
SELECT
|
||
|
|
bpl.lot_id,
|
||
|
|
bpl.lot_name
|
||
|
|
FROM
|
||
|
|
bm_unit_info bui
|
||
|
|
LEFT JOIN bm_agreement_info bai ON bai.unit_id = bui.unit_id
|
||
|
|
LEFT JOIN bm_project_lot bpl on bai.project_id=bpl.lot_id
|
||
|
|
WHERE
|
||
|
|
bui.unit_id=#{unitId}
|
||
|
|
and bui.del_flag='0'
|
||
|
|
</select>
|
||
|
|
<select id="getbackList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||
|
|
SELECT
|
||
|
|
bai.id,
|
||
|
|
bai.`code`,
|
||
|
|
bai.back_person as backPerson,
|
||
|
|
bai.phone,
|
||
|
|
bpl.lot_id,
|
||
|
|
bpl.lot_name as lotName,
|
||
|
|
bui.unit_id as unitId,
|
||
|
|
bui.unit_name as unitName,
|
||
|
|
bai.back_time as backTime,
|
||
|
|
tt.task_status as taskStatus,
|
||
|
|
tta.agreement_id as agreementId,
|
||
|
|
GROUP_CONCAT(DISTINCT bad.type_id) as typeId,
|
||
|
|
GROUP_CONCAT(CONCAT_WS('/', IFNULL(mt2.type_name, ''))) AS typeName
|
||
|
|
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
|
||
|
|
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
|
||
|
|
ORDER BY bai.create_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="materialList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||
|
|
SELECT subquery1.type_id as typeId,subquery1.company_id as companyId,
|
||
|
|
subquery1.typeName typeCode,
|
||
|
|
subquery1.typeNames as typeName,
|
||
|
|
subquery1.out_num - COALESCE(subquery2.audit_num, 0) AS num
|
||
|
|
FROM (
|
||
|
|
-- 第一个查询作为子查询
|
||
|
|
SELECT mt.type_id,mt.company_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
|
||
|
|
WHERE tta.agreement_id = #{agreementId}
|
||
|
|
and tt.task_type = '29'
|
||
|
|
and mt.`level`='4'
|
||
|
|
<if test="keyWord != null and keyWord != ''">
|
||
|
|
and (mt.type_name like concat('%', #{keyWord}, '%') or
|
||
|
|
mt2.type_name like concat('%', #{keyWord}, '%'))
|
||
|
|
</if>
|
||
|
|
GROUP BY mt.type_id
|
||
|
|
) AS subquery1
|
||
|
|
LEFT JOIN
|
||
|
|
(
|
||
|
|
-- 第二个查询作为子查询
|
||
|
|
SELECT mt.type_id,mt.company_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
|
||
|
|
WHERE tta.agreement_id = #{agreementId}
|
||
|
|
and tt.task_type = '36'
|
||
|
|
and mt.`level`='4'
|
||
|
|
<if test="keyWord != null and keyWord != ''">
|
||
|
|
and (mt.type_name like concat('%', #{keyWord}, '%') or
|
||
|
|
mt2.type_name like concat('%', #{keyWord}, '%'))
|
||
|
|
</if>
|
||
|
|
GROUP BY mt.type_id
|
||
|
|
) AS subquery2
|
||
|
|
ON subquery1.type_id = subquery2.type_id
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="view" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||
|
|
SELECT
|
||
|
|
mt.type_name typeCode,
|
||
|
|
CONCAT_WS('/', IFNULL(mt2.type_name, '')) AS typeName,
|
||
|
|
bad.pre_num as num
|
||
|
|
FROM
|
||
|
|
back_apply_details bad
|
||
|
|
LEFT JOIN back_apply_info bai on bai.id=bad.parent_id
|
||
|
|
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
|
||
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt.parent_id
|
||
|
|
WHERE
|
||
|
|
bai.id=#{id}
|
||
|
|
</select>
|
||
|
|
<select id="examineList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||
|
|
SELECT
|
||
|
|
bai.id,
|
||
|
|
bai.back_person as backPerson,
|
||
|
|
bai.phone,
|
||
|
|
bpl.lot_name as lotName,
|
||
|
|
bui.unit_name as unitName,
|
||
|
|
bai.back_time as backTime,
|
||
|
|
bagi.plan_start_time as planStartTime,
|
||
|
|
tt.task_status as taskStatus,
|
||
|
|
GROUP_CONCAT(DISTINCT bad.type_id) as typeId,
|
||
|
|
GROUP_CONCAT(CONCAT_WS('/', IFNULL(mt2.type_name, ''))) AS typeName,
|
||
|
|
SUM(DISTINCT bad.pre_num) AS num,
|
||
|
|
bai.direct_audit_remark as directAuditRemark
|
||
|
|
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
|
||
|
|
bad.type_id is not null
|
||
|
|
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
|
||
|
|
ORDER BY bai.create_time desc
|
||
|
|
</select>
|
||
|
|
<select id="examineView" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||
|
|
SELECT
|
||
|
|
mt.type_name typeCode,
|
||
|
|
CONCAT_WS('/', IFNULL(mt2.type_name, '')) AS typeName,
|
||
|
|
bad.pre_num as num
|
||
|
|
FROM
|
||
|
|
back_apply_details bad
|
||
|
|
LEFT JOIN back_apply_info bai on bai.id=bad.parent_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
|
||
|
|
WHERE
|
||
|
|
bai.id=#{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
</mapper>
|