mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?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_jinhui_community.dao.JinhuiComConvenientServiceCategoriesDao">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_jinhui_community.entity.JinhuiComConvenientServiceCategories">
        <id column="id" property="id" />
        <id column="name" property="name" />
        <id column="icon" property="icon" />
        <id column="remark" property="remark" />
        <id column="weight" property="weight" />
        <id column="is_del" property="isDel" />
        <id column="created_at" property="createdAt" />
        <id column="created_by" property="createdBy" />
        <id column="updated_at" property="updatedAt" />
        <id column="parent_id" property="parentId" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,
        name,
        icon,
        remark,
        weight,
        is_del,
        created_at,
        created_by,
        updated_at,
        parent_id
 
    </sql>
 
    <!-- 分页查询 -->
    <select id="getList" resultMap="BaseResultMap">
        select
            id,
            name,
            icon,
            remark,
            weight,
            is_del,
            created_at,
            created_by,
            updated_at,
            parent_id
        from jinhui_com_convenient_service_categories
        where is_del='0'
        order by weight desc,created_at desc
    </select>
 
 
    <select id="getDetails" resultMap="BaseResultMap">
        select
            id,
            name,
            icon,
            remark,
            weight,
            is_del,
            created_at,
            created_by,
            updated_at,
            parent_id
        from jinhui_com_convenient_service_categories
        where
            id=#{id}
    </select>
 
 
 
    <insert id="addData">
        insert into jinhui_com_convenient_service_categories
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="item.id != null and item.id != '' ">
                id,
            </if>
            <if test="item.name != null and item.name != '' ">
                `name`,
            </if>
            <if test="item.icon != null and item.icon != '' ">
                icon,
            </if>
            <if test="item.remark != null and item.remark != '' ">
                remark,
            </if>
            <if test="item.weight != null and item.weight != '' ">
                weight,
            </if>
            <if test="item.isDel != null and item.isDel != '' ">
                is_del,
            </if>
            <if test="item.createdBy != null and item.createdBy != '' ">
                created_by,
            </if>
            <if test="item.parentId != null and item.parentId != '' ">
                parent_id,
            </if>
            created_at
        </trim>
        values
        <trim prefix="("  suffix=")" suffixOverrides=",">
            <if test="item.id != null and item.id != '' ">
                #{item.id},
            </if>
            <if test="item.name != null and item.name != '' ">
                #{item.name},
            </if>
            <if test="item.icon != null and item.icon != '' ">
                #{item.icon},
            </if>
            <if test="item.remark != null and item.remark != '' ">
                #{item.remark},
            </if>
            <if test="item.weight != null and item.weight != '' ">
                #{item.weight},
            </if>
            <if test="item.isDel != null and item.isDel != '' ">
                #{item.isDel},
            </if>
            <if test="item.createdBy != null and item.createdBy != '' ">
                #{item.createdBy},
            </if>
            <if test="item.parentId != null and item.parentId != '' ">
                #{item.parentId},
            </if>
            sysdate()
        </trim>
    </insert>
 
    <update id="editData">
        update jinhui_com_convenient_service_categories
        <set>
            <if test="item.id != null and item.id != '' ">
                id=#{item.id},
            </if>
            <if test="item.name != null and item.name != '' ">
                `name`=#{item.name},
            </if>
            <if test="item.icon != null and item.icon != '' ">
                icon=#{item.icon},
            </if>
            <if test="item.remark != null and item.remark != '' ">
                remark=#{item.remark},
            </if>
            <if test="item.weight != null and item.weight != '' ">
                weight=#{item.weight},
            </if>
            <if test="item.isDel != null and item.isDel != '' ">
                is_del=#{item.isDel},
            </if>
            <if test="item.createdBy != null and item.createdBy != '' ">
                created_by=#{item.createdBy},
            </if>
            <if test="item.parentId != null and item.parentId != '' ">
                parent_id=#{item.parentId},
            </if>
            updated_at=sysdate()
        </set>
        where id = #{item.id}
    </update>
 
    <update id="expurgateData" parameterType="String">
        update jinhui_com_convenient_service_categories
        set is_del='1'
        where id=#{id}
    </update>
 
 
</mapper>