248 lines
9.4 KiB
XML
248 lines
9.4 KiB
XML
<?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.zhwl.user.mapper.ZdyUserMapper">
|
|
|
|
<resultMap type="ZdyUser" id="ZdyUserResult">
|
|
<result property="id" column="id"/>
|
|
<result property="avatar" column="avatar"/>
|
|
<result property="nickname" column="nickname"/>
|
|
<result property="name" column="name"/>
|
|
<result property="mobile" column="mobile"/>
|
|
<result property="status" column="status"/>
|
|
<result property="idCard" column="id_card"/>
|
|
<result property="sex" column="sex"/>
|
|
<result property="birthday" column="birthday"/>
|
|
<result property="email" column="email"/>
|
|
<result property="password" column="password"/>
|
|
<result property="openId" column="open_id"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="province" column="province"/>
|
|
<result property="city" column="city"/>
|
|
<result property="area" column="area"/>
|
|
<result property="isBlack" column="is_black"/>
|
|
<result property="vipLevelName" column="vip_level_name"/>
|
|
<result property="vipLevelImage1" column="vip_level_image1"/>
|
|
<result property="vipLevelImage2" column="vip_level_image2"/>
|
|
|
|
</resultMap>
|
|
|
|
<sql id="selectZdyUserVo">
|
|
select id,
|
|
open_id,
|
|
avatar,
|
|
nickname,
|
|
name,
|
|
mobile,
|
|
status,
|
|
id_card,
|
|
sex,
|
|
birthday,
|
|
email,
|
|
password,
|
|
create_by,
|
|
create_time,
|
|
update_by,
|
|
update_time,
|
|
remark,
|
|
province,
|
|
city,
|
|
area,
|
|
is_black
|
|
from zdy_user
|
|
</sql>
|
|
|
|
<select id="selectZdyUserList" parameterType="ZdyUser" resultMap="ZdyUserResult">
|
|
<include refid="selectZdyUserVo"/>
|
|
<where>
|
|
<if test="avatar != null and avatar != ''">and avatar = #{avatar}</if>
|
|
<if test="nickname != null and nickname != ''">and nickname like concat('%', #{nickname}, '%')</if>
|
|
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
|
<if test="mobile != null and mobile != ''">and mobile = #{mobile}</if>
|
|
<if test="status != null ">and status = #{status}</if>
|
|
<if test="idCard != null and idCard != ''">and id_card = #{idCard}</if>
|
|
<if test="sex != null and sex != ''">and sex = #{sex}</if>
|
|
<if test="birthday != null ">and birthday = #{birthday}</if>
|
|
<if test="openId != null and openId != ''">and openId = #{openId}</if>
|
|
<if test="isBlack != null">and is_black = #{isBlack}</if>
|
|
</where>
|
|
order by id desc
|
|
</select>
|
|
|
|
<select id="selectZdyUserListByNameAndMobile" parameterType="String" resultMap="ZdyUserResult">
|
|
<include refid="selectZdyUserVo"/>
|
|
where name = #{name} and mobile = #{mobile}
|
|
order by id desc
|
|
</select>
|
|
|
|
<select id="selectZdyUserById" parameterType="Long" resultMap="ZdyUserResult">
|
|
select u.id,
|
|
u.open_id,
|
|
u.avatar,
|
|
u.nickname,
|
|
u.name,
|
|
u.mobile,
|
|
u.status,
|
|
u.id_card,
|
|
u.sex,
|
|
u.birthday,
|
|
u.email,
|
|
u.password,
|
|
u.create_by,
|
|
u.create_time,
|
|
u.update_by,
|
|
u.update_time,
|
|
u.remark,
|
|
u.province,
|
|
u.city,
|
|
u.area,
|
|
u.is_black,
|
|
vl.name vip_level_name,
|
|
vl.image1 vip_level_image1,
|
|
vl.image2 vip_level_image2
|
|
from zdy_user u
|
|
left join zdy_vip_user vu
|
|
on u.id = vu.mini_program_user_id
|
|
left join zdy_vip_level vl on vu.level_id = vl.id
|
|
where u.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertZdyUser" parameterType="ZdyUser" useGeneratedKeys="true" keyProperty="id">
|
|
insert into zdy_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="avatar != null">avatar,</if>
|
|
<if test="nickname != null">nickname,</if>
|
|
<if test="name != null">name,</if>
|
|
<if test="mobile != null">mobile,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="idCard != null">id_card,</if>
|
|
<if test="sex != null">sex,</if>
|
|
<if test="birthday != null">birthday,</if>
|
|
<if test="email != null">email,</if>
|
|
<if test="password != null">password,</if>
|
|
<if test="openId != null and openId != ''">open_id,</if>
|
|
<if test="createBy != null">create_by,
|
|
</if>
|
|
<if test="createTime != null">create_time,
|
|
</if>
|
|
<if test="updateBy != null">update_by,
|
|
</if>
|
|
<if test="updateTime != null">update_time,
|
|
</if>
|
|
<if test="remark != null">remark,
|
|
</if>
|
|
<if test="province != null">province,
|
|
</if>
|
|
<if test="city != null">city,
|
|
</if>
|
|
<if test="area != null">area,
|
|
</if>
|
|
<if test="isBlack != null">is_black,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="avatar != null">#{avatar},</if>
|
|
<if test="nickname != null">#{nickname},</if>
|
|
<if test="name != null">#{name},</if>
|
|
<if test="mobile != null">#{mobile},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="idCard != null">#{idCard},</if>
|
|
<if test="sex != null">#{sex},</if>
|
|
<if test="birthday != null">#{birthday},</if>
|
|
<if test="email != null">#{email},</if>
|
|
<if test="password != null">#{password},</if>
|
|
<if test="openId != null and openId != ''">#{openId},</if>
|
|
<if test="createBy != null">#{createBy},
|
|
</if>
|
|
<if test="createTime != null">#{createTime},
|
|
</if>
|
|
<if test="updateBy != null">#{updateBy},
|
|
</if>
|
|
<if test="updateTime != null">#{updateTime},
|
|
</if>
|
|
<if test="remark != null">#{remark},
|
|
</if>
|
|
<if test="province != null">#{province},
|
|
</if>
|
|
<if test="city != null">#{city},
|
|
</if>
|
|
<if test="area != null">#{area},
|
|
</if>
|
|
<if test="isBlack != null">#{isBlack},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateZdyUser" parameterType="ZdyUser">
|
|
update zdy_user
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="avatar != null">avatar = #{avatar},</if>
|
|
<if test="nickname != null">nickname = #{nickname},</if>
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="mobile != null">mobile = #{mobile},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="idCard != null">id_card = #{idCard},</if>
|
|
<if test="sex != null">sex = #{sex},</if>
|
|
<if test="birthday != null">birthday = #{birthday},</if>
|
|
<if test="email != null">email = #{email},</if>
|
|
<if test="password != null">password = #{password},</if>
|
|
<if test="openId != null and openId != ''">open_id = #{openId},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time =
|
|
#{createTime},
|
|
</if>
|
|
<if test="updateBy != null">update_by =
|
|
#{updateBy},
|
|
</if>
|
|
<if test="updateTime != null">update_time =
|
|
#{updateTime},
|
|
</if>
|
|
<if test="remark != null">remark =
|
|
#{remark},
|
|
</if>
|
|
<if test="province != null">province =
|
|
#{province},
|
|
</if>
|
|
<if test="city != null">city =
|
|
#{city},
|
|
</if>
|
|
<if test="area != null">area =
|
|
#{area},
|
|
</if>
|
|
<if test="isBlack != null">is_black =
|
|
#{isBlack},
|
|
</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteZdyUserById" parameterType="Long">
|
|
delete
|
|
from zdy_user
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteZdyUserByIds" parameterType="String">
|
|
delete from zdy_user where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectZdyUserByOpenId" parameterType="String" resultMap="ZdyUserResult">
|
|
<include refid="selectZdyUserVo"/>
|
|
where open_id = #{openId} limit 1
|
|
</select>
|
|
|
|
<select id="selectZdyUserByMobile" parameterType="String" resultMap="ZdyUserResult">
|
|
<include refid="selectZdyUserVo"/>
|
|
where mobile = #{mobile} limit 1
|
|
</select>
|
|
|
|
</mapper>
|