linwe
2023-11-09 f9a3f18dc49f4d1317b8cb4f04d53d268bd90bbf
src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml
@@ -17,25 +17,40 @@
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <select id="selectTaskReportForRepairsPage" resultMap="taskReportForRepairsResultMap">
        select * from jczz_task_report_for_repairs where is_deleted = 0
    <!--自定义分页查询-->
    <select id="selectTaskReportForRepairsPage" resultType="org.springblade.modules.task.vo.TaskReportForRepairsVO">
        select
        jtrfr.*,
        jda.address_name as addressName
        from jczz_task_report_for_repairs jtrfr
        left join jczz_doorplate_address jda on jda.address_code = jtrfr.address_code
        where jtrfr.is_deleted = 0
        <if test="vo.createUser != null and vo.createUser != ''">
            AND create_user = #{vo.createUser}
            AND jtrfr.create_user = #{vo.createUser}
        </if>
        <if test="vo.type != null and vo.type != ''">
            AND type = #{vo.type}
        <if test="vo.type != null">
            AND jtrfr.type = #{vo.type}
        </if>
        ORDER BY create_time DESC
        <if test="vo.realName != null and vo.realName != ''">
            AND jtrfr.real_name like concat('%',#{vo.realName},'%')
        </if>
        <if test="vo.phone != null and vo.phone != ''">
            AND jtrfr.phone like concat('%',#{vo.phone},'%')
        </if>
        <if test="vo.confirmFlag != null">
            AND jtrfr.confirm_flag = #{vo.confirmFlag}
        </if>
        ORDER BY jtrfr.create_time DESC
    </select>
    <select id="getStatisticsCount" resultType="org.springblade.modules.task.vo.TaskReportStatistics">
        SELECT
            COUNT( 1 ) AS total,
            SUM( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END ) AS handle
        FROM
            jczz_task_report_for_repairs
        WHERE
            is_deleted = 0
            ifnull(SUM( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END ),0) AS handle
        FROM jczz_task_report_for_repairs
        WHERE is_deleted = 0
        <if test="userId != null">
            and create_user = #{userId}
        </if>
    </select>