UserOfficialInfoMapper.xml 4.5 KB
<?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>