提交 7f2732eb authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 e20a55e0
......@@ -139,7 +139,7 @@ public class CommentController {
comment.setReleaseTime(new Date());
comment.setUserClass(UserTypeEnum.STATUS_1.getCode());
comment.setStatus(CommentEnum.NOT_REVIEW.getCode());
comment.setUserId(redis.getUser().getId());
comment.setUserId(redis.getUser().getUserId());
if (!service.insert(comment)) {
throw new BaseException("操作失败");
}
......
......@@ -97,17 +97,19 @@ public class DepartmentController {
return CallBack.success();
}
@ApiOperation(value = "删除部门" , notes ="根据部门ID删除一个部门")
@ApiOperation(value = "删除部门" , notes ="根据部门code删除一个部门")
@PostMapping(value = "/delete")
public CallBack<Boolean> delete(@RequestBody Integer[] ids){
if(ids.length == 0){
public CallBack<Boolean> delete(@RequestBody String[] codeList){
if(codeList.length == 0){
throw new BaseException("没有选中任何数据,请重新选择");
}
Example example = departmentSerivce.createExample();
example.createCriteria().andIn("departmentId", Arrays.asList(ids));
if (!departmentSerivce.deleteByExample(example)) {
throw new BaseException("操作失败");
}
Arrays.asList(codeList).stream().forEach(code -> {
Example example = departmentSerivce.createExample();
example.createCriteria().andLike("departmentCode", code + "%");
if (!departmentSerivce.deleteByExample(example)) {
throw new BaseException("操作失败");
}
});
return CallBack.success(true);
}
......
package com.zrqx.sysuser.bg.controller.modulepower;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -13,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.datatype.UUIDUtil;
......@@ -98,10 +102,17 @@ public class ModulepowerController {
@ApiOperation(value = "批量删除" , notes ="批量删除")
@PostMapping(value = "/batch/delete")
public CallBack<Boolean> batchDelete(@RequestBody List<Integer> ids){
if(ArrayUtils.empty(ids)){
public CallBack<Boolean> batchDelete(@RequestBody List<String> codeList){
if(ArrayUtils.empty(codeList)){
return CallBack.success();
}
List<Integer> ids = new ArrayList<Integer>();
codeList.stream().forEach(code -> {
Example example = modulepowerSerivce.createExample();
example.createCriteria().andLike("departmentCode", code + "%");
List<Modulepower> mpList = modulepowerSerivce.selectByExample(example);
ids.addAll(mpList.stream().map(Modulepower :: getId).distinct().collect(Collectors.toList()));
});
return modulepowerSerivce.batchDelete(ids) ? CallBack.success(true) : CallBack.fail();
}
......
......@@ -64,7 +64,7 @@ public class UserController {
@PostMapping(value = "/save")
public CallBack<String> saveUser(@RequestBody SaveUserForm user) throws Exception{
userSerivce.save(user);
return CallBack.success(user.getId());
return CallBack.success(user.getUserId());
}
// @ApiOperation(value = "修改密码", notes = "0:成功;")
// @PostMapping(value = "/update")
......@@ -167,7 +167,7 @@ public class UserController {
if(user.getIsAdmin().equals(BooleanStatusEnum.YES.getCode())){
btnIds = operatepowerService.getListByUserIdAndCode(null, modulePower.getCode());
}else{
btnIds = operatepowerService.getListByUserIdAndCode(user.getId(), modulePower.getCode());
btnIds = operatepowerService.getListByUserIdAndCode(user.getUserId(), modulePower.getCode());
}
return CallBack.success(btnIds);
}
......@@ -186,7 +186,7 @@ public class UserController {
if(user.getIsAdmin().equals(BooleanStatusEnum.YES.getCode())){
mCode = modulepowerService.getCode();
}else {
mCode = modulepowerService.getCodeByUserId(user.getId());
mCode = modulepowerService.getCodeByUserId(user.getUserId());
}
map.put("user",user);
map.put("mList",mCode);
......
......@@ -71,7 +71,7 @@ public class UserServiceImpl extends BaseServiceImpl<User,String> implements Use
List<UserDepartmentRelation> udList = new ArrayList<UserDepartmentRelation>();
for (Integer deptId : form.getDeptId()) {
UserDepartmentRelation ud = new UserDepartmentRelation();
ud.setUserId(user.getId());
ud.setUserId(user.getUserId());
ud.setDepartmentId(deptId);
udList.add(ud);
}
......@@ -81,7 +81,7 @@ public class UserServiceImpl extends BaseServiceImpl<User,String> implements Use
List<UserRoleRelation> urList = new ArrayList<UserRoleRelation>();
for (Integer roleId : form.getRoleId()) {
UserRoleRelation ur = new UserRoleRelation();
ur.setUserId(user.getId());
ur.setUserId(user.getUserId());
ur.setRoleId(roleId);
urList.add(ur);
}
......@@ -162,11 +162,11 @@ public class UserServiceImpl extends BaseServiceImpl<User,String> implements Use
form.getRoleId().forEach(id ->{
//往用户-角色关联表里插入数据
UserRoleRelation rr = new UserRoleRelation();
rr.setUserId(form.getId());
rr.setUserId(form.getUserId());
rr.setRoleId(id);
urMapper.insert(rr);
});
User member = super.notNull(form.getId());
User member = super.notNull(form.getUserId());
member.setIsAdmin(form.getIsAdmin());
super.updateByPrimaryKey(member);
return true;
......@@ -175,7 +175,7 @@ public class UserServiceImpl extends BaseServiceImpl<User,String> implements Use
@Override
public boolean update(SaveUserForm form) throws Exception {
User entity = userMapper.selectByPrimaryKey(form.getId());
User entity = userMapper.selectByPrimaryKey(form.getUserId());
// md5密码加密
if (StringUtils.isNotEmpty(form.getPassword())) {
if(form.getPassword().equals("******")){
......@@ -188,13 +188,13 @@ public class UserServiceImpl extends BaseServiceImpl<User,String> implements Use
userMapper.updateByPrimaryKeySelective(entity);
// 根据用户id 删除用户与角色关系
UserRoleRelation rr = new UserRoleRelation();
rr.setUserId(form.getId());
rr.setUserId(form.getUserId());
urMapper.delete(rr);
// 添加用户与角色关系
if(ArrayUtils.isNotEmpty(form.getRoleId())){
form.getRoleId().forEach(v -> {
UserRoleRelation t = new UserRoleRelation();
t.setUserId(form.getId());
t.setUserId(form.getUserId());
t.setRoleId(v);
urMapper.insertSelective(t);
});
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论