yaowanxin
14 小时以前 a6249b972f4b929e070ace0517da5b44f5d96be2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.collaborativeApproval.mapper.DutyPlanMapper">
    <resultMap id="DutyPlanDTOMap" type="com.ruoyi.collaborativeApproval.dto.DutyPlanDTO">
        <result column="id" property="id"/>
        <result column="tags" property="tags" typeHandler="com.ruoyi.approve.utils.ListToStringTypeHandler"/>
    </resultMap>
 
    <select id="listPage" resultMap="DutyPlanDTOMap">
        select * from duty_plan
        <where>
        1=1
            <if test="dutyPlan.title != null and dutyPlan.title != ''">
                and title like concat('%',#{dutyPlan.title},'%')
            </if>
            <if test="dutyPlan.level != null">
                and level = #{dutyPlan.level}
            </if>
            <if test="dutyPlan.period != null">
                and period = #{dutyPlan.period}
            </if>
            <if test="dutyPlan.queryDate != null">
                and start_date &lt;= #{dutyPlan.queryDate}
                and end_date &gt;= #{dutyPlan.queryDate}
            </if>
        </where>
    </select>
 
    <select id="getNum" resultType="java.util.Map">
        SELECT
            level,
            COUNT(*) AS num,
            ROUND(COUNT(*) / total.count * 100) AS completion
        FROM
            duty_plan,
            (SELECT COUNT(*) AS count FROM duty_plan) AS total
        GROUP BY
            level, total.count
    </select>
</mapper>