193 lines
9.5 KiB
XML
193 lines
9.5 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.ruoyi.system.mapper.ShopUserMapper">
|
|
|
|
|
|
<!-- Insert -->
|
|
<insert id="insert" parameterType="com.ruoyi.common.core.domain.entity.ShopUser" useGeneratedKeys="true" keyProperty="id">
|
|
INSERT INTO shop_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="username != null">username,</if>
|
|
<if test="password != null">password,</if>
|
|
<if test="phone != null">phone,</if>
|
|
<if test="nickname != null">nickname,</if>
|
|
<if test="sex != null">sex,</if>
|
|
<if test="birthday != null">birthday,</if>
|
|
<if test="addr != null">addr,</if>
|
|
<if test="registerTime != null">register_time,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="vip != null">vip,</if>
|
|
<if test="online != null">online,</if>
|
|
<if test="deviceId != null">device_id,</if>
|
|
<if test="deviceType != null">device_type,</if>
|
|
<if test="headImg != null">head_img,</if>
|
|
<if test="vipStartTime != null">vip_start_time,</if>
|
|
<if test="vipEndTime != null">vip_end_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="username != null">#{username},</if>
|
|
<if test="password != null">#{password},</if>
|
|
<if test="phone != null">#{phone},</if>
|
|
<if test="nickname != null">#{nickname},</if>
|
|
<if test="sex != null">#{sex},</if>
|
|
<if test="birthday != null">#{birthday},</if>
|
|
<if test="addr != null">#{addr},</if>
|
|
<if test="registerTime != null">#{registerTime},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="vip != null">#{vip},</if>
|
|
<if test="online != null">#{online},</if>
|
|
<if test="deviceId != null">#{deviceId},</if>
|
|
<if test="deviceType != null">#{deviceType},</if>
|
|
<if test="headImg != null">#{headImg},</if>
|
|
<if test="vipStartTime != null">#{vipStartTime},</if>
|
|
<if test="vipEndTime != null">#{vipEndTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<resultMap type="ShopUser" id="ShopUserResult">
|
|
<result property="id" column="id" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="username" column="username" />
|
|
<result property="password" column="password" />
|
|
<result property="phone" column="phone" />
|
|
<result property="nickname" column="nickname" />
|
|
<result property="sex" column="sex" />
|
|
<result property="birthday" column="birthday" />
|
|
<result property="addr" column="addr" />
|
|
<result property="registerTime" column="register_time" />
|
|
<result property="status" column="status" />
|
|
<result property="vip" column="vip" />
|
|
<result property="online" column="online" />
|
|
<result property="deviceId" column="device_id" />
|
|
<result property="deviceType" column="device_type" />
|
|
<result property="headImg" column="head_img" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="isDel" column="is_del" />
|
|
</resultMap>
|
|
|
|
<sql id="selectShopUserVo">
|
|
select id, user_id, username, password,device_type,device_id, phone, nickname, sex, birthday, addr, register_time, status, vip, online, create_time, update_time, is_del,head_img,vip_end_time,vip_start_time from shop_user
|
|
</sql>
|
|
|
|
<select id="selectShopUserList" parameterType="ShopUser" resultMap="ShopUserResult">
|
|
<include refid="selectShopUserVo"/>
|
|
<where>
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
|
|
<if test="password != null and password != ''"> and password = #{password}</if>
|
|
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
|
<if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
|
|
<if test="sex != null "> and sex = #{sex}</if>
|
|
<if test="birthday != null "> and birthday = #{birthday}</if>
|
|
<if test="addr != null and addr != ''"> and addr = #{addr}</if>
|
|
<if test="registerTime != null "> and register_time = #{registerTime}</if>
|
|
<if test="status != null "> and status = #{status}</if>
|
|
<if test="vip != null "> and vip = #{vip}</if>
|
|
<if test="online != null and online != ''"> and online = #{online}</if>
|
|
<if test="isDel != null "> and is_del = #{isDel}</if>
|
|
<if test="vipStartTime != null"> and #{vipStartTime},</if>
|
|
<if test="vipEndTime != null"> and #{vipEndTime},</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="selectShopUserByPhone" resultMap="ShopUserResult">
|
|
SELECT * FROM shop_user where phone = #{phone}
|
|
</select>
|
|
|
|
<select id="selectShopUserByUsername" resultMap="ShopUserResult">
|
|
SELECT * FROM shop_user where username = #{username}
|
|
</select>
|
|
|
|
<select id="selectShopUserByUsernameAndPass" resultMap="ShopUserResult">
|
|
SELECT * FROM shop_user where username = #{username} and password = #{password}
|
|
</select>
|
|
|
|
|
|
<select id="selectShopUserById" parameterType="String" resultMap="ShopUserResult">
|
|
<include refid="selectShopUserVo"/>
|
|
where shop_user.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertShopUser" parameterType="ShopUser" useGeneratedKeys="true" keyProperty="id">
|
|
insert into shop_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="username != null">username,</if>
|
|
<if test="password != null">password,</if>
|
|
<if test="phone != null">phone,</if>
|
|
<if test="nickname != null">nickname,</if>
|
|
<if test="sex != null">sex,</if>
|
|
<if test="birthday != null">birthday,</if>
|
|
<if test="addr != null">addr,</if>
|
|
<if test="registerTime != null">register_time,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="vip != null">vip,</if>
|
|
<if test="online != null">online,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="isDel != null">is_del,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="username != null">#{username},</if>
|
|
<if test="password != null">#{password},</if>
|
|
<if test="phone != null">#{phone},</if>
|
|
<if test="nickname != null">#{nickname},</if>
|
|
<if test="sex != null">#{sex},</if>
|
|
<if test="birthday != null">#{birthday},</if>
|
|
<if test="addr != null">#{addr},</if>
|
|
<if test="registerTime != null">#{registerTime},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="vip != null">#{vip},</if>
|
|
<if test="online != null">#{online},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="isDel != null">#{isDel},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateShopUser" parameterType="ShopUser">
|
|
update shop_user
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="username != null">username = #{username},</if>
|
|
<if test="password != null">password = #{password},</if>
|
|
<if test="phone != null">phone = #{phone},</if>
|
|
<if test="nickname != null">nickname = #{nickname},</if>
|
|
<if test="sex != null">sex = #{sex},</if>
|
|
<if test="birthday != null">birthday = #{birthday},</if>
|
|
<if test="addr != null">addr = #{addr},</if>
|
|
<if test="registerTime != null">register_time = #{registerTime},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="vip != null">vip = #{vip},</if>
|
|
<if test="online != null">online = #{online},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="isDel != null">is_del = #{isDel},</if>
|
|
<if test="vipStartTime != null"> vip_start_time = #{vipStartTime},</if>
|
|
<if test="vipEndTime != null"> vip_end_time = #{vipEndTime},</if>
|
|
</trim>
|
|
where shop_user.user_id = #{userId}
|
|
</update>
|
|
|
|
<delete id="deleteShopUserById" parameterType="String">
|
|
delete from shop_user where id = #{id}
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteShopUserByIds" parameterType="String">
|
|
delete from shop_user where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectShopUserByUserId" resultMap="ShopUserResult">
|
|
<include refid="selectShopUserVo"/>
|
|
where shop_user.user_id = #{userId}
|
|
</select>
|
|
</mapper> |