linwei
2023-12-29 3e282ab6a5570a48940941be0f4c6b49f862de92
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?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="org.springblade.modules.checkInRecords.mapper.CheckInRecordsMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="checkInRecordsResultMap" type="org.springblade.modules.checkInRecords.vo.CheckInRecordsVO">
    </resultMap>
 
 
    <select id="selectCheckInRecordsPage" resultMap="checkInRecordsResultMap">
        SELECT
        jcir.id,
        jcir.create_user_id,
        jcir.create_time,
        jcir.work_theme,
        jcir.work_content,
        jcir.img,
        jcir.lng,
        jcir.lat,
        jcir.address,
        jcir.deleted_flag,
        bu.`name`
        FROM
        jczz_check_in_records jcir
        LEFT JOIN blade_user bu ON bu.id = jcir.create_user_id
        <where>
            <if test="checkInRecords.id != null "> and jcir.id = #{checkInRecords.id}</if>
            <if test="checkInRecords.createUserId != null "> and jcir.create_user_id = #{checkInRecords.createUserId}</if>
            <if test="checkInRecords.createTime != null "> and jcir.create_time = #{checkInRecords.createTime}</if>
            <if test="checkInRecords.workTheme != null  and checkInRecords.workTheme != ''"> and jcir.work_theme = #{checkInRecords.workTheme}</if>
            <if test="checkInRecords.workContent != null  and checkInRecords.workContent != ''"> and jcir.work_content = #{checkInRecords.workContent}</if>
            <if test="checkInRecords.img != null  and checkInRecords.img != ''"> and jcir.img = #{checkInRecords.img}</if>
            <if test="checkInRecords.lng != null  and checkInRecords.lng != ''"> and jcir.lng = #{checkInRecords.lng}</if>
            <if test="checkInRecords.lat != null  and checkInRecords.lat != ''"> and jcir.lat = #{checkInRecords.lat}</if>
            <if test="checkInRecords.address != null  and checkInRecords.address != ''"> and jcir.address = #{checkInRecords.address}</if>
            <if test="checkInRecords.deletedFlag != null "> and jcir.deleted_flag = #{checkInRecords.deletedFlag}</if>
            <if test="checkInRecords.name != null and checkInRecords.name !='' "> and bu.name like concat('%',#{checkInRecords.name},'%') </if>
            <if test="checkInRecords.startTime!=null and checkInRecords.startTime!=''">
                AND date_format(jcir.create_time,'%Y-%m-%d')&gt;= #{checkInRecords.startTime}
            </if>
            <if test="checkInRecords.endTime!=null and checkInRecords.endTime!=''">
                AND date_format(jcir.create_time,'%Y-%m-%d')&lt;= #{checkInRecords.endTime}
            </if>
        </where>
        order by jcir.create_time desc
    </select>
 
    <resultMap type="org.springblade.modules.checkInRecords.dto.CheckInRecordsDTO" id="CheckInRecordsDTOResult">
        <result property="id"    column="id"    />
        <result property="createUserId"    column="create_user_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="workTheme"    column="work_theme"    />
        <result property="workContent"    column="work_content"    />
        <result property="img"    column="img"    />
        <result property="lng"    column="lng"    />
        <result property="lat"    column="lat"    />
        <result property="address"    column="address"    />
        <result property="deletedFlag"    column="deleted_flag"    />
    </resultMap>
 
    <sql id="selectCheckInRecords">
        select
            id,
            create_user_id,
            create_time,
            work_theme,
            work_content,
            img,
            lng,
            lat,
            address,
            deleted_flag
        from
            jczz_check_in_records
    </sql>
 
    <select id="selectCheckInRecordsById" parameterType="int" resultMap="CheckInRecordsDTOResult">
        <include refid="selectCheckInRecords"/>
        where
        id = #{id}
    </select>
 
    <select id="selectCheckInRecordsList" parameterType="org.springblade.modules.checkInRecords.dto.CheckInRecordsDTO" resultMap="CheckInRecordsDTOResult">
        <include refid="selectCheckInRecords"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="workTheme != null  and workTheme != ''"> and work_theme = #{workTheme}</if>
            <if test="workContent != null  and workContent != ''"> and work_content = #{workContent}</if>
            <if test="img != null  and img != ''"> and img = #{img}</if>
            <if test="lng != null  and lng != ''"> and lng = #{lng}</if>
            <if test="lat != null  and lat != ''"> and lat = #{lat}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="deletedFlag != null "> and deleted_flag = #{deletedFlag}</if>
        </where>
    </select>
</mapper>