UserOfficialInfoMapper.xml
4.5 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
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
<?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.zhonglai.luhui.user.mapper.UserOfficialInfoMapper">
<resultMap type="UserOfficialInfo" id="UserOfficialInfoResult">
<result property="id" column="id" />
<result property="guarantee" column="guarantee" />
<result property="guaranteeDescribe" column="guarantee_describe" />
<result property="alarmAgreement" column="alarm_agreement" />
<result property="alarmNoticePhone" column="alarm_notice_phone" />
<result property="alarmNoticeOpenid" column="alarm_notice_openid" />
<result property="alarmNoticeWxopen" column="alarm_notice_wxopen" />
</resultMap>
<sql id="selectUserOfficialInfoVo">
select id, guarantee, guarantee_describe, alarm_agreement, alarm_notice_phone, alarm_notice_openid, alarm_notice_wxopen from user_official_info
</sql>
<select id="selectUserOfficialInfoList" parameterType="UserOfficialInfo" resultMap="UserOfficialInfoResult">
<include refid="selectUserOfficialInfoVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="guarantee != null "> and guarantee = #{guarantee}</if>
<if test="guaranteeDescribe != null and guaranteeDescribe != ''"> and guarantee_describe = #{guaranteeDescribe}</if>
<if test="alarmAgreement != null "> and alarm_agreement = #{alarmAgreement}</if>
<if test="alarmNoticePhone != null and alarmNoticePhone != ''"> and alarm_notice_phone like concat('%', #{alarmNoticePhone}, '%')</if>
<if test="alarmNoticeOpenid != null and alarmNoticeOpenid != ''"> and alarm_notice_openid = #{alarmNoticeOpenid}</if>
<if test="alarmNoticeWxopen != null "> and alarm_notice_wxopen = #{alarmNoticeWxopen}</if>
</where>
</select>
<select id="selectUserOfficialInfoById" parameterType="Integer" resultMap="UserOfficialInfoResult">
<include refid="selectUserOfficialInfoVo"/>
where id = #{id}
</select>
<insert id="insertUserOfficialInfo" parameterType="UserOfficialInfo">
insert into user_official_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="guarantee != null">guarantee,</if>
<if test="guaranteeDescribe != null">guarantee_describe,</if>
<if test="alarmAgreement != null">alarm_agreement,</if>
<if test="alarmNoticePhone != null">alarm_notice_phone,</if>
<if test="alarmNoticeOpenid != null">alarm_notice_openid,</if>
<if test="alarmNoticeWxopen != null">alarm_notice_wxopen,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="guarantee != null">#{guarantee},</if>
<if test="guaranteeDescribe != null">#{guaranteeDescribe},</if>
<if test="alarmAgreement != null">#{alarmAgreement},</if>
<if test="alarmNoticePhone != null">#{alarmNoticePhone},</if>
<if test="alarmNoticeOpenid != null">#{alarmNoticeOpenid},</if>
<if test="alarmNoticeWxopen != null">#{alarmNoticeWxopen},</if>
</trim>
</insert>
<update id="updateUserOfficialInfo" parameterType="UserOfficialInfo">
update user_official_info
<trim prefix="SET" suffixOverrides=",">
<if test="guarantee != null">guarantee = #{guarantee},</if>
<if test="guaranteeDescribe != null">guarantee_describe = #{guaranteeDescribe},</if>
<if test="alarmAgreement != null">alarm_agreement = #{alarmAgreement},</if>
<if test="alarmNoticePhone != null">alarm_notice_phone = #{alarmNoticePhone},</if>
<if test="alarmNoticeOpenid != null">alarm_notice_openid = #{alarmNoticeOpenid},</if>
<if test="alarmNoticeWxopen != null">alarm_notice_wxopen = #{alarmNoticeWxopen},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteUserOfficialInfoById" parameterType="Integer">
delete from user_official_info where id = #{id}
</delete>
<delete id="deleteUserOfficialInfoByIds" parameterType="String">
delete from user_official_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>