ZQN
2024-06-19 d21773b0d86197d133ef4b16fe366232c345c665
project-enforce/src/main/resources/mapper/enforce/EnforceOrderMapper.xml
@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.project.enforce.mapper.EnforceOrderMapper">
    <resultMap type="EnforceOrder" id="EnforceOrderResult">
        <result property="orderId"    column="order_id"    />
        <result property="orderNo"    column="order_no"    />
@@ -16,23 +16,22 @@
        <result property="regionCode"    column="region_code"    />
        <result property="regionName"    column="region_name"    />
        <result property="enforceReason"    column="enforce_reason"    />
        <result property="enforceType"    column="enforce_type"    />
        <result property="applyId"    column="apply_id"    />
        <result property="applyUser"    column="apply_user"    />
        <result property="applyPhone"    column="apply_phone"    />
        <result property="applyDeptId"    column="apply_dept_id"    />
        <result property="applyDeptName"    column="apply_dept_name"    />
        <result property="applyTime"    column="apply_time"    />
        <result property="userNum"    column="user_num"    />
        <result property="warnStatus"    column="warn_status"    />
        <result property="warnReason"    column="warn_reason"    />
        <result property="orderStatus"    column="order_status"    />
        <result property="checkId"    column="check_id"    />
        <result property="checkUser"    column="check_user"    />
        <result property="checkPhone"    column="check_phone"    />
        <result property="checkDeptId"    column="check_dept_id"    />
        <result property="checkDeptName"    column="check_dept_name"    />
        <result property="checkTime"    column="check_time"    />
        <result property="checkStatus"    column="check_status"    />
        <result property="checkReason"    column="check_reason"    />
        <result property="checkLevel"    column="check_level"    />
        <result property="executeId"    column="execute_id"    />
        <result property="executeUser"    column="execute_user"    />
        <result property="executePhone"    column="execute_phone"    />
@@ -50,6 +49,76 @@
        <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
    </sql>
    <select id="selectCheckList"
            parameterType="EnforceOrderQueryBo"
            resultMap="EnforceOrderResult">
        <include refid="selectEnforceOrderVo"/>
        <where>
            <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>
</mapper>
            <if test="orderStatus != null and orderStatus != ''">
                AND order_status = #{orderStatus}
            </if>
            <if test="checkDeptId != null ">
                AND check_dept_id = #{checkDeptId}
            </if>
            <if test="checkLevel != null ">
                AND check_level = #{checkLevel}
            </if>
            <if test="applyDeptIds != null ">
                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}
        </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>
        GROUP BY k
    </select>
</mapper>