101captain
2021-12-23 5a8a90c095280fbd2106869ecd2bad10e01a57a6
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?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.panzhihua.service_community.dao.ComActDynTypeMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActDynTypeDO">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="color" property="color" />
        <result column="is_del" property="isDel" />
        <result column="community_id" property="communityId" />
        <result column="create_at" property="createAt" />
        <result column="create_by" property="createBy" />
        <result column="update_at" property="updateAt" />
        <result column="update_by" property="updateBy" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, color, is_del, community_id, create_at, create_by, update_at, update_by
    </sql>
 
    <select id="pageDynTypeByAdmin" parameterType="com.panzhihua.common.model.dtos.community.PageComActDynTypeDTO"
            resultType="com.panzhihua.common.model.vos.community.ComActDynTypeVO">
        SELECT
            cadt.id,
            cadt.`name`,
            cadt.color,
            cadt.community_id,
            cadt.create_at,
            cadt.update_at,
            su.`name` AS createBy,
            su1.`name` AS updateBy
        FROM
            com_act_dyn_type AS cadt
            LEFT JOIN sys_user AS su ON su.user_id = cadt.create_by
            LEFT JOIN sys_user AS su1 ON su1.user_id = cadt.update_by
            where cadt.community_id = 0 and cadt.is_del = 2
            <if test="comActDynTypeDTO.keyWord != null and comActDynTypeDTO.keyWord != &quot;&quot;">
                and (cadt.id = #{comActDynTypeDTO.keyWord} or cadt.`name` like concat (#{comActDynTypeDTO.keyWord},'%'))
            </if>
            union all
 
        SELECT
        cadt.id,
        cadt.`name`,
        cadt.color,
        cadt.community_id,
        cadt.create_at,
        cadt.update_at,
        su.`name` AS createBy,
        su1.`name` AS updateBy
        FROM
        com_act_dyn_type AS cadt
        LEFT JOIN sys_user AS su ON su.user_id = cadt.create_by
        LEFT JOIN sys_user AS su1 ON su1.user_id = cadt.update_by
        where cadt.is_del = 2
        <if test="comActDynTypeDTO.communityId != null">
            and cadt.community_id = #{comActDynTypeDTO.communityId}
        </if>
        <if test="comActDynTypeDTO.keyWord != null and comActDynTypeDTO.keyWord != &quot;&quot;">
            and (cadt.id = #{comActDynTypeDTO.keyWord} or cadt.`name` like concat (#{comActDynTypeDTO.keyWord},'%'))
        </if>
        order by create_at desc
    </select>
 
    <select id="getDynTypeListByAdmin" parameterType="com.panzhihua.common.model.dtos.community.PageComActDynTypeDTO"
            resultType="com.panzhihua.common.model.vos.community.ComActDynTypeVO">
        SELECT
        cadt.id,
        cadt.`name`,
        cadt.color,
        cadt.community_id,
        cadt.create_at,
        cadt.update_at,
        su.`name` AS createBy,
        su1.`name` AS updateBy
        FROM
        com_act_dyn_type AS cadt
        LEFT JOIN sys_user AS su ON su.user_id = cadt.create_by
        LEFT JOIN sys_user AS su1 ON su1.user_id = cadt.update_by
        where cadt.community_id = 0 and cadt.is_del = 2
        <if test="comActDynTypeDTO.keyWord != null and comActDynTypeDTO.keyWord != &quot;&quot;">
            and (cadt.id = #{comActDynTypeDTO.keyWord} or cadt.`name` like concat (#{comActDynTypeDTO.keyWord},'%'))
        </if>
        union all
 
        SELECT
        cadt.id,
        cadt.`name`,
        cadt.color,
        cadt.community_id,
        cadt.create_at,
        cadt.update_at,
        su.`name` AS createBy,
        su1.`name` AS updateBy
        FROM
        com_act_dyn_type AS cadt
        LEFT JOIN sys_user AS su ON su.user_id = cadt.create_by
        LEFT JOIN sys_user AS su1 ON su1.user_id = cadt.update_by
        where cadt.is_del = 2
        <if test="comActDynTypeDTO.communityId != null">
            and cadt.community_id = #{comActDynTypeDTO.communityId}
        </if>
        <if test="comActDynTypeDTO.keyWord != null and comActDynTypeDTO.keyWord != &quot;&quot;">
            and (cadt.id = #{comActDynTypeDTO.keyWord} or cadt.`name` like concat (#{comActDynTypeDTO.keyWord},'%'))
        </if>
    </select>
 
    <select id="getDynCountByDynTypeIds" parameterType="List" resultType="Integer">
        select count(id) from com_act_dyn where `type` in
        <foreach collection='ids' item='id' index='index' open='(' close=')' separator=',' >
        #{id}
        </foreach>
    </select>
 
    <update id="deleteDynTypeByIds" parameterType="List">
        update com_act_dyn_type set is_del = 1 where id in
        <foreach collection='ids' item='id' index='index' open='(' close=')' separator=',' >
            #{id}
        </foreach>
    </update>
 
</mapper>