bug调整
This commit is contained in:
@@ -83,6 +83,8 @@ public enum UserResponseEnum {
|
||||
|
||||
BIND_MONITOR_DATA("A0110", "已绑定监测点,先解绑监测点"),
|
||||
|
||||
BINDING_BUTTON("A0110", "已绑定按钮,先删除按钮"),
|
||||
|
||||
NO_MENU_DATA("A0111","未找到菜单"),
|
||||
|
||||
CHILD_DATA("A0112","数据已绑子节点"),
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.user.enums.UserResponseEnum;
|
||||
import com.njcn.user.pojo.param.FunctionParam;
|
||||
import com.njcn.user.pojo.param.RoleParam;
|
||||
import com.njcn.user.pojo.po.Function;
|
||||
@@ -86,12 +87,8 @@ public class FunctionController extends BaseController {
|
||||
public HttpResult<Boolean> delete(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除的菜单id为:{}", methodDescribe,id);
|
||||
boolean result = functionService.deleteFunction(id);
|
||||
if (result){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
functionService.deleteFunction(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
|
||||
@@ -51,7 +51,7 @@ public interface IFunctionService extends IService<Function> {
|
||||
* @author xy
|
||||
* @date 2022/1/17 16:53
|
||||
*/
|
||||
boolean deleteFunction(String id);
|
||||
void deleteFunction(String id);
|
||||
|
||||
/**
|
||||
* 功能描述: 获取菜单树
|
||||
|
||||
@@ -137,15 +137,20 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteFunction(String id) {
|
||||
boolean result = this.lambdaUpdate()
|
||||
.set(Function::getState, FunctionState.DELETE)
|
||||
.in(Function::getId,id)
|
||||
.update();
|
||||
if (result){
|
||||
refreshRolesFunctionsCache();
|
||||
public void deleteFunction(String id) {
|
||||
boolean result = false;
|
||||
List<Function> list = this.lambdaQuery().eq(Function::getState,FunctionState.ENABLE).eq(Function::getPid,id).list();
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
result = this.lambdaUpdate()
|
||||
.set(Function::getState, FunctionState.DELETE)
|
||||
.in(Function::getId,id)
|
||||
.update();
|
||||
if (result){
|
||||
refreshRolesFunctionsCache();
|
||||
}
|
||||
} else {
|
||||
throw new BusinessException(UserResponseEnum.BINDING_BUTTON);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -166,7 +171,7 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
@Override
|
||||
public List<Function> getButtonsById(String id) {
|
||||
List<Integer> typeList = Arrays.asList(FunctionState.BUTTON,FunctionState.PUBLIC,FunctionState.TAB);
|
||||
return this.lambdaQuery().eq(Function::getPid,id).in(Function::getType,typeList).eq(Function::getState,FunctionState.ENABLE).orderByAsc(Function::getType).list();
|
||||
return this.lambdaQuery().eq(Function::getPid,id).in(Function::getType,typeList).eq(Function::getState,FunctionState.ENABLE).orderByAsc(Function::getSort).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -651,7 +651,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
//填写一些默认值
|
||||
user.setState(UserState.UNCHECK);
|
||||
user.setOrigin(UserState.NORMAL_ORIGIN);
|
||||
user.setCasualUser(UserType.OFFICIAL);
|
||||
user.setPwdState(UserState.NEED);
|
||||
user.setRegisterTime(LocalDateTime.now());
|
||||
user.setLoginTime(LocalDateTime.now());
|
||||
|
||||
Reference in New Issue
Block a user