123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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.dtb.portal.mapper.SysUserMapper">
- <select id="page" resultType="com.dtb.portal.entity.SysUser">
- select *
- from users where 1=1
- <if test="accountName!=null and accountName!=''">
- and account_name like CONCAT('%',#{accountName,jdbcType=VARCHAR},'%')
- </if>
- <if test="phone!=null and phone!=''">
- and phone like CONCAT('%',#{phone,jdbcType=VARCHAR,jdbcType=VARCHAR},'%')
- </if>
- <if test="enable!=null and enable!=''">
- and enable =#{enable,jdbcType=VARCHAR}
- </if>
- and type='2'
- order by create_time desc
- </select>
- <select id="selectOne" resultType="com.dtb.portal.entity.SysUser">
- select *
- from users
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <update id="updateEnable">
- update users
- <set>
- <if test="enable!=null">
- enable =#{enable},
- </if>
- <if test="updateTime!=null">
- update_time =#{updateTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id=#{id,jdbcType=VARCHAR}
- </update>
- <update id="updatePassword">
- update users
- <set>
- <if test="password!=null and password!=''">
- password=#{password,jdbcType=VARCHAR},
- </if>
- <if test="updateTime!=null">
- update_time =#{updateTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id=#{id,jdbcType=VARCHAR}
- </update>
- <select id="selectByAccountName" resultType="com.dtb.portal.entity.SysUser">
- select *
- from users
- where account_name = #{accountName,jdbcType=VARCHAR}
- </select>
- <select id="selectByOpenId" resultType="com.dtb.portal.entity.SysUser">
- select *
- from users
- where open_id = #{openId,jdbcType=VARCHAR}
- </select>
- <update id="update">
- UPDATE users
- <set>
- <if test="accountName!=null and accountName!=''">
- account_name=#{accountName,jdbcType=VARCHAR},
- </if>
- <if test="nickname!=null and nickname!=''">
- nickname=#{nickname,jdbcType=VARCHAR},
- </if>
- <if test="password!=null and password!=''">
- password=#{password,jdbcType=VARCHAR},
- </if>
- <if test="phone!=null and phone!=''">
- phone=#{phone,jdbcType=VARCHAR},
- </if>
- <if test="enable!=null">
- enable=#{enable},
- </if>
- <if test="gender!=null and gender!=''">
- gender=#{gender,jdbcType=VARCHAR},
- </if>
- <if test="location!=null and location!=''">
- location=#{location,jdbcType=VARCHAR},
- </if>
- <if test="nation!=null and nation!=''">
- nation=#{nation,jdbcType=VARCHAR},
- </if>
- <if test="birthday!=null">
- birthday=#{birthday,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime!=null">
- update_time=#{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="isVip!=null">
- is_vip=#{isVip},
- </if>
- <if test="vipResidueDate!=null">
- vip_residue_date=#{vipResidueDate},
- </if>
- <if test="vipEndDate!=null">
- vip_end_date=#{vipEndDate},
- </if>
- logo_path=#{logoPath,jdbcType=VARCHAR},
- </set>
- where id=#{id,jdbcType=VARCHAR}
- </update>
- <insert id="save">
- insert into users (id, open_id, type, logo_path, account_name, nickname, password, phone, enable, gender,
- location,nation, birthday, create_time, update_time)
- values (#{id,jdbcType=VARCHAR},
- #{openId,jdbcType=VARCHAR},
- #{type,jdbcType=VARCHAR},
- #{logoPath,jdbcType=VARCHAR},
- #{accountName,jdbcType=VARCHAR},
- #{nickname,jdbcType=VARCHAR},
- #{password,jdbcType=VARCHAR},
- #{phone,jdbcType=VARCHAR},
- #{enable},
- #{gender,jdbcType=VARCHAR},
- #{location,jdbcType=VARCHAR},
- #{nation,jdbcType=VARCHAR},
- #{birthday,jdbcType=TIMESTAMP},
- #{createTime,jdbcType=TIMESTAMP},
- #{updateTime,jdbcType=TIMESTAMP})
- </insert>
- <select id="selectByPhone" resultType="com.dtb.portal.entity.SysUser">
- select *
- from users
- where phone = #{phone,jdbcType=VARCHAR}
- and type = '2'
- </select>
- <delete id="delete">
- delete
- from users
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- </mapper>
|