forked from gzzfw/backEnd/gz-dyh

wangwh
2024-09-22 55a6ee00c9bb89556a1ba53a3a763fa20230e030
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseSuperviseMapper.xml
@@ -14,6 +14,8 @@
            <result property="id" column="id"/>
            <result property="caseId" column="case_id"/>
            <result property="supContent" column="sup_content"/>
            <result property="supUnitId" column="sup_unit_id"/>
            <result property="supUnitName" column="sup_unit_name"/>
            <result property="supUserId" column="sup_user_id"/>
            <result property="supUserName" column="sup_user_name"/>
            <result property="supTime" column="sup_time"/>
@@ -37,6 +39,8 @@
        id,
        case_id,
        sup_content,
        sup_unit_id,
        sup_unit_name,
        sup_user_id,
        sup_user_name,
        sup_time,
@@ -57,6 +61,8 @@
    <sql id="set-part">
            <if test="entity.caseId != null">case_id = #{entity.caseId},</if>
            <if test="entity.supContent != null">sup_content = #{entity.supContent},</if>
            <if test="entity.supUnitId != null">sup_unit_id = #{entity.supUnitId},</if>
            <if test="entity.supUnitName != null">sup_unit_name = #{entity.supUnitName},</if>
            <if test="entity.supUserId != null">sup_user_id = #{entity.supUserId},</if>
            <if test="entity.supUserName != null">sup_user_name = #{entity.supUserName},</if>
            <if test="entity.supTime != null">sup_time = #{entity.supTime},</if>
@@ -85,6 +91,12 @@
                </if>
                <if test="terms.supContent != null and terms.supContent !=''">
                    and sup_content = #{terms.supContent}
                </if>
                <if test="terms.supUnitId != null and terms.supUnitId !=''">
                    and sup_unit_id = #{terms.supUnitId}
                </if>
                <if test="terms.supUnitName != null and terms.supUnitName !=''">
                    and sup_unit_name = #{terms.supUnitName}
                </if>
                <if test="terms.supUserId != null and terms.supUserId !=''">
                    and sup_user_id = #{terms.supUserId}
@@ -214,10 +226,12 @@
        COUNT(1)
        from
        <include refid="table-name" />
        where case_id = #{caseId}
        and delete_status = '0'
        and sup_status = #{supStatus}
        and quilt_unit_id = #{quiltUnitId}
        where case_id = #{terms.caseId}
        and delete_status = 0
        <if test="terms.type == 1">
            and sup_status = #{terms.supStatus}
            and quilt_unit_id = #{terms.quiltUnitId}
        </if>
    </select>
    <!--  根据条件分页查询  -->
@@ -226,10 +240,12 @@
        <include refid="column-part"/>
        FROM
        <include refid="table-name" />
        where case_id = #{caseId}
        and delete_status = '0'
        and sup_status = #{supStatus}
        and quilt_unit_id = #{quiltUnitId}
        where case_id = #{terms.caseId}
        and delete_status = 0
        <if test="terms.type == 1">
            and sup_status = #{terms.supStatus}
            and quilt_unit_id = #{terms.quiltUnitId}
        </if>
        <if test="page.sort != null">
            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
                isnull(${s.property}), ${s.property} ${s.direction}
@@ -240,4 +256,94 @@
        </if>
        limit #{page.offset}, #{page.size}
    </select>
    <!-- 首页-待办理结果集 -->
    <resultMap id="MyTaskApplyReviewResult" type="cn.huge.module.cases.domain.dto.FrontPageListDTO">
        <result property="ownerId" column="ownerId"/>
        <result property="caseId" column="caseId"/>
        <result property="turnaroundTime" column="turnaroundTime"/>
        <result property="timeLimit" column="timeLimit"/>
        <result property="caseGrade" column="caseGrade"/>
        <result property="caseSource" column="caseSource"/>
        <result property="caseType" column="caseType"/>
        <result property="plaintiffs" column="plaintiffs"/>
        <result property="defendants" column="defendants"/>
        <result property="processingDays" column="processingDays"/>
        <result property="mediResult" column="mediResult"/>
        <result property="organizingUnit" column="organizingUnit"/>
        <result property="cooperatingUnit" column="cooperatingUnit"/>
        <result property="manager" column="manager"/>
        <result property="mediResult" column="mediResult"/>
        <result property="backUnit" column="backUnit"/>
        <result property="reason" column="reason"/>
        <result property="opinion" column="opinion"/>
        <result property="process" column="process"/>
    </resultMap>
    <!--  首页督办条件统计  -->
    <select id="countMyTaskDb" resultType="java.lang.Long">
        select
        COUNT(1)
        from
            dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id
        where
        t1.delete_status = 0
        and t1.sup_status = #{terms.supStatus}
        and t1.quilt_unit_id = #{terms.quiltUnitId}
        <if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
            and (DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat(t2.plaintiffs, t2.pagents, t2.defendants, t2.dagents) like concat('%', #{terms.partyName}, '%')
        </if>
    </select>
    <!--  首页督办分页查询  -->
    <select id="pageMyTaskDb" resultMap="MyTaskApplyReviewResult">
        SELECT t1.id as ownerId, t1.case_id as caseId,
        t1.sup_time as turnaroundTime, DATEADD(hour, t1.reply_term, t1.sup_time) as timeLimit, t1.sup_unit_name as organizingUnit,
        t1.sup_content as opinion, t2.case_level as caseGrade, t2.canal_name as caseSource,
        concat(t2.case_type_first_name, '/' ,t2.case_type_name) as caseType, concat(t2.plaintiffs, t2.pagents) as plaintiffs,
        concat(t2.defendants, t2.dagents) as defendants
        FROM
        dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id
        where
        t1.delete_status = 0
        <if test="terms.type != 3">
            and t1.quilt_unit_id = #{terms.quiltUnitId}
            and t1.sup_status = #{terms.supStatus}
        </if>
        <if test="terms.type == 3">
            and t1.sup_unit_id = #{terms.supUnitId}
        </if>
        <if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
            and (DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat(t2.plaintiffs, t2.pagents, t2.defendants, t2.dagents) like concat('%', #{terms.partyName}, '%')
        </if>
        <if test="page.sort != null">
            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
                isnull(${s.property}), ${s.property} ${s.direction}
            </foreach>
        </if>
        <if test="page.sort == null">
            order by isnull(sup_time), sup_time desc
        </if>
        limit #{page.offset}, #{page.size}
    </select>
    <!--  根据条件统计  -->
    <select id="countCaseSuperviseList" resultType="java.lang.Long">
        select
        COUNT(1)
        from
        <include refid="table-name" />
        where
        delete_status = 0
        and sup_status = #{supStatus}
        and quilt_unit_id = #{quiltUnitId}
    </select>
</mapper>