ZQN
2024-06-21 cdb4df5b86eefa7c36e4746b7fc00d7d15b52ce6
project-enforce/src/main/resources/mapper/enforce/EnforceOrderMapper.xml
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.project.enforce.mapper.EnforceOrderMapper">
    <resultMap type="EnforceOrder" id="EnforceOrderResult">
    <resultMap type="EnforceOrderVo" id="EnforceOrderResult">
        <result property="orderId"    column="order_id"    />
        <result property="orderNo"    column="order_no"    />
        <result property="companyId"    column="company_id"    />
@@ -15,6 +15,7 @@
        <result property="companyAddress"    column="company_address"    />
        <result property="regionCode"    column="region_code"    />
        <result property="regionName"    column="region_name"    />
        <result property="enforceContent"    column="enforce_content"    />
        <result property="enforceReason"    column="enforce_reason"    />
        <result property="enforceType"    column="enforce_type"    />
        <result property="applyId"    column="apply_id"    />
@@ -24,6 +25,7 @@
        <result property="applyDeptName"    column="apply_dept_name"    />
        <result property="applyTime"    column="apply_time"    />
        <result property="planTime"    column="plan_time"    />
        <result property="inTime"    column="in_time"    />
        <result property="userNum"    column="user_num"    />
        <result property="warnStatus"    column="warn_status"    />
        <result property="warnReason"    column="warn_reason"    />
@@ -47,79 +49,70 @@
        <result property="isShow"    column="is_show"    />
        <result property="isEva"    column="is_eva"    />
        <result property="totalScore"    column="total_score"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>
    <sql id="selectEnforceOrderVo">
        select order_id, order_no, company_id, company_name, company_code, company_user, company_phone, company_address,
               region_code,region_name,enforce_reason,user_num,
               apply_id,apply_user,apply_phone,apply_dept_id,apply_dept_name,apply_time,
               warn_status,warn_reason,order_status,
               check_dept_id,check_dept_name,check_status,check_reason,check_level,
               execute_id,execute_user,execute_phone,execute_dept_id,execute_dept_name,execute_time,
               region_status,region_reason,region_imgs,region_videos,is_notice_company,is_show,is_eva,total_score
        from sys_job_log
        select *
        from enforce_order
    </sql>
    <select id="selectCheckList"
            parameterType="EnforceOrderQueryBo"
            resultMap="EnforceOrderResult">
        <include refid="selectEnforceOrderVo"/>
        <where>
        where 1=1
            and check_status !=2
            and check_status!=-1
            <if test="orderNo != null and orderNo != ''">
                AND order_no like concat('%', #{orderNo}, '%')
            </if>
            <if test="companyName != null and companyName != ''">
                AND company_name like concat('%', #{companyName}, '%')
            </if>
            <if test="orderStatus != null and orderStatus != ''">
                AND order_status = #{orderStatus}
            </if>
            <if test="checkDeptId != null ">
                AND check_dept_id = #{checkDeptId}
            <if test="checkIds != null and checkIds != '' ">
                AND check_ids like concat('%', #{checkIds}, '%')
            </if>
            <if test="checkLevel != null ">
                AND check_level = #{checkLevel}
            <if test="enforceReason != null and enforceReason != '' ">
                AND enforce_reason like concat('%', #{enforceReason}, '%')
            </if>
            <if test="applyDeptIds != null ">
            <if test="applyDeptIds != null and applyDeptIds !='' ">
                AND apply_dept_id in
                <foreach collection="applyDeptIds" item="applyDeptId" open="(" separator="," close=")">
                    #{applyDeptId}
                </foreach>
            </if>
        </where>
    </select>
    <select id="getMonthCount"
            parameterType="Long"
            resultType="com.project.common.vo.KeyVal">
        select
            MONTH(apply_time) AS k,
            IFNULL(count(order_id),0) as v
        from enforce_order
        where 1=1
        <if test="deptId != null ">
            AND apply_dept_id = #{deptId}
    <select id="selectCheckedList"
            parameterType="OrderCheckedQueryBo"
            resultMap="EnforceOrderResult">
        select t2.*
            from enforce_check_log t1 join enforce_order t2 on t1.order_id = t2.order_id
        where t2.del_flag = 0
        and t1.check_id = #{userId}
        <if test="checkStatus != null">
            AND t2.check_status = #{checkStatus}
        </if>
        GROUP BY k
    </select>
    <select id="getDeptCount"
            parameterType="String"
            resultType="com.project.common.vo.KeyVal">
        select
        MONTH(check_dept_id) AS k,
        IFNULL(count(order_id),0) as v
        from enforce_order
        where 1=1
        <if test="yearMonth!=null and yearMonth!=''">
            AND apply_time like concat('%', #{yearMonth}, '%')
        <if test="enforceReason != null and enforceReason != '' ">
            AND t2.enforce_reason like concat('%', #{enforceReason}, '%')
        </if>
        GROUP BY k
    </select>
    <select id="selectScanList"
            resultMap="EnforceOrderResult">
        select t2.*
        from enforce_peer t1 join enforce_order t2 on t1.order_id = t2.order_id
        where
            t2.del_flag = 0
            and t2.order_status=2
            AND t1.peer_id = #{userId}
            AND t2.company_code = #{companyCode}
    </select>
</mapper>