no message
This commit is contained in:
119
src/main/resources/mapper/BaseUserMapper.xml
Normal file
119
src/main/resources/mapper/BaseUserMapper.xml
Normal file
@ -0,0 +1,119 @@
|
||||
<?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.sczx.sync.mapper.BaseUserMapper">
|
||||
|
||||
<!-- 通用查询结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="com.sczx.sync.po.BaseUser">
|
||||
<id column="id" property="id"/>
|
||||
<result column="user_name" property="userName"/>
|
||||
<result column="avatar_url" property="avatarUrl"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="phone_number" property="phoneNumber"/>
|
||||
<result column="role_id" property="roleId"/>
|
||||
<result column="is_store" property="isStore"/>
|
||||
<result column="nick_name" property="nickName"/>
|
||||
<result column="wechat_openid" property="wechatOpenid"/>
|
||||
<result column="operator_id" property="operatorId"/>
|
||||
<result column="store_id" property="storeId"/>
|
||||
<result column="alipay_userid" property="alipayUserid"/>
|
||||
<result column="authed" property="authed"/>
|
||||
<result column="id_no" property="idNo"/>
|
||||
<result column="real_name" property="realName"/>
|
||||
<result column="front_photo" property="frontPhoto"/>
|
||||
<result column="back_photo" property="backPhoto"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, user_name, avatar_url, phone_number, role_id, is_store, nick_name,id_no
|
||||
</sql>
|
||||
|
||||
<select id="selectByPhoneNumber" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM zc_base_user
|
||||
WHERE phone_number = #{phoneNumber}
|
||||
AND del_flag = 0
|
||||
</select>
|
||||
|
||||
<!-- 选择性插入用户信息 -->
|
||||
<insert id="insertBaseUser" parameterType="com.sczx.sync.po.BaseUser" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO zc_base_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userName != null">user_name,</if>
|
||||
<if test="avatarUrl != null">avatar_url,</if>
|
||||
<if test="password != null">password,</if>
|
||||
<if test="phoneNumber != null">phone_number,</if>
|
||||
<if test="roleId != null">role_id,</if>
|
||||
<if test="isStore != null">is_store,</if>
|
||||
<if test="nickName != null">nick_name,</if>
|
||||
<if test="wechatOpenid != null">wechat_openid,</if>
|
||||
<if test="operatorId != null">operator_id,</if>
|
||||
<if test="storeId != null">store_id,</if>
|
||||
<if test="alipayUserid != null">alipay_userid,</if>
|
||||
<if test="authed != null">authed,</if>
|
||||
<if test="idNo != null">id_no,</if>
|
||||
<if test="realName != null">real_name,</if>
|
||||
<if test="frontPhoto != null">front_photo,</if>
|
||||
<if test="backPhoto != null">back_photo,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
create_time,
|
||||
update_time,
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="userName != null">#{userName},</if>
|
||||
<if test="avatarUrl != null">#{avatarUrl},</if>
|
||||
<if test="password != null">#{password},</if>
|
||||
<if test="phoneNumber != null">#{phoneNumber},</if>
|
||||
<if test="roleId != null">#{roleId},</if>
|
||||
<if test="isStore != null">#{isStore},</if>
|
||||
<if test="nickName != null">#{nickName},</if>
|
||||
<if test="wechatOpenid != null">#{wechatOpenid},</if>
|
||||
<if test="operatorId != null">#{operatorId},</if>
|
||||
<if test="storeId != null">#{storeId},</if>
|
||||
<if test="alipayUserid != null">#{alipayUserid},</if>
|
||||
<if test="authed != null">#{authed},</if>
|
||||
<if test="idNo != null">#{idNo},</if>
|
||||
<if test="realName != null">#{realName},</if>
|
||||
<if test="frontPhoto != null">#{frontPhoto},</if>
|
||||
<if test="backPhoto != null">#{backPhoto},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
NOW(),
|
||||
NOW(),
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 根据手机号更新用户信息 -->
|
||||
<update id="updateByPhoneNumber" parameterType="com.sczx.sync.po.BaseUser">
|
||||
<selectKey keyProperty='id' resultType='java.lang.Long' order='AFTER'>
|
||||
SELECT
|
||||
id
|
||||
from zc_base_user
|
||||
where phone_number = #{phoneNumber}
|
||||
</selectKey>
|
||||
UPDATE zc_base_user
|
||||
<set>
|
||||
<if test="userName != null">user_name = #{userName},</if>
|
||||
<if test="avatarUrl != null">avatar_url = #{avatarUrl},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="roleId != null">role_id = #{roleId},</if>
|
||||
<if test="isStore != null">is_store = #{isStore},</if>
|
||||
<if test="nickName != null">nick_name = #{nickName},</if>
|
||||
<if test="wechatOpenid != null">wechat_openid = #{wechatOpenid},</if>
|
||||
<if test="operatorId != null">operator_id = #{operatorId},</if>
|
||||
<if test="storeId != null">store_id = #{storeId},</if>
|
||||
<if test="alipayUserid != null">alipay_userid = #{alipayUserid},</if>
|
||||
<if test="authed != null">authed = #{authed},</if>
|
||||
<if test="idNo != null">id_no = #{idNo},</if>
|
||||
<if test="realName != null">real_name = #{realName},</if>
|
||||
<if test="frontPhoto != null">front_photo = #{frontPhoto},</if>
|
||||
<if test="backPhoto != null">back_photo = #{backPhoto},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
update_time = NOW(),
|
||||
</set>
|
||||
WHERE phone_number = #{phoneNumber}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user