Merge branch 'refactor/notice' of https://gitee.com/youlaiorg/youlai-boot into refactor/notice
This commit is contained in:
@@ -18,26 +18,39 @@ import lombok.EqualsAndHashCode;
|
||||
@TableName("sys_config")
|
||||
public class Config extends BaseEntity {
|
||||
|
||||
@Schema(description = "配置名称")
|
||||
/**
|
||||
* 配置名称
|
||||
*/
|
||||
private String configName;
|
||||
|
||||
@Schema(description = "配置键")
|
||||
/**
|
||||
* 配置键
|
||||
*/
|
||||
private String configKey;
|
||||
|
||||
@Schema(description = "配置值")
|
||||
/**
|
||||
* 配置值
|
||||
*/
|
||||
private String configValue;
|
||||
|
||||
@Schema(description = "描述、备注")
|
||||
/**
|
||||
* 描述、备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建人ID")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
@Schema(description = "更新人ID")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 逻辑删除标识(0-未删除 1-已删除)
|
||||
*/
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.youlai.boot.common.base.BaseEntity;
|
||||
import lombok.Getter;
|
||||
@@ -56,4 +57,10 @@ public class Dept extends BaseEntity {
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 逻辑删除标识(0-未删除 1-已删除)
|
||||
*/
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.youlai.boot.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -123,7 +124,11 @@ public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config> impleme
|
||||
@Override
|
||||
public boolean delete(Long id) {
|
||||
if (id != null) {
|
||||
return super.remove(new LambdaQueryWrapper<Config>().eq(Config::getId,id));
|
||||
return super.update(new LambdaUpdateWrapper<Config>()
|
||||
.eq(Config::getId,id)
|
||||
.set(Config::getIsDeleted, 1)
|
||||
.set(Config::getUpdateBy, SecurityUtils.getUserId())
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.boot.core.security.util.SecurityUtils;
|
||||
import com.youlai.boot.system.converter.DeptConverter;
|
||||
import com.youlai.boot.system.mapper.DeptMapper;
|
||||
import com.youlai.boot.system.model.entity.Dept;
|
||||
@@ -148,6 +150,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
||||
String treePath = generateDeptTreePath(formData.getParentId());
|
||||
entity.setTreePath(treePath);
|
||||
|
||||
entity.setCreateBy(SecurityUtils.getUserId());
|
||||
// 保存部门并返回部门ID
|
||||
boolean result = this.save(entity);
|
||||
Assert.isTrue(result, "部门保存失败");
|
||||
@@ -236,10 +239,13 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
||||
if (StrUtil.isNotBlank(ids)) {
|
||||
String[] menuIds = ids.split(SymbolConstant.COMMA);
|
||||
for (String deptId : menuIds) {
|
||||
this.remove(new LambdaQueryWrapper<Dept>()
|
||||
this.update(new LambdaUpdateWrapper<Dept>()
|
||||
.eq(Dept::getId, deptId)
|
||||
.or()
|
||||
.apply("CONCAT (',',tree_path,',') LIKE CONCAT('%,',{0},',%')", deptId));
|
||||
.apply("CONCAT (',',tree_path,',') LIKE CONCAT('%,',{0},',%')", deptId)
|
||||
.set(Dept::getIsDeleted, 1)
|
||||
.set(Dept::getUpdateBy, SecurityUtils.getUserId())
|
||||
);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -254,11 +254,15 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
|
||||
} else {
|
||||
entity.setParams(null);
|
||||
}
|
||||
if (menuType != MenuTypeEnum.BUTTON) {
|
||||
// 新增类型为菜单时候 路由名称唯一
|
||||
if (MenuTypeEnum.MENU.equals(menuType)) {
|
||||
Assert.isFalse(this.exists(new LambdaQueryWrapper<Menu>()
|
||||
.eq(Menu::getRouteName, entity.getRouteName())
|
||||
.ne(menuForm.getId() != null, Menu::getId, menuForm.getId())
|
||||
), "路由名称已存在");
|
||||
}else{
|
||||
// 其他类型时 给路由名称赋值为空
|
||||
entity.setRouteName(null);
|
||||
}
|
||||
|
||||
boolean result = this.saveOrUpdate(entity);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.boot.common.constant.SymbolConstant;
|
||||
import com.youlai.boot.common.exception.BusinessException;
|
||||
import com.youlai.boot.core.security.util.SecurityUtils;
|
||||
import com.youlai.boot.module.websocket.service.OnlineUserService;
|
||||
@@ -139,7 +140,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
||||
}
|
||||
|
||||
// 逻辑删除
|
||||
List<Long> idList = Arrays.stream(ids.split(","))
|
||||
List<Long> idList = Arrays.stream(ids.split(SymbolConstant.COMMA))
|
||||
.map(Long::parseLong)
|
||||
.toList();
|
||||
boolean isRemoved = this.removeByIds(idList);
|
||||
|
||||
Reference in New Issue
Block a user