diff --git a/jshERP-boot/src/main/java/com/jsh/erp/constants/BusinessConstants.java b/jshERP-boot/src/main/java/com/jsh/erp/constants/BusinessConstants.java index 76e7d43bd..08dc19f50 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/constants/BusinessConstants.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/constants/BusinessConstants.java @@ -172,10 +172,9 @@ public class BusinessConstants { public static final byte USER_NOT_MANAGER = 1; /** * 用户状态 - * 0:正常,1:删除,2封禁 + * 0:正常,2封禁 * */ public static final byte USER_STATUS_NORMAL = 0; - public static final byte USER_STATUS_DELETE = 1; public static final byte USER_STATUS_BANNED = 2; /** * 日志操作 diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/UserMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/UserMapperEx.java index 9d9c5a461..734526624 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/UserMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/UserMapperEx.java @@ -26,7 +26,7 @@ public interface UserMapperEx { List getUserListByUserNameOrLoginName(@Param("userName") String userName, @Param("loginName") String loginName); - int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status); + int batDeleteOrUpdateUser(@Param("ids") String[] ids); List getNodeTree(); List getNextNodeTree(Map parameterMap); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java index 93a8267c8..494c94912 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java @@ -287,9 +287,9 @@ public class UserService { } logService.insertLog("用户", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); - String idsArray[]=ids.split(","); + String[] idsArray =ids.split(","); try{ - result=userMapperEx.batDeleteOrUpdateUser(idsArray,BusinessConstants.USER_STATUS_DELETE); + result=userMapperEx.batDeleteOrUpdateUser(idsArray); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -412,7 +412,7 @@ public class UserService { List list = null; try { UserExample example = new UserExample(); - example.createCriteria().andLoginNameEqualTo(loginName).andStatusNotEqualTo(BusinessConstants.USER_STATUS_DELETE); + example.createCriteria().andLoginNameEqualTo(loginName).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); list = userMapper.selectByExample(example); if (null != list && list.size() == 0) { return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST; @@ -438,7 +438,7 @@ public class UserService { try { UserExample example = new UserExample(); example.createCriteria().andLoginNameEqualTo(loginName).andPasswordEqualTo(password) - .andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL); + .andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); list = userMapper.selectByExample(example); if (null != list && list.size() == 0) { return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR; @@ -452,7 +452,8 @@ public class UserService { public User getUserByLoginName(String loginName)throws Exception { UserExample example = new UserExample(); - example.createCriteria().andLoginNameEqualTo(loginName).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL); + example.createCriteria().andLoginNameEqualTo(loginName).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL) + .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); List list=null; try{ list= userMapper.selectByExample(example); @@ -468,10 +469,10 @@ public class UserService { public int checkIsNameExist(Long id, String name)throws Exception { UserExample example = new UserExample(); - List userStatus=new ArrayList(); - userStatus.add(BusinessConstants.USER_STATUS_DELETE); - userStatus.add(BusinessConstants.USER_STATUS_BANNED); - example.createCriteria().andIdNotEqualTo(id).andLoginNameEqualTo(name).andStatusNotIn(userStatus); + List userStatus = new ArrayList<>(); + userStatus.add(BusinessConstants.USER_STATUS_NORMAL); + example.createCriteria().andIdNotEqualTo(id).andLoginNameEqualTo(name).andStatusIn(userStatus) + .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); List list=null; try{ list= userMapper.selectByExample(example); @@ -502,7 +503,8 @@ public class UserService { public Long getIdByLoginName(String loginName) { Long userId = 0L; UserExample example = new UserExample(); - example.createCriteria().andLoginNameEqualTo(loginName).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL); + example.createCriteria().andLoginNameEqualTo(loginName).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL) + .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); List list = userMapper.selectByExample(example); if(list!=null) { userId = list.get(0).getId(); diff --git a/jshERP-boot/src/main/resources/mapper_xml/UserMapperEx.xml b/jshERP-boot/src/main/resources/mapper_xml/UserMapperEx.xml index 9840f851e..1fcc1b680 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/UserMapperEx.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/UserMapperEx.xml @@ -72,7 +72,7 @@ update jsh_user - set status=#{status} + set delete_flag = '1' where id in ( #{id}