<?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.TAppUserMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ruoyi.system.model.TAppUser">
|
<id column="id" property="id" />
|
<result column="nick_name" property="nickName" />
|
<result column="avatar" property="avatar" />
|
<result column="phone_number" property="phoneNumber" />
|
<result column="gender" property="gender" />
|
<result column="birth_date" property="birthDate" />
|
<result column="status" property="status" />
|
<result column="open_id" property="openId" />
|
<result column="create_time" property="createTime" />
|
<result column="update_time" property="updateTime" />
|
<result column="create_by" property="createBy" />
|
<result column="update_by" property="updateBy" />
|
<result column="disabled" property="disabled" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, nick_name, avatar, phone_number, gender, birth_date, status, open_id, create_time, update_time, create_by, update_by, disabled
|
</sql>
|
<select id="pageList" resultType="com.ruoyi.system.model.TAppUser">
|
select t1.* from t_app_user t1
|
where t1.status != 3
|
<if test="query.nickName != null and query.nickName != ''">
|
and t1.name like concat('%',#{query.nickName},'%')
|
</if>
|
|
<if test="query.phoneNumber != null and query.phoneNumber != ''">
|
and t1.phone like concat('%',#{query.phoneNumber},'%')
|
</if>
|
<if test="query.status != null">
|
and t1.status = #{query.status}
|
</if>
|
<if test="query.promotionStatus != null">
|
and t1.promotion_status =1
|
</if>
|
|
order by t1.create_time desc
|
</select>
|
|
|
<select id="promotionPageList" resultType="com.ruoyi.system.vo.PromotionPageListVo">
|
select * from (
|
select t1.id userId,t1.name userName,t1.phone phone,t1.profile_photo avatar,t1.user_type roleName,t1.status
|
status,
|
t2.id lastUserId,t2.name lastUserName,t2.phone lastPhone,t2.profile_photo lastAvatar,t2.user_type lastRoleName,t1.create_time createTime
|
from t_app_user t1
|
left join t_app_user t2 on t1.referrer_user_id =t2.id
|
where t1.company_id = #{query.companyId} and t1.status !=3 and t1.referrer_user_id is not null
|
<if test="query.userName != null and query.userName != ''">
|
and t1.name like concat('%',#{query.userName},'%')
|
</if>
|
<if test="query.phone != null and query.phone != ''">
|
and t1.phone like concat('%',#{query.phone},'%')
|
</if>
|
<if test="query.lastUserName != null and query.lastUserName != ''">
|
and t2.name like concat('%',#{query.lastUserName},'%')
|
</if>
|
<if test="query.lastPhone != null and query.lastPhone != ''">
|
and t2.phone like concat('%',#{query.lastPhone},'%')
|
</if>
|
|
union all
|
select t1.id userId,t1.name userName,t1.phone phone,t1.profile_photo avatar,t1.user_type roleName,t1.status
|
status,
|
|
t2.user_id lastUserId,t2.nick_name lastUserName,t2.phonenumber lastPhone,t2.avatar lastAvatar,
|
|
case
|
when t2.role_type = 2 then 4
|
when t2.role_type = 3 then 5
|
end lastRoleName
|
,t1.create_time createTime
|
|
from t_app_user t1
|
left join sys_user t2 on t1.referrer_sys_user_id =t2.user_id
|
where t1.company_id = #{query.companyId} and t1.status !=3 and t1.referrer_user_id is null
|
<if test="query.userName != null and query.userName != ''">
|
and t1.name like concat('%',#{query.userName},'%')
|
</if>
|
<if test="query.phone != null and query.phone != ''">
|
and t1.phone like concat('%',#{query.phone},'%')
|
</if>
|
<if test="query.lastUserName != null and query.lastUserName != ''">
|
and t2.nick_name like concat('%',#{query.lastUserName},'%')
|
</if>
|
<if test="query.lastPhone != null and query.lastPhone != ''">
|
and t2.phonenumber like concat('%',#{query.lastPhone},'%')
|
</if>
|
|
) as t3
|
order by t3.createTime desc
|
</select>
|
<select id="promotionPageListExport" resultType="com.ruoyi.system.vo.PromotionPageListVo">
|
select * from (
|
select t1.id userId,t1.name userName,t1.phone phone,t1.profile_photo avatar,t1.user_type roleName,t1.status
|
status,
|
t2.id lastUserId,t2.name lastUserName,t2.phone lastPhone,t2.profile_photo lastAvatar,t2.user_type lastRoleName,t1.create_time createTime
|
from t_app_user t1
|
left join t_app_user t2 on t1.referrer_user_id =t2.id
|
where t1.company_id = #{query.companyId} and t1.status !=3 and t1.referrer_user_id is not null
|
<if test="query.userName != null and query.userName != ''">
|
and t1.name like concat('%',#{query.userName},'%')
|
</if>
|
<if test="query.phone != null and query.phone != ''">
|
and t1.phone like concat('%',#{query.phone},'%')
|
</if>
|
<if test="query.lastUserName != null and query.lastUserName != ''">
|
and t2.name like concat('%',#{query.lastUserName},'%')
|
</if>
|
<if test="query.lastPhone != null and query.lastPhone != ''">
|
and t2.phone like concat('%',#{query.lastPhone},'%')
|
</if>
|
|
union all
|
select t1.id userId,t1.name userName,t1.phone phone,t1.profile_photo avatar,t1.user_type roleName,t1.status
|
status,
|
|
t2.user_id lastUserId,t2.nick_name lastUserName,t2.phonenumber lastPhone,t2.avatar lastAvatar,
|
|
case
|
when t2.role_type = 2 then 4
|
when t2.role_type = 3 then 5
|
end lastRoleName
|
,t1.create_time createTime
|
|
from t_app_user t1
|
left join sys_user t2 on t1.referrer_sys_user_id =t2.user_id
|
where t1.company_id = #{query.companyId} and t1.status !=3 and t1.referrer_user_id is null
|
<if test="query.userName != null and query.userName != ''">
|
and t1.name like concat('%',#{query.userName},'%')
|
</if>
|
<if test="query.phone != null and query.phone != ''">
|
and t1.phone like concat('%',#{query.phone},'%')
|
</if>
|
<if test="query.lastUserName != null and query.lastUserName != ''">
|
and t2.nick_name like concat('%',#{query.lastUserName},'%')
|
</if>
|
<if test="query.lastPhone != null and query.lastPhone != ''">
|
and t2.phonenumber like concat('%',#{query.lastPhone},'%')
|
</if>
|
|
) as t3
|
order by t3.createTime desc
|
</select>
|
<select id="exportAppUser" resultType="com.ruoyi.system.model.TAppUser">
|
select t1.* from t_app_user t1
|
where t1.status != 3
|
<if test="query.nickName != null and query.nickName != ''">
|
and t1.name like concat('%',#{query.nickName},'%')
|
</if>
|
|
<if test="query.phoneNumber != null and query.phoneNumber != ''">
|
and t1.phone like concat('%',#{query.phoneNumber},'%')
|
</if>
|
<if test="query.status != null">
|
and t1.status = #{query.status}
|
</if>
|
|
order by t1.create_time desc
|
</select>
|
<select id="transferPageUserList" resultType="com.ruoyi.system.model.TAppUser">
|
select t1.* from t_app_user t1
|
where t1.status != 3
|
<if test="query.nickName != null and query.nickName != ''">
|
and t1.name like concat('%',#{query.nickName},'%')
|
</if>
|
|
<if test="query.phoneNumber != null and query.phoneNumber != ''">
|
and( t1.phone like concat('%',#{query.phoneNumber},'%') or t1.code like concat('%',#{query.phoneNumber},'%') )
|
</if>
|
<if test="query.status != null">
|
and t1.status = #{query.status}
|
</if>
|
|
order by t1.create_time desc
|
</select>
|
|
<select id="userPromotionPageList" resultType="com.ruoyi.system.vo.UserPromotionPageListVo">
|
select t1.id userId,t1.name userName,t1.phone phone,t1.gender,t1.profile_photo avatar,t1.user_type roleName,t1.status status
|
from t_app_user t1
|
where t1.referrer_user_id = #{query.userId} and t1.status !=3 and t1.referrer_status =2
|
<if test="query.userName != null and query.userName != ''">
|
and t1.name like concat('%',#{query.userName},'%')
|
</if>
|
<if test="query.phone != null and query.phone != ''">
|
and t1.phone like concat('%',#{query.phone},'%')
|
</if>
|
order by t1.create_time desc
|
</select>
|
<select id="userPromotionPageListExport" resultType="com.ruoyi.system.vo.UserPromotionPageListVo">
|
select t1.id userId,t1.name userName,t1.phone phone,t1.gender,t1.profile_photo avatar,t1.user_type roleName,t1.status status
|
from t_app_user t1
|
where t1.referrer_user_id = #{query.userId} and t1.status !=3 and t1.referrer_status =2
|
<if test="query.userName != null and query.userName != ''">
|
and t1.name like concat('%',#{query.userName},'%')
|
</if>
|
<if test="query.phone != null and query.phone != ''">
|
and t1.phone like concat('%',#{query.phone},'%')
|
</if>
|
order by t1.create_time desc
|
</select>
|
|
</mapper>
|