linwe
2024-08-09 8b7258c9427882bb1798f1502eaa35184c6e374e
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
<?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.patrol.mapper.PatrolGroupItemMapper">
 
    <select id="selectPatrolGroupItemList" resultType="org.springblade.modules.patrol.vo.PatrolGroupItemVO">
        SELECT
            spgi.id,spgi.group_id,spgi.items_name,spgi.description,
            spg.name as groupName
        FROM jczz_patrol_group_ITEM spgi
        left join jczz_patrol_group spg on spg.id = spgi.group_id
        WHERE spgi.is_deleted = 0
        <if test="patrolGroupItem.groupId != null and patrolGroupItem.groupId != '' ">
            and spgi.group_id = #{patrolGroupItem.groupId}
        </if>
        <if test="patrolGroupItem.itemsName !=null and patrolGroupItem.itemsName !=''">
            AND spgi.items_name LIKE CONCAT('%',#{patrolGroupItem.itemsName},'%')
        </if>
        <if test="patrolGroupItem.description !=null and patrolGroupItem.description !=''">
            AND spgi.description LIKE CONCAT('%',#{patrolGroupItem.description},'%')
        </if>
    </select>
    <select id="getPatrolGroupItemVOById" resultType="org.springblade.modules.patrol.vo.PatrolGroupItemVO">
        SELECT item.id,item.items_name,item.description,item.group_id,b.name groupName
        FROM jczz_patrol_group_item item
        LEFT JOIN sm_patrol_group b ON b.id = item.group_id
        WHERE item.is_deleted = 0
        AND item.id = #{id}
    </select>
    <select id="getItemByItemIds" resultType="org.springblade.modules.patrol.entity.PatrolGroupItem">
        SELECT ID,GROUP_ID,ITEMS_NAME,DESCRIPTION FROM jczz_patrol_group_ITEM
        WHERE ID IN
        <foreach collection="itemIds.split(',')" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
        AND is_deleted = 0 AND group_id = #{groupId}
    </select>
 
<!--    <resultMap type="org.springblade.modules.dto.PatrolGroupDTO" id="PatrolGroupDTOResult">-->
<!--        <result property="id"    column="id"    />-->
<!--        <result property="name"    column="name"    />-->
<!--        <result property="createUser"    column="create_user"    />-->
<!--        <result property="createTime"    column="create_time"    />-->
<!--        <result property="updateTime"    column="update_time"    />-->
<!--        <result property="isDeleted"    column="is_deleted"    />-->
<!--    </resultMap>-->
 
    <sql id="selectPatrolGroup">
        select
            id,
            name,
            create_user,
            create_time,
            update_time,
            is_deleted
        from
            jczz_patrol_group
    </sql>
 
<!--    <select id="selectPatrolGroupById" parameterType="long" resultMap="PatrolGroupDTOResult">-->
<!--        <include refid="selectPatrolGroup"/>-->
<!--        where-->
<!--        id = #{id}-->
<!--    </select>-->
 
<!--    <select id="selectPatrolGroupList" parameterType="org.springblade.modules.dto.PatrolGroupDTO" resultMap="PatrolGroupDTOResult">-->
<!--        <include refid="selectPatrolGroup"/>-->
<!--        <where>-->
<!--            <if test="id != null "> and id = #{id}</if>-->
<!--            <if test="name != null  and name != ''"> and name = #{name}</if>-->
<!--            <if test="createUser != null "> and create_user = #{createUser}</if>-->
<!--            <if test="createTime != null "> and create_time = #{createTime}</if>-->
<!--            <if test="updateTime != null "> and update_time = #{updateTime}</if>-->
<!--            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>-->
<!--        </where>-->
<!--    </select>-->
 
</mapper>