新增:getAdminsByPhone()方法
This commit is contained in:
@@ -23,6 +23,7 @@ import com.gxwebsoft.common.core.security.JwtSubject;
|
|||||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
import com.gxwebsoft.common.core.utils.CacheClient;
|
import com.gxwebsoft.common.core.utils.CacheClient;
|
||||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||||
|
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
@@ -54,7 +55,9 @@ import java.time.Instant;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录认证控制器
|
* 登录认证控制器
|
||||||
@@ -501,19 +504,27 @@ public class MainController extends BaseController {
|
|||||||
String message = "验证码不正确";
|
String message = "验证码不正确";
|
||||||
return fail(message, null);
|
return fail(message, null);
|
||||||
}
|
}
|
||||||
user = userService.getAdminByPhone(phone);
|
// 单用户登录
|
||||||
if(user == null){
|
final List<User> adminsByPhone = userService.getAdminsByPhone(param);
|
||||||
|
if(adminsByPhone.isEmpty()){
|
||||||
return fail("用户不存在",null);
|
return fail("用户不存在",null);
|
||||||
}
|
}
|
||||||
|
user = adminsByPhone.get(0);
|
||||||
// 签发token
|
// 签发token
|
||||||
String access_token = JwtUtil.buildToken(new JwtSubject(phone, user.getTenantId()),
|
String access_token = JwtUtil.buildToken(new JwtSubject(phone, user.getTenantId()),
|
||||||
tokenExpireTime, configProperties.getTokenKey());
|
tokenExpireTime, configProperties.getTokenKey());
|
||||||
|
// 同一个手机号码存在多个管理员账号
|
||||||
|
if(adminsByPhone.size() > 1){
|
||||||
|
String message = "请选择登录用户";
|
||||||
|
user.setHasAdminsByPhone(true);
|
||||||
|
return success(message, new LoginResult(access_token, user));
|
||||||
|
}
|
||||||
return success("登录成功", new LoginResult(access_token, user));
|
return success("登录成功", new LoginResult(access_token, user));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 普通用户登录
|
// 普通用户登录
|
||||||
if(tenantId == null){
|
if(tenantId == null){
|
||||||
return fail("TenantId不存在",null);
|
return fail("用户不存在",null);
|
||||||
}
|
}
|
||||||
if (!code.equals(redisUtil.get(key)) && !"789789".equals(code)) {
|
if (!code.equals(redisUtil.get(key)) && !"789789".equals(code)) {
|
||||||
String message = "验证码不正确";
|
String message = "验证码不正确";
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.gxwebsoft.common.core.security.JwtUtil;
|
|||||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||||
import com.gxwebsoft.common.core.web.*;
|
import com.gxwebsoft.common.core.web.*;
|
||||||
import com.gxwebsoft.common.system.entity.*;
|
import com.gxwebsoft.common.system.entity.*;
|
||||||
|
import com.gxwebsoft.common.system.param.LoginParam;
|
||||||
import com.gxwebsoft.common.system.param.UserImportParam;
|
import com.gxwebsoft.common.system.param.UserImportParam;
|
||||||
import com.gxwebsoft.common.system.param.UserParam;
|
import com.gxwebsoft.common.system.param.UserParam;
|
||||||
import com.gxwebsoft.common.system.result.LoginResult;
|
import com.gxwebsoft.common.system.result.LoginResult;
|
||||||
@@ -509,4 +510,10 @@ public class UserController extends BaseController {
|
|||||||
return success("统计成功", userService.orgNumInPark(param));
|
return success("统计成功", userService.orgNumInPark(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:auth:user')")
|
||||||
|
@ApiOperation("查询全部用户")
|
||||||
|
@GetMapping("/listAdminsByPhoneAll")
|
||||||
|
public ApiResult<List<User>> listAdminsByPhoneAll(LoginParam param){
|
||||||
|
return success(userService.getAdminsByPhone(param));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,6 +335,13 @@ public class User implements UserDetails {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Boolean hasParent;
|
private Boolean hasParent;
|
||||||
|
|
||||||
|
@ApiModelProperty("同一个手机号码存在多个管理员账号")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean hasAdminsByPhone;
|
||||||
|
|
||||||
|
@ApiModelProperty("模板ID")
|
||||||
|
private Integer templateId;
|
||||||
|
|
||||||
// @ApiModelProperty("企业信息")
|
// @ApiModelProperty("企业信息")
|
||||||
// @TableField(exist = false)
|
// @TableField(exist = false)
|
||||||
// private Company companyInfo;
|
// private Company companyInfo;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.common.system.mapper;
|
package com.gxwebsoft.common.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
@@ -58,4 +59,9 @@ public interface UserMapper extends BaseMapper<User> {
|
|||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
User selectByUserId(@Param("userId") Integer userId);
|
User selectByUserId(@Param("userId") Integer userId);
|
||||||
|
|
||||||
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
|
List<User> selectListAllRel(@Param("param") UserParam param);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,246 +2,255 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="com.gxwebsoft.common.system.mapper.UserMapper">
|
<mapper namespace="com.gxwebsoft.common.system.mapper.UserMapper">
|
||||||
|
|
||||||
<!-- 性别字典查询sql -->
|
<!-- 性别字典查询sql -->
|
||||||
<sql id="selectSexDictSql">
|
<sql id="selectSexDictSql">
|
||||||
SELECT ta.*
|
SELECT ta.*
|
||||||
FROM sys_dictionary_data ta
|
FROM sys_dictionary_data ta
|
||||||
LEFT JOIN sys_dictionary tb
|
LEFT JOIN sys_dictionary tb
|
||||||
ON ta.dict_id = tb.dict_id
|
ON ta.dict_id = tb.dict_id
|
||||||
AND tb.deleted = 0
|
AND tb.deleted = 0
|
||||||
WHERE ta.deleted = 0
|
WHERE ta.deleted = 0
|
||||||
AND tb.dict_code = 'sex'
|
AND tb.dict_code = 'sex'
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 用户角色查询sql -->
|
<!-- 用户角色查询sql -->
|
||||||
<sql id="selectUserRoleSql">
|
<sql id="selectUserRoleSql">
|
||||||
SELECT a.user_id,
|
SELECT a.user_id,
|
||||||
GROUP_CONCAT(b.role_name) role_name
|
GROUP_CONCAT(b.role_name) role_name
|
||||||
FROM sys_user_role a
|
FROM sys_user_role a
|
||||||
LEFT JOIN sys_role b ON a.role_id = b.role_id
|
LEFT JOIN sys_role b ON a.role_id = b.role_id
|
||||||
GROUP BY a.user_id
|
GROUP BY a.user_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*,
|
SELECT a.*,
|
||||||
b.organization_name,
|
b.organization_name,
|
||||||
c.dict_data_name sex_name,
|
c.dict_data_name sex_name,
|
||||||
e.name as groupName,
|
e.name as groupName,
|
||||||
f.name as gradeName,
|
f.name as gradeName,
|
||||||
g.company_name as companyName,g.company_logo as logo,
|
g.company_name as companyName,g.company_logo as logo,
|
||||||
t.tenant_name as tenantName
|
t.tenant_name as tenantName
|
||||||
FROM sys_user a
|
FROM sys_user a
|
||||||
LEFT JOIN sys_organization b ON a.organization_id = b.organization_id
|
LEFT JOIN sys_organization b ON a.organization_id = b.organization_id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
<include refid="selectSexDictSql"/>
|
<include refid="selectSexDictSql"/>
|
||||||
) c ON a.sex = c.dict_data_code
|
) c ON a.sex = c.dict_data_code
|
||||||
LEFT JOIN(
|
LEFT JOIN(
|
||||||
<include refid="selectUserRoleSql"/>
|
<include refid="selectUserRoleSql"/>
|
||||||
) d ON a.user_id = d.user_id
|
) d ON a.user_id = d.user_id
|
||||||
LEFT JOIN sys_user_group e ON a.group_id = e.group_id
|
LEFT JOIN sys_user_group e ON a.group_id = e.group_id
|
||||||
LEFT JOIN sys_user_grade f ON a.grade_id = f.grade_id
|
LEFT JOIN sys_user_grade f ON a.grade_id = f.grade_id
|
||||||
LEFT JOIN sys_tenant t ON a.tenant_id = t.tenant_id
|
LEFT JOIN sys_tenant t ON a.tenant_id = t.tenant_id
|
||||||
LEFT JOIN sys_company g ON g.tenant_id = t.tenant_id
|
LEFT JOIN sys_company g ON g.tenant_id = t.tenant_id
|
||||||
<where>
|
<where>
|
||||||
<if test="param.userId != null">
|
<if test="param.userId != null">
|
||||||
AND a.user_id = #{param.userId}
|
AND a.user_id = #{param.userId}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.username != null">
|
<if test="param.username != null">
|
||||||
AND a.username LIKE CONCAT('%', #{param.username}, '%')
|
AND a.username LIKE CONCAT('%', #{param.username}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.uid != null">
|
<if test="param.uid != null">
|
||||||
AND a.uid = #{param.uid}
|
AND a.uid = #{param.uid}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.userCode != null">
|
<if test="param.userCode != null">
|
||||||
AND a.user_code = #{param.userCode}
|
AND a.user_code = #{param.userCode}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.nickname != null">
|
<if test="param.nickname != null">
|
||||||
AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%')
|
AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.type != null">
|
<if test="param.type != null">
|
||||||
AND a.type = #{param.type}
|
AND a.type = #{param.type}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.sex != null">
|
<if test="param.sex != null">
|
||||||
AND a.sex = #{param.sex}
|
AND a.sex = #{param.sex}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.phone != null">
|
<if test="param.phone != null">
|
||||||
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
|
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.email != null">
|
<if test="param.email != null">
|
||||||
AND a.email LIKE CONCAT('%', #{param.email}, '%')
|
AND a.email LIKE CONCAT('%', #{param.email}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.emailVerified != null">
|
<if test="param.emailVerified != null">
|
||||||
AND a.email_verified = #{param.emailVerified}
|
AND a.email_verified = #{param.emailVerified}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.realName != null">
|
<if test="param.realName != null">
|
||||||
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
|
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.companyName != null">
|
<if test="param.companyName != null">
|
||||||
AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%')
|
AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.idCard != null">
|
<if test="param.idCard != null">
|
||||||
AND a.id_card LIKE CONCAT('%', #{param.idCard}, '%')
|
AND a.id_card LIKE CONCAT('%', #{param.idCard}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.birthday != null">
|
<if test="param.birthday != null">
|
||||||
AND a.birthday LIKE CONCAT('%', #{param.birthday}, '%')
|
AND a.birthday LIKE CONCAT('%', #{param.birthday}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.organizationId != null">
|
<if test="param.organizationId != null">
|
||||||
AND a.organization_id = #{param.organizationId}
|
AND a.organization_id = #{param.organizationId}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.groupId != null">
|
<if test="param.groupId != null">
|
||||||
AND a.group_id = #{param.groupId}
|
AND a.group_id = #{param.groupId}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.isStaff != null">
|
<if test="param.isStaff != null">
|
||||||
AND a.organization_id > 0
|
AND a.organization_id > 0
|
||||||
</if>
|
</if>
|
||||||
<if test="param.merchantId != null">
|
<if test="param.merchantId != null">
|
||||||
AND a.merchant_id = #{param.merchantId}
|
AND a.merchant_id = #{param.merchantId}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.platform != null">
|
<if test="param.platform != null">
|
||||||
AND a.platform = #{param.platform}
|
AND a.platform = #{param.platform}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.status != null">
|
<if test="param.status != null">
|
||||||
AND a.`status` = #{param.status}
|
AND a.`status` = #{param.status}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.createTimeStart != null">
|
<if test="param.createTimeStart != null">
|
||||||
AND a.create_time >= #{param.createTimeStart}
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.createTimeEnd != null">
|
<if test="param.createTimeEnd != null">
|
||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.recommend != null">
|
<if test="param.recommend != null">
|
||||||
AND a.recommend = #{param.recommend}
|
AND a.recommend = #{param.recommend}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.gradeId != null">
|
<if test="param.gradeId != null">
|
||||||
AND a.grade_id = #{param.gradeId}
|
AND a.grade_id = #{param.gradeId}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.isAdmin != null">
|
<if test="param.isAdmin != null">
|
||||||
AND a.is_admin = #{param.isAdmin}
|
AND a.is_admin = #{param.isAdmin}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.isOrganizationAdmin != null">
|
<if test="param.templateId != null">
|
||||||
AND a.is_organization_admin = #{param.isOrganizationAdmin}
|
AND a.template_id = #{param.templateId}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.deleted != null">
|
<if test="param.isOrganizationAdmin != null">
|
||||||
AND a.deleted = #{param.deleted}
|
AND a.is_organization_admin = #{param.isOrganizationAdmin}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.deleted == null">
|
<if test="param.deleted != null">
|
||||||
AND a.deleted = 0
|
AND a.deleted = #{param.deleted}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.roleId != null">
|
<if test="param.deleted == null">
|
||||||
AND a.user_id IN (SELECT user_id FROM sys_user_role WHERE role_id=#{param.roleId})
|
|
||||||
</if>
|
|
||||||
<if test="param.roleCode != null">
|
|
||||||
AND a.user_id IN (SELECT user_id FROM sys_user_role WHERE role_code=#{param.roleCode})
|
|
||||||
</if>
|
|
||||||
<if test="param.userIds != null">
|
|
||||||
AND a.user_id IN
|
|
||||||
<foreach collection="param.userIds" item="item" separator="," open="(" close=")">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
<if test="param.organizationIds != null">
|
|
||||||
AND a.organization_id IN
|
|
||||||
<foreach collection="param.organizationIds" item="item" separator="," open="(" close=")">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
<if test="param.phones != null">
|
|
||||||
AND a.phone IN
|
|
||||||
<foreach collection="param.phones" item="item" separator="," open="(" close=")">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
<if test="param.province != null">
|
|
||||||
AND a.province LIKE CONCAT('%', #{param.province}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="param.city != null">
|
|
||||||
AND a.city LIKE CONCAT('%', #{param.city}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="param.region != null">
|
|
||||||
AND a.region LIKE CONCAT('%', #{param.region}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="param.organizationName != null">
|
|
||||||
AND b.organization_name LIKE CONCAT('%', #{param.organizationName}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="param.sexName != null">
|
|
||||||
AND c.dict_data_name = #{param.sexName}
|
|
||||||
</if>
|
|
||||||
<if test="param.expertType != null">
|
|
||||||
AND a.expert_type = #{param.expertType}
|
|
||||||
</if>
|
|
||||||
<if test="param.keywords != null">
|
|
||||||
AND (
|
|
||||||
a.username = #{param.keywords}
|
|
||||||
OR a.user_id = #{param.keywords}
|
|
||||||
OR a.id_card = #{param.keywords}
|
|
||||||
OR a.merchant_id = #{param.keywords}
|
|
||||||
OR a.nickname LIKE CONCAT('%', #{param.keywords}, '%')
|
|
||||||
OR a.real_name LIKE CONCAT('%', #{param.keywords}, '%')
|
|
||||||
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
|
||||||
OR a.email = #{param.keywords}
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
<if test="param.parentId != null">
|
|
||||||
AND a.organization_id IN (SELECT organization_id FROM sys_organization WHERE parent_id=#{param.parentId})
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<!-- 分页查询 -->
|
|
||||||
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.User">
|
|
||||||
<include refid="selectSql"></include>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 查询全部 -->
|
|
||||||
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.User">
|
|
||||||
<include refid="selectSql"></include>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据账号查询 -->
|
|
||||||
<select id="selectByUsername" resultType="com.gxwebsoft.common.system.entity.User">
|
|
||||||
SELECT a.* ,
|
|
||||||
b.organization_name,
|
|
||||||
c.dict_data_name sex_name
|
|
||||||
FROM sys_user a
|
|
||||||
LEFT JOIN sys_organization b ON a.organization_id = b.organization_id
|
|
||||||
LEFT JOIN (
|
|
||||||
<include refid="selectSexDictSql"/>
|
|
||||||
) c ON a.sex = c.dict_data_code
|
|
||||||
<where>
|
|
||||||
AND a.deleted = 0
|
|
||||||
AND (a.username = #{username} OR a.phone = #{username} OR a.email = #{username})
|
|
||||||
AND a.tenant_id = #{tenantId}
|
|
||||||
<!-- <if test="tenantId != null">-->
|
|
||||||
<!-- AND a.tenant_id = #{tenantId}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="tenantId == null">-->
|
|
||||||
<!-- AND a.tenant_id = 1-->
|
|
||||||
<!-- </if>-->
|
|
||||||
</where>
|
|
||||||
LIMIT 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据手机号码查询 -->
|
|
||||||
<select id="selectByPhone" resultType="com.gxwebsoft.common.system.entity.User">
|
|
||||||
SELECT a.*
|
|
||||||
FROM sys_user a
|
|
||||||
<where>
|
|
||||||
AND a.deleted = 0
|
AND a.deleted = 0
|
||||||
AND a.phone = #{phone}
|
</if>
|
||||||
<if test="tenantId != null">
|
<if test="param.roleId != null">
|
||||||
AND a.tenant_id = #{tenantId}
|
AND a.user_id IN (SELECT user_id FROM sys_user_role WHERE role_id=#{param.roleId})
|
||||||
</if>
|
</if>
|
||||||
<if test="tenantId == null">
|
<if test="param.roleCode != null">
|
||||||
AND a.tenant_id = 1
|
AND a.user_id IN (SELECT user_id FROM sys_user_role WHERE role_code=#{param.roleCode})
|
||||||
</if>
|
</if>
|
||||||
</where>
|
<if test="param.userIds != null">
|
||||||
LIMIT 1
|
AND a.user_id IN
|
||||||
</select>
|
<foreach collection="param.userIds" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="param.organizationIds != null">
|
||||||
|
AND a.organization_id IN
|
||||||
|
<foreach collection="param.organizationIds" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="param.phones != null">
|
||||||
|
AND a.phone IN
|
||||||
|
<foreach collection="param.phones" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="param.province != null">
|
||||||
|
AND a.province LIKE CONCAT('%', #{param.province}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.city != null">
|
||||||
|
AND a.city LIKE CONCAT('%', #{param.city}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.region != null">
|
||||||
|
AND a.region LIKE CONCAT('%', #{param.region}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.organizationName != null">
|
||||||
|
AND b.organization_name LIKE CONCAT('%', #{param.organizationName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.sexName != null">
|
||||||
|
AND c.dict_data_name = #{param.sexName}
|
||||||
|
</if>
|
||||||
|
<if test="param.expertType != null">
|
||||||
|
AND a.expert_type = #{param.expertType}
|
||||||
|
</if>
|
||||||
|
<if test="param.tenantId != null">
|
||||||
|
AND a.tenant_id = #{param.tenantId}
|
||||||
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (
|
||||||
|
a.username = #{param.keywords}
|
||||||
|
OR a.user_id = #{param.keywords}
|
||||||
|
OR a.id_card = #{param.keywords}
|
||||||
|
OR a.merchant_id = #{param.keywords}
|
||||||
|
OR a.nickname LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.real_name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.email = #{param.keywords}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="param.parentId != null">
|
||||||
|
AND a.organization_id IN (SELECT organization_id FROM sys_organization WHERE parent_id=#{param.parentId})
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.User">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.User">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据账号查询 -->
|
||||||
|
<select id="selectByUsername" resultType="com.gxwebsoft.common.system.entity.User">
|
||||||
|
SELECT a.* ,
|
||||||
|
b.organization_name,
|
||||||
|
c.dict_data_name sex_name
|
||||||
|
FROM sys_user a
|
||||||
|
LEFT JOIN sys_organization b ON a.organization_id = b.organization_id
|
||||||
|
LEFT JOIN (
|
||||||
|
<include refid="selectSexDictSql"/>
|
||||||
|
) c ON a.sex = c.dict_data_code
|
||||||
|
<where>
|
||||||
|
AND a.deleted = 0
|
||||||
|
AND (a.username = #{username} OR a.phone = #{username} OR a.email = #{username})
|
||||||
|
AND a.tenant_id = #{tenantId}
|
||||||
|
<!-- <if test="tenantId != null">-->
|
||||||
|
<!-- AND a.tenant_id = #{tenantId}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="tenantId == null">-->
|
||||||
|
<!-- AND a.tenant_id = 1-->
|
||||||
|
<!-- </if>-->
|
||||||
|
</where>
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据手机号码查询 -->
|
||||||
|
<select id="selectByPhone" resultType="com.gxwebsoft.common.system.entity.User">
|
||||||
|
SELECT a.*
|
||||||
|
FROM sys_user a
|
||||||
|
<where>
|
||||||
|
AND a.deleted = 0
|
||||||
|
AND a.phone = #{phone}
|
||||||
|
<if test="tenantId != null">
|
||||||
|
AND a.tenant_id = #{tenantId}
|
||||||
|
</if>
|
||||||
|
<if test="tenantId == null">
|
||||||
|
AND a.tenant_id = 1
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 查询单条数据 -->
|
<!-- 查询单条数据 -->
|
||||||
<select id="getOne" resultType="com.gxwebsoft.common.system.entity.User">
|
<select id="getOne" resultType="com.gxwebsoft.common.system.entity.User">
|
||||||
SELECT * FROM sys_user WHERE user_id = #{param.userId} and deleted = 0
|
SELECT *
|
||||||
|
FROM sys_user
|
||||||
|
WHERE user_id = #{param.userId}
|
||||||
|
and deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 查询统计数据 -->
|
<!-- 查询统计数据 -->
|
||||||
@@ -259,11 +268,15 @@
|
|||||||
|
|
||||||
<!-- 更新用户信息 -->
|
<!-- 更新用户信息 -->
|
||||||
<update id="updateByUserId">
|
<update id="updateByUserId">
|
||||||
UPDATE sys_user SET grade_id = #{param.gradeId} WHERE user_id = #{param.userId}
|
UPDATE sys_user
|
||||||
|
SET grade_id = #{param.gradeId}
|
||||||
|
WHERE user_id = #{param.userId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectByUserId" resultType="com.gxwebsoft.common.system.entity.User">
|
<select id="selectByUserId" resultType="com.gxwebsoft.common.system.entity.User">
|
||||||
SELECT * FROM sys_user WHERE user_id = #{userId}
|
SELECT *
|
||||||
|
FROM sys_user
|
||||||
|
WHERE user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据手机号码查询 -->
|
<!-- 根据手机号码查询 -->
|
||||||
@@ -273,8 +286,13 @@
|
|||||||
<where>
|
<where>
|
||||||
AND a.deleted = 0
|
AND a.deleted = 0
|
||||||
AND a.phone = #{phone}
|
AND a.phone = #{phone}
|
||||||
AND (a.username = 'superAdmin' OR a.username = 'admin')
|
AND (a.username = 'superAdmin' OR a.username = 'admin' OR a.is_admin = 1)
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectListAllRel" resultType="com.gxwebsoft.common.system.entity.User">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
LIMIT 50
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -232,6 +232,9 @@ public class UserParam extends BaseParam {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Date settlementTime;
|
private Date settlementTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("模板id")
|
||||||
|
private Integer templateId;
|
||||||
|
|
||||||
@ApiModelProperty("报餐时间")
|
@ApiModelProperty("报餐时间")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String deliveryTime;
|
private String deliveryTime;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.gxwebsoft.common.system.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.common.system.param.LoginParam;
|
||||||
import com.gxwebsoft.common.system.param.UserParam;
|
import com.gxwebsoft.common.system.param.UserParam;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
|
||||||
@@ -116,4 +117,6 @@ public interface UserService extends IService<User>, UserDetailsService {
|
|||||||
Integer userNumInPark(UserParam param);
|
Integer userNumInPark(UserParam param);
|
||||||
|
|
||||||
Integer orgNumInPark(UserParam param);
|
Integer orgNumInPark(UserParam param);
|
||||||
|
|
||||||
|
List<User> getAdminsByPhone(LoginParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.gxwebsoft.common.core.web.PageParam;
|
|||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.*;
|
import com.gxwebsoft.common.system.entity.*;
|
||||||
import com.gxwebsoft.common.system.mapper.UserMapper;
|
import com.gxwebsoft.common.system.mapper.UserMapper;
|
||||||
|
import com.gxwebsoft.common.system.param.LoginParam;
|
||||||
import com.gxwebsoft.common.system.param.UserParam;
|
import com.gxwebsoft.common.system.param.UserParam;
|
||||||
import com.gxwebsoft.common.system.service.*;
|
import com.gxwebsoft.common.system.service.*;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
@@ -274,7 +275,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getAdminByPhone(String phone) {
|
public User getAdminByPhone(String phone) {
|
||||||
return baseMapper.selectAdminByPhone(phone);
|
return baseMapper.selectAdminByPhone(phone);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<User> getAdminsByPhone(LoginParam param){
|
||||||
|
final UserParam userParam = new UserParam();
|
||||||
|
userParam.setPhone(param.getPhone());
|
||||||
|
userParam.setIsAdmin(true);
|
||||||
|
userParam.setTenantId(param.getTenantId());
|
||||||
|
userParam.setLimit(50L);
|
||||||
|
return baseMapper.selectListAllRel(userParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user