fuliqi
2024-04-02 32b4f6188f32e6c08e813efa98a25d94eacdc0c6
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?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.ycl.platform.mapper.CheckResultMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.platform.domain.vo.CheckResultVO">
        <result column="id" property="id" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="unit_name" property="checkUnitName" />
        <result column="examine_name" property="examineName" />
        <result column="check_score" property="checkScore" />
        <result column="system_score" property="systemScore" />
        <result column="manual_score" property="manualScore" />
        <result column="check_time" property="checkTime" />
        <result column="frequency" property="frequency" />
        <result column="examine_range" property="examineRange" />
        <result column="publish" property="publish" />
    </resultMap>
 
    <select id="page" resultMap="BaseResultMap">
        SELECT
               tcr.id,
               tyu.unit_name,
               tcp.examine_name,
               tcp.examine_range,
               tcp.frequency,
               tcr.check_time,
               tcr.check_score,
               tcr.system_score,
               tcr.manual_score,
               tcr.publish
        FROM
             t_check_result tcr
                 INNER JOIN t_check_publish tcp ON tcr.check_publish_id = tcp.id
                 INNER JOIN t_yw_unit tyu ON tcr.check_unit_id = tyu.id
        <where>
                AND tcr.deleted = 0
            <if test="query.checkUnitName != null and query.checkUnitName != ''">
                AND tyu.unit_name like concat('%', #{query.checkUnitName}, '%')
            </if>
            <if test="query.frequency != null and query.frequency != ''">
                AND tcp.frequency = #{query.frequency}
            </if>
            <if test="query.frequency != null and query.frequency != ''">
                AND tcp.examine_range = #{query.examineRange}
            </if>
            <if test="query.start != null and query.end != null">
                AND tcr.check_time BETWEEN #{query.start} AND #{query.end}
            </if>
        </where>
    </select>
 
</mapper>