改造:getAdminsByPhone接口
This commit is contained in:
@@ -643,7 +643,11 @@ public class MainController extends BaseController {
|
|||||||
throw new BusinessException("验证码不正确");
|
throw new BusinessException("验证码不正确");
|
||||||
}
|
}
|
||||||
// 注册管理员
|
// 注册管理员
|
||||||
if (userService.getAdminByPhone(phone) != null) {
|
final UserParam param = new UserParam();
|
||||||
|
param.setPhone(phone);
|
||||||
|
param.setTemplateId(user.getTemplateId());
|
||||||
|
param.setIsAdmin(true);
|
||||||
|
if (userService.getAdminByPhone(param) != null) {
|
||||||
throw new BusinessException("该手机号码已注册");
|
throw new BusinessException("该手机号码已注册");
|
||||||
}
|
}
|
||||||
// 添加租户
|
// 添加租户
|
||||||
@@ -665,7 +669,11 @@ public class MainController extends BaseController {
|
|||||||
company.setTenantId(tenant.getTenantId());
|
company.setTenantId(tenant.getTenantId());
|
||||||
company.setTemplateId(user.getTemplateId());
|
company.setTemplateId(user.getTemplateId());
|
||||||
tenantService.initialization(company);
|
tenantService.initialization(company);
|
||||||
final User adminByPhone = userService.getAdminByPhone(phone);
|
final UserParam userParam = new UserParam();
|
||||||
|
userParam.setIsAdmin(true);
|
||||||
|
userParam.setPhone(phone);
|
||||||
|
userParam.setTemplateId(user.getTemplateId());
|
||||||
|
final User adminByPhone = userService.getAdminByPhone(userParam);
|
||||||
|
|
||||||
// 设置过期时间
|
// 设置过期时间
|
||||||
Long tokenExpireTime = configProperties.getTokenExpireTime();
|
Long tokenExpireTime = configProperties.getTokenExpireTime();
|
||||||
@@ -785,7 +793,11 @@ public class MainController extends BaseController {
|
|||||||
throw new BusinessException("验证码不正确");
|
throw new BusinessException("验证码不正确");
|
||||||
}
|
}
|
||||||
// 注册管理员
|
// 注册管理员
|
||||||
if (userService.getAdminByPhone(phone) != null) {
|
final UserParam param = new UserParam();
|
||||||
|
param.setPhone(phone);
|
||||||
|
param.setIsAdmin(true);
|
||||||
|
param.setTemplateId(user.getTemplateId());
|
||||||
|
if (userService.getAdminByPhone(param) != null) {
|
||||||
throw new BusinessException("该手机号码已注册");
|
throw new BusinessException("该手机号码已注册");
|
||||||
}
|
}
|
||||||
// 添加租户
|
// 添加租户
|
||||||
@@ -821,7 +833,11 @@ public class MainController extends BaseController {
|
|||||||
}
|
}
|
||||||
final Company addCompany = tenantService.initialization(company);
|
final Company addCompany = tenantService.initialization(company);
|
||||||
if (ObjectUtil.isNotEmpty(addCompany)) {
|
if (ObjectUtil.isNotEmpty(addCompany)) {
|
||||||
final User adminByPhone = userService.getAdminByPhone(phone);
|
final UserParam userParam1 = new UserParam();
|
||||||
|
userParam1.setIsAdmin(true);
|
||||||
|
userParam1.setPhone(phone);
|
||||||
|
userParam1.setTemplateId(user.getTemplateId());
|
||||||
|
final User adminByPhone = userService.getAdminByPhone(userParam1);
|
||||||
|
|
||||||
// 设置过期时间
|
// 设置过期时间
|
||||||
Long tokenExpireTime = configProperties.getTokenExpireTime();
|
Long tokenExpireTime = configProperties.getTokenExpireTime();
|
||||||
|
|||||||
@@ -112,6 +112,10 @@ public class TenantController extends BaseController {
|
|||||||
@ApiOperation("修改租户")
|
@ApiOperation("修改租户")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody Tenant tenant) {
|
public ApiResult<?> update(@RequestBody Tenant tenant) {
|
||||||
|
final User loginUser = getLoginUser();
|
||||||
|
if(loginUser != null){
|
||||||
|
tenant.setTenantId(loginUser.getTenantId());
|
||||||
|
}
|
||||||
if (tenantService.updateById(tenant)) {
|
if (tenantService.updateById(tenant)) {
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public interface UserMapper extends BaseMapper<User> {
|
|||||||
void updateByUserId(@Param("param") User param);
|
void updateByUserId(@Param("param") User param);
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
User selectAdminByPhone(@Param("phone") String phone);
|
User selectAdminByPhone(@Param("param") UserParam param);
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
User selectByUserId(@Param("userId") Integer userId);
|
User selectByUserId(@Param("userId") Integer userId);
|
||||||
|
|||||||
@@ -294,14 +294,23 @@
|
|||||||
FROM sys_user a
|
FROM sys_user a
|
||||||
<where>
|
<where>
|
||||||
AND a.deleted = 0
|
AND a.deleted = 0
|
||||||
AND a.phone = #{phone}
|
AND a.phone = #{param.phone}
|
||||||
|
AND a.template_id = #{param.templateId}
|
||||||
AND (a.username = 'superAdmin' OR a.username = 'admin' OR a.is_admin = 1)
|
AND (a.username = 'superAdmin' OR a.username = 'admin' OR a.is_admin = 1)
|
||||||
|
LIMIT 1
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectListAllRel" resultType="com.gxwebsoft.common.system.entity.User">
|
<select id="selectListAllRel" resultType="com.gxwebsoft.common.system.entity.User">
|
||||||
<include refid="selectSql"></include>
|
SELECT a.*
|
||||||
LIMIT 50
|
FROM sys_user a
|
||||||
|
<where>
|
||||||
|
AND a.phone = #{param.phone}
|
||||||
|
AND a.template_id = #{param.templateId}
|
||||||
|
AND a.is_admin = 1
|
||||||
|
AND a.deleted = 0
|
||||||
|
LIMIT 1
|
||||||
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="pageRelAll" resultType="com.gxwebsoft.common.system.entity.User">
|
<select id="pageRelAll" resultType="com.gxwebsoft.common.system.entity.User">
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public interface UserService extends IService<User>, UserDetailsService {
|
|||||||
|
|
||||||
User addUser(UserParam userParam);
|
User addUser(UserParam userParam);
|
||||||
|
|
||||||
User getAdminByPhone(String phone);
|
User getAdminByPhone(UserParam param);
|
||||||
|
|
||||||
Integer userNumInPark(UserParam param);
|
Integer userNumInPark(UserParam param);
|
||||||
|
|
||||||
|
|||||||
@@ -270,8 +270,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getAdminByPhone(String phone) {
|
public User getAdminByPhone(UserParam param) {
|
||||||
return baseMapper.selectAdminByPhone(phone);
|
System.out.println("param222 = " + param);
|
||||||
|
return baseMapper.selectAdminByPhone(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -279,10 +280,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
final UserParam userParam = new UserParam();
|
final UserParam userParam = new UserParam();
|
||||||
userParam.setPhone(param.getPhone());
|
userParam.setPhone(param.getPhone());
|
||||||
userParam.setIsAdmin(true);
|
userParam.setIsAdmin(true);
|
||||||
userParam.setLimit(50L);
|
|
||||||
if(param.getTenantId() != null){
|
|
||||||
userParam.setTenantId(param.getTenantId());
|
|
||||||
}
|
|
||||||
if(param.getTemplateId() != null){
|
if(param.getTemplateId() != null){
|
||||||
userParam.setTemplateId(param.getTemplateId());
|
userParam.setTemplateId(param.getTemplateId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,6 +128,7 @@
|
|||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.tenant_id = #{param.keywords}
|
AND (a.tenant_id = #{param.keywords}
|
||||||
OR a.name LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.code LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
Reference in New Issue
Block a user