forked from gzzfw/backEnd/gz-dyh

zhouxiantao
2024-09-08 d8a4d842d57c183322324f324396c33df7265479
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
@@ -79,8 +79,26 @@
            <result property="createTime" column="create_time"/>
            <result property="updateTime" column="update_time"/>
    </resultMap>
    <resultMap id="dataResult-all" type="cn.huge.module.cases.domain.dto.CasePageDTO">
    </resultMap>
    <!-- 表 -->
    <sql id='table-name'>dyh_case_info</sql>
    <sql id="column-part-all">
        a.id,
        a.status,
        a.status_name,
        a.canal,
        a.canal_name,
        a.case_level,
        a.case_type,
        a.case_type_name,
        a.input_unit_id,
        a.input_unit_name,
        b.medi_result_name,
        b.mediate_dept_id,
        b.mediate_dept_name
    </sql>
    <!-- 字段 -->
    <sql id="column-part">
        id,
@@ -219,6 +237,38 @@
            <if test="entity.custId != null">cust_id = #{entity.custId},</if>
            <if test="entity.createTime != null">create_time = #{entity.createTime},</if>
            <if test="entity.updateTime != null">update_time = #{entity.updateTime}</if>
    </sql>
    <!-- 条件 -->
    <sql id="where-part-all">
        <if test="terms != null">
            <if test="terms.status != null and terms.status !=''">
                and a.status = #{terms.status}
            </if>
            <if test="terms.statusName != null and terms.statusName !=''">
                and a.status_name = #{terms.statusName}
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and a.canal = #{terms.canal}
            </if>
            <if test="terms.canalName != null and terms.canalName !=''">
                and a.canal_name = #{terms.canalName}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and a.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and a.case_type = #{terms.caseType}
            </if>
            <if test="terms.caseTypeName != null and terms.caseTypeName !=''">
                and a.case_type_name = #{terms.caseTypeName}
            </if>
            <if test="terms.inputUnitId != null and terms.inputUnitId !=''">
                and a.input_unit_id = #{terms.inputUnitId}
            </if>
            <if test="terms.inputUnitName != null and terms.inputUnitName !=''">
                and a.input_unit_name = #{terms.inputUnitName}
            </if>
        </if>
    </sql>
    <!-- 条件 -->
    <sql id="where-part">
@@ -512,4 +562,30 @@
    </select>
    <!--  根据条件统计  -->
    <select id="countTermsAll" resultType="java.lang.Long">
        select
        COUNT(1)
        from
        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.case_id
        <include refid="where-part-all"/>
    </select>
    <!--  根据条件分页查询  -->
    <select id="pageTermsAll" resultMap="dataResult-all">
        SELECT
        <include refid="column-part-all"/>
        FROM
        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.case_id
        <include refid="where-part-all"/>
        <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(a.create_time), a.create_time desc
        </if>
        limit #{page.offset}, #{page.size}
    </select>
</mapper>