fix: 优化业务逻辑
This commit is contained in:
parent
864d9b31d4
commit
26931a5fbc
@ -202,7 +202,7 @@ public class UserController {
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@Log(module = "系统用户", value = "审核用户注册")
|
||||
// @Log(module = "系统用户", value = "审核用户注册")
|
||||
@PostMapping("/auditUser")
|
||||
@Operation(summary = "审核用户注册")
|
||||
@ResponseBody
|
||||
@ -226,7 +226,7 @@ public class UserController {
|
||||
@GetMapping("/queryPendingAuditUsers")
|
||||
@Operation(summary = "查询待审核用户列表")
|
||||
@ResponseBody
|
||||
public ResponseResult queryPendingAuditUsers(Page<SysUser> page,String name,String regStatus) {
|
||||
public ResponseResult queryPendingAuditUsers(Page<SysUser> page,String name,Integer regStatus) {
|
||||
Page<SysUser> result = userService.queryPendingAuditUsers(page,name,regStatus);
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
package com.yfd.platform.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -582,26 +584,26 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
|
||||
@Override
|
||||
public boolean auditUser(String userId, Integer auditStatus) {
|
||||
UpdateWrapper<SysUser> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", userId)
|
||||
.set("reg_status", auditStatus)
|
||||
.set("audit_user", SecurityUtils.getUserId())
|
||||
.set("audit_time", new Timestamp(System.currentTimeMillis()))
|
||||
.set("lastmodifydate", new Timestamp(System.currentTimeMillis()))
|
||||
.set("lastmodifier", getUsername());
|
||||
LambdaUpdateWrapper<SysUser> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(SysUser::getId, userId)
|
||||
.set(SysUser::getRegStatus, auditStatus)
|
||||
.set(SysUser::getAuditUser, SecurityUtils.getUserId())
|
||||
.set(SysUser::getAuditTime, new Timestamp(System.currentTimeMillis()))
|
||||
.set(SysUser::getLastmodifydate, new Timestamp(System.currentTimeMillis()))
|
||||
.set(SysUser::getLastmodifier, SecurityUtils.getCurrentUsername());
|
||||
if (auditStatus == 1) {
|
||||
updateWrapper.set("status", 1);
|
||||
updateWrapper.set(SysUser::getStatus, 1);
|
||||
} else if (auditStatus == 2) {
|
||||
updateWrapper.set("status", 0);
|
||||
updateWrapper.set(SysUser::getStatus, 0);
|
||||
}
|
||||
return this.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SysUser> queryPendingAuditUsers(Page<SysUser> page,String name,String regStatus) {
|
||||
public Page<SysUser> queryPendingAuditUsers(Page<SysUser> page,String name,Integer regStatus) {
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SysUser::getRegStatus, 0,1,2);
|
||||
queryWrapper.eq(SysUser::getRegStatus, regStatus);
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(regStatus),SysUser::getRegStatus, regStatus);
|
||||
queryWrapper.and(StrUtil.isNotBlank(name), wrapper ->
|
||||
wrapper.like(SysUser::getNickname, name)
|
||||
.or()
|
||||
|
||||
@ -69,9 +69,10 @@
|
||||
u.lastmodifydate
|
||||
FROM
|
||||
sys_user u
|
||||
where 1=1
|
||||
and (u.REG_STATUS!=0 and u.REG_STATUS !=2)
|
||||
and u.usertype != 0
|
||||
WHERE
|
||||
1 = 1
|
||||
AND ( ( u.REG_STATUS != 0 AND u.REG_STATUS != 2 ) OR u.REG_STATUS IS NULL )
|
||||
AND u.usertype != 0
|
||||
<if test="orgid != null">
|
||||
and u.orgid = #{orgid}
|
||||
</if>
|
||||
@ -82,14 +83,20 @@
|
||||
</select>
|
||||
<select id="getOrganizationByid" resultType="java.util.Map">
|
||||
SELECT DISTINCT
|
||||
u.id,u.username,u.nickname,u.email,u.phone,u.avatar,o.orgname,o.id oid,
|
||||
op.orgname porgname ,op.id poid
|
||||
FROM
|
||||
sys_user u
|
||||
u.id AS "id",
|
||||
u.username AS "username",
|
||||
u.nickname AS "nickname",
|
||||
u.email AS "email",
|
||||
u.phone AS "phone",
|
||||
u.avatar AS "avatar",
|
||||
o.orgname AS "orgname",
|
||||
o.id AS "oid",
|
||||
op.orgname AS "porgname",
|
||||
op.id AS "poid"
|
||||
FROM sys_user u
|
||||
INNER JOIN sys_organization o ON u.orgid = o.id
|
||||
INNER JOIN sys_organization op ON o.parentid = op.id
|
||||
WHERE
|
||||
u.id = #{id}
|
||||
WHERE u.id = #{id}
|
||||
</select>
|
||||
|
||||
<delete id="delRoleUsersByUserid">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user