fengjundan 487768b9ba 1修改账号管理
2新增文件上传服务
2021-07-27 18:38:32 +08:00

192 lines
7.9 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.xhpc.user.mapper.XhpcAppUserMapper">
<resultMap type="com.xhpc.user.domain.XhpcAppUser" id="XhpcAppUserResult">
<result column="app_user_id" property="appUserId"/>
<result column="phone" property="phone"/>
<result column="weixin_open_id" property="weixinOpenId"/>
<result column="alipay_open_id" property="alipayOpenId"/>
<result column="weixin_login" property="weixinLogin"/>
<result column="alipay_login" property="alipayLogin"/>
<result column="avatar" property="avatar"/>
<result column="balance" property="balance"/>
<result column="password" property="password"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/>
</resultMap>
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcAppUser" useGeneratedKeys="true"
keyProperty="appUserId">
INSERT INTO xhpc_app_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != appUserId and '' != appUserId">
app_user_id,
</if>
<if test="null != phone and '' != phone">
phone,
</if>
<if test="null != weixinOpenId and '' != weixinOpenId">
weixin_open_id,
</if>
<if test="null != alipayOpenId and '' != alipayOpenId">
alipay_open_id,
</if>
<if test="null != weixinLogin and '' != weixinLogin">
weixin_login,
</if>
<if test="null != alipayLogin and '' != alipayLogin">
alipay_login,
</if>
<if test="null != avatar and '' != avatar">
avatar,
</if>
<if test="null != balance and '' != balance">
balance,
</if>
<if test="null != password and '' != password">
password,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != remark and '' != remark">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != appUserId and '' != appUserId">
#{appUserId},
</if>
<if test="null != phone and '' != phone">
#{phone},
</if>
<if test="null != weixinOpenId and '' != weixinOpenId">
#{weixinOpenId},
</if>
<if test="null != alipayOpenId and '' != alipayOpenId">
#{alipayOpenId},
</if>
<if test="null != weixinLogin and '' != weixinLogin">
#{weixinLogin},
</if>
<if test="null != alipayLogin and '' != alipayLogin">
#{alipayLogin},
</if>
<if test="null != avatar and '' != avatar">
#{avatar},
</if>
<if test="null != balance and '' != balance">
#{balance},
</if>
<if test="null != password and '' != password">
#{password},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</trim>
</insert>
<update id="update" parameterType="com.xhpc.user.domain.XhpcInternetUser">
UPDATE xhpc_app_user
<set>
<if test="null != phone and '' != phone">phone = #{phone},</if>
<if test="null != weixinOpenId and '' != weixinOpenId">weixin_open_id = #{weixinOpenId},</if>
<if test="null != alipayOpenId and '' != alipayOpenId">alipay_open_id = #{alipayOpenId},</if>
<if test="null != weixinLogin and ''">weixin_login = #{weixinLogin},</if>
<if test="null != alipayLogin and ''">alipay_login = #{alipayLogin},</if>
<if test="null != avatar and '' != avatar">avatar = #{avatar},</if>
<if test="null != balance and '' != balance">balance = #{balance},</if>
<if test="null != password and '' != password">password = #{password},</if>
<if test="null != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != updateTime ">update_time = #{updateTime},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>
WHERE app_user_id = #{appUserId}
</update>
<delete id="deleteById" parameterType="java.lang.Long">
update xhpc_app_user set del_flag = 2 where app_user_id = #{appUserId}
</delete>
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select app_user_id appUserId, phone, weixin_open_id weixinOpenId,
weixin_login weixinlogin,alipay_login alipayLogin,
alipay_open_id alipayOpenId, avatar, balance, password,
`status`,create_by createBy ,create_time createTime,
update_time updateTime, update_by updateBy,
del_flag delflag, remark,
CASE WHEN `status` = 0 THEN '正常' else '禁用' end statusName
from xhpc_app_user
WHERE del_flag = 0 and app_user_id = #{appUserId}
</select>
<select id="selectAppUserList" parameterType="java.lang.Long" resultType="java.util.Map">
select app_user_id appUserId, phone, balance,
`status`,create_time createTime,
CASE WHEN `status` = 0 THEN '正常' else '禁用' end statusName
from xhpc_app_user
WHERE del_flag = 0
<if test="phone != null and phone != ''">
and phone like concat(concat('%', #{phone}), '%')
</if>
ORDER BY create_time DESC
</select>
<select id="getAppUserByPhone" parameterType="java.lang.String" resultMap="XhpcAppUserResult">
select *
from xhpc_app_user
WHERE del_flag = 0 and phone = #{phone} LIMIT 1
</select>
<select id="getAppUserByOpenid" parameterType="java.lang.String" resultMap="XhpcAppUserResult">
select *
from xhpc_app_user
WHERE del_flag = 0 and (weixin_open_id = #{openid}or alipay_open_id = #{openid}) LIMIT 1
</select>
</mapper>