用户增加状态的修改
This commit is contained in:
@@ -411,4 +411,24 @@ public class UserController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置状态-启用或者禁用
|
||||
* @param jsonObject
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/batchSetStatus")
|
||||
public String batchSetStatus(@RequestBody JSONObject jsonObject,
|
||||
HttpServletRequest request)throws Exception {
|
||||
Byte status = jsonObject.getByte("status");
|
||||
String ids = jsonObject.getString("ids");
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int res = userService.batchSetStatus(status, ids);
|
||||
if(res > 0) {
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} else {
|
||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -781,4 +781,34 @@ public class UserService {
|
||||
}
|
||||
return btnStrArr;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(Byte status, String ids)throws Exception {
|
||||
int result=0;
|
||||
List<User> list = getUserListByIds(ids);
|
||||
for(User user: list) {
|
||||
if (demonstrateOpen && user.getLoginName().equals(TEST_USER)) {
|
||||
logger.error("异常码[{}],异常提示[{}],参数,obj:[{}]",
|
||||
ExceptionConstants.USER_LIMIT_UPDATE_CODE, ExceptionConstants.USER_LIMIT_UPDATE_MSG, TEST_USER);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.USER_LIMIT_UPDATE_CODE,
|
||||
ExceptionConstants.USER_LIMIT_UPDATE_MSG);
|
||||
}
|
||||
}
|
||||
String statusStr ="";
|
||||
if(status == 0) {
|
||||
statusStr ="批量启用";
|
||||
} else if(status == 2) {
|
||||
statusStr ="批量禁用";
|
||||
}
|
||||
logService.insertLog("用户",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ids).append("-").append(statusStr).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
User user = new User();
|
||||
user.setStatus(status);
|
||||
UserExample example = new UserExample();
|
||||
example.createCriteria().andIdIn(idList);
|
||||
result = userMapper.updateByExampleSelective(user, example);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</resultMap>
|
||||
<select id="selectByConditionUser" parameterType="com.jsh.erp.datasource.entities.UserExample" resultMap="ResultMapEx">
|
||||
select user.id, user.username, user.login_name, user.position, user.email, user.phonenum,
|
||||
user.description, user.remark,user.isystem,org.id as orgaId,user.tenant_id,org.org_abr,
|
||||
user.description, user.remark,user.isystem,org.id as orgaId,user.tenant_id,user.status,org.org_abr,
|
||||
rel.user_blng_orga_dspl_seq,rel.id as orgaUserRelId,
|
||||
(select r.id from jsh_user_business ub
|
||||
inner join jsh_role r on ub.value=concat("[",r.id,"]") and ifnull(r.delete_flag,'0') !='1'
|
||||
@@ -23,7 +23,7 @@
|
||||
left join jsh_orga_user_rel rel on user.id=rel.user_id and ifnull(rel.delete_flag,'0') !='1'
|
||||
left join jsh_organization org on rel.orga_id=org.id and ifnull(org.delete_flag,'0') !='1'
|
||||
where 1=1
|
||||
and ifnull(user.status,'0') not in('1','2')
|
||||
and user.status !='1'
|
||||
<if test="userName != null">
|
||||
<bind name="bindUserName" value="'%'+userName+'%'"/>
|
||||
and user.username like #{bindUserName}
|
||||
@@ -41,7 +41,7 @@
|
||||
select count(user.id)
|
||||
FROM jsh_user user
|
||||
where 1=1
|
||||
and ifnull(user.status,'0') not in('1','2')
|
||||
and user.status !='1'
|
||||
<if test="userName != null">
|
||||
<bind name="bindUserName" value="'%'+userName+'%'"/>
|
||||
and user.username like #{bindUserName}
|
||||
|
||||
Reference in New Issue
Block a user