PropertyUserMapper.xml
2.91 KB
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
<?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="PropertyUserV1ServiceDaoImpl">
<insert id="savePropertyUser" parameterType="com.java110.po.property.PropertyUserPo">
INSERT INTO property_user(user_id, name, tel, work_type, role, status, device_id, store_id, community_id, create_time, update_time)
VALUES(#{userId}, #{name}, #{tel}, #{workType}, #{role}, #{status}, #{deviceId}, #{storeId}, #{communityId}, NOW(), NOW())
</insert>
<update id="updatePropertyUser" parameterType="com.java110.po.property.PropertyUserPo">
UPDATE property_user
<set>
<if test="name != null and name != ''">name = #{name},</if>
<if test="tel != null and tel != ''">tel = #{tel},</if>
<if test="workType != null and workType != ''">work_type = #{workType},</if>
<if test="role != null and role != ''">role = #{role},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="communityId != null and communityId != ''">community_id = #{communityId},</if>
update_time = NOW()
</set>
WHERE user_id = #{userId}
</update>
<delete id="deletePropertyUser" parameterType="com.java110.po.property.PropertyUserPo">
DELETE FROM property_user WHERE user_id = #{userId}
</delete>
<select id="queryPropertyUsers" parameterType="map" resultType="map">
SELECT * FROM property_user WHERE 1=1
<if test="userId != null and userId != ''">AND user_id = #{userId}</if>
<if test="workType != null and workType != ''">AND work_type = #{workType}</if>
<if test="status != null and status != ''">AND status = #{status}</if>
<if test="name != null and name != ''">AND name LIKE CONCAT('%', #{name}, '%')</if>
<if test="tel != null and tel != ''">AND tel = #{tel}</if>
<if test="storeId != null and storeId != ''">AND store_id = #{storeId}</if>
ORDER BY create_time DESC
<if test="page != null and page != '' and row != null and row != ''">
LIMIT #{page}, #{row}
</if>
</select>
<select id="queryPropertyUsersCount" parameterType="map" resultType="map">
SELECT COUNT(1) count FROM property_user WHERE 1=1
<if test="userId != null and userId != ''">AND user_id = #{userId}</if>
<if test="workType != null and workType != ''">AND work_type = #{workType}</if>
<if test="status != null and status != ''">AND status = #{status}</if>
<if test="name != null and name != ''">AND name LIKE CONCAT('%', #{name}, '%')</if>
<if test="tel != null and tel != ''">AND tel = #{tel}</if>
<if test="storeId != null and storeId != ''">AND store_id = #{storeId}</if>
</select>
</mapper>