electripper/electripper-system/src/main/resources/mapper/system/AsUserMapper.xml
18650502300 b76762a528 1. 修复押金抵扣接口当骑行费大于等于押金时,没有记录资金流水bug
2. 运营商不能修改硬件版本号不能修改,管理员可修改
   3. 验证码登录增加openid(验证码登录问题)
   5. 删除管理员用户时,同时解绑app用户
   6. 删除运营商时,判断名下有运营区、 收费方式提示都不能删
   7. 财务隔离-合伙人和运营商只能看到自己的账变和余额
   8. 关闭运营商中的分账功能开关
   9. 优化设备未绑定运营区不能获取到心跳推送问题
2024-08-19 10:14:05 +08:00

298 lines
14 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.AsUserMapper">
<resultMap type="AsUser" id="AsUserResult">
<id property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="realName" column="real_name" />
<result property="idCard" column="id_card" />
<result property="nickName" column="nick_name" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="balance" column="balance" />
<result property="birthday" column="birthday" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="payPassword" column="pay_password" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<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="wxopenid" column="wxopenid" />
<result property="role" column="role" />
<result property="isSign" column="is_sign" />
<result property="sysUserId" column="sys_user_id" />
<result property="areaId" column="area_id" />
<result property="isAuthentication" column="is_authentication" />
<result property="appName" column="app_name" />
<result property="appId" column="appid" />
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,
u.phonenumber, u.balance, u.birthday, u.password, u.pay_password, u.sex, u.status,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,
u.is_sign,u.role,u.sys_user_id,u.area_id,u.is_authentication,u.app_name,u.appid
from et_user u
</sql>
<select id="selectUserList" parameterType="AsUser" resultMap="AsUserResult">
select u.user_id, u.nick_name, u.user_name, u.real_name,u.email, u.avatar, u.phonenumber, u.balance,
u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
u.wxopenid,u.is_sign,u.role,u.sys_user_id,u.area_id,u.is_authentication,u.app_name,u.appid from et_user u
where u.del_flag = '0'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
</if>
<if test="sysUserId != null and sysUserId != 0">
AND u.sys_user_id = #{sysUserId}
</if>
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
order by u.login_date desc
</select>
<select id="selectAllocatedList" parameterType="AsUser" resultMap="AsUserResult">
select distinct u.user_id, u.user_name, u.nick_name,u.real_name, u.email, u.phonenumber, u.balance, u.status, u.create_time
from et_user u
where u.del_flag = '0'
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
</select>
<select id="selectUnallocatedList" parameterType="AsUser" resultMap="AsUserResult">
select distinct u.user_id, u.user_name,u.real_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from et_user u
where u.del_flag = '0'
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
</select>
<select id="selectUserByUserName" parameterType="String" resultMap="AsUserResult">
<include refid="selectUserVo"/>
where u.user_name = #{userName} and u.del_flag = '0'
</select>
<select id="selectUserById" parameterType="Long" resultMap="AsUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="AsUserResult">
select user_id, user_name from et_user where user_name = #{userName} and del_flag = '0' limit 1
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="AsUserResult">
select user_id, phonenumber from et_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
</select>
<select id="checkEmailUnique" parameterType="String" resultMap="AsUserResult">
select user_id, email from et_user where email = #{email} and del_flag = '0' limit 1
</select>
<select id="selectUserByPhone" parameterType="String" resultMap="AsUserResult">
<include refid="selectUserVo"/>
where u.phonenumber = #{phonenumber}
</select>
<select id="selectUserByPhoneAndAppId" parameterType="String" resultMap="AsUserResult">
<include refid="selectUserVo"/>
where u.phonenumber = #{phone} and u.appid = #{appid}
</select>
<select id="selectUserByWxopenid" parameterType="String" resultMap="AsUserResult">
<include refid="selectUserVo"/>
where u.wxopenid = #{openid}
</select>
<select id="getNewUser" resultType="java.lang.String">
select count(1) from et_user
where date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
and date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
and status = '0'
<if test="areaId != null and areaId != ''">
and area_id = #{areaId}
</if>
</select>
<select id="getLeaseUser" resultType="java.lang.String">
SELECT COUNT(DISTINCT o.user_id) from et_order o LEFT JOIN et_user u on o.user_id = u.user_id
where date_format(o.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
and date_format(o.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
and type = 1
<if test="areaId != null and areaId != ''">
and o.area_id = #{areaId}
</if>
</select>
<select id="getTotalUser" resultType="java.lang.String">
select count(1) from et_user
where status = '0'
<if test="areaId != null and areaId != ''">
and area_id = #{areaId}
</if>
</select>
<select id="fastSearch" resultType="com.ruoyi.common.core.domain.vo.LabelVo">
select phonenumber label,user_id as `value`,app_name appName from et_user where phonenumber like concat('%', #{phonenumber}, '%')
</select>
<select id="selectAllCount" resultType="java.lang.Integer">
select count(DISTINCT phonenumber) from et_user where 1=1
<if test="timeStart != null and timeStart != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
</select>
<insert id="insertUser" parameterType="AsUser" useGeneratedKeys="true" keyProperty="userId">
insert into et_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="realName != null and realName != ''">real_name,</if>
<if test="idCard != null and idCard != ''">id_card,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="balance != null and balance != ''">balance,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if>
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="wxopenid != null and wxopenid != ''">wxopenid,</if>
<if test="role != null and role != ''">role,</if>
<if test="isSign != null and isSign != ''">is_sign,</if>
<if test="sysUserId != null and sysUserId != ''">sys_user_id,</if>
<if test="areaId != null">area_id,</if>
<if test="isAuthentication != null">is_authentication,</if>
<if test="appName != null and appName != ''">app_name,</if>
<if test="appId != null and appId != ''">appid,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="realName != null and realName != ''">#{realName},</if>
<if test="idCard != null and idCard != ''">#{idCard},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="balance != null and balance != ''">#{balance},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="wxopenid != null and wxopenid != ''">#{wxopenid},</if>
<if test="role != null and role != ''">#{role},</if>
<if test="isSign != null and isSign != ''">#{isSign},</if>
<if test="sysUserId != null and sysUserId != ''">#{sysUserId},</if>
<if test="areaId != null">#{areaId},</if>
<if test="isAuthentication != null">#{isAuthentication},</if>
<if test="appName != null and appName != ''">#{appName},</if>
<if test="appId != null and appId != ''">#{appId},</if>
sysdate()
)
</insert>
<update id="updateUser" parameterType="AsUser">
update et_user
<set>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="realName != null and realName != ''">real_name = #{realName},</if>
<if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="balance != null ">balance = #{balance},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="wxopenid != null">wxopenid = #{wxopenid},</if>
<if test="role != null">role = #{role},</if>
<if test="isSign != null">is_sign = #{isSign},</if>
<if test="sysUserId != null">sys_user_id = #{sysUserId},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="isAuthentication != null">is_authentication = #{isAuthentication},</if>
<if test="appName != null">app_name = #{appName},</if>
<if test="appId != null">appid = #{appId},</if>
update_time = sysdate()
</set>
where user_id = #{userId}
</update>
<update id="updateUserStatus" parameterType="AsUser">
update et_user set status = #{status} where user_id = #{userId}
</update>
<update id="updateUserAvatar" parameterType="AsUser">
update et_user set avatar = #{avatar} where user_name = #{userName}
</update>
<update id="resetUserPwd" parameterType="AsUser">
update et_user set password = #{password} where user_name = #{userName}
</update>
<update id="updateUserPwd">
update et_user set password = #{password} where user_id = #{userId}
</update>
<update id="unbindSystemUser">
update et_user set sys_user_id = null,role = null where user_id = #{userId}
</update>
<update id="unbindSystemUserBySysUserId">
update et_user set sys_user_id = null,role = null where sys_user_id = #{sysUserId}
</update>
<delete id="deleteUserById" parameterType="Long">
update et_user set del_flag = '2' where user_id = #{userId}
</delete>
<delete id="deleteUserByIds" parameterType="Long">
update et_user set del_flag = '2' where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>