mirror of https://github.com/elunez/eladmin
[代码完善](v2.5): v2.5 beta 菜单管理、部门管理,列表和弹窗数据懒加载
1、菜单管理表格,弹窗数据懒加载 2、部门管理表格,弹窗数据懒加载 3、角色管理,菜单分配数据懒加载 4、用户管理,左侧部门数据懒加载 5、其他杂项优化,sql脚本更新 2.5 Beta 详情:https://www.ydyno.com/archives/1225.htmlpull/361/head^2
parent
5c4d0e46d4
commit
28ef109164
|
@ -71,6 +71,8 @@ public @interface Query {
|
|||
,BETWEEN
|
||||
// 不为空
|
||||
,NOT_NULL
|
||||
// 为空
|
||||
,IS_NULL
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,10 @@ package me.zhengjie.base;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
|
@ -20,4 +23,19 @@ public class BaseDTO implements Serializable {
|
|||
private Timestamp createTime;
|
||||
|
||||
private Timestamp updateTime;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder(this);
|
||||
Field[] fields = this.getClass().getDeclaredFields();
|
||||
try {
|
||||
for (Field f : fields) {
|
||||
f.setAccessible(true);
|
||||
builder.append(f.getName(), f.get(this)).append("\n");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
builder.append("toString builder encounter an error");
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,13 @@
|
|||
package me.zhengjie.config;
|
||||
|
||||
import lombok.Data;
|
||||
import me.zhengjie.utils.ElAdminConstant;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "file")
|
||||
|
@ -38,9 +42,9 @@ public class FileProperties {
|
|||
|
||||
public ElPath getPath(){
|
||||
String os = System.getProperty("os.name");
|
||||
if(os.toLowerCase().startsWith("win")) {
|
||||
if(os.toLowerCase().startsWith(ElAdminConstant.WIN)) {
|
||||
return windows;
|
||||
} else if(os.toLowerCase().startsWith("mac")){
|
||||
} else if(os.toLowerCase().startsWith(ElAdminConstant.MAC)){
|
||||
return mac;
|
||||
}
|
||||
return linux;
|
||||
|
|
|
@ -25,7 +25,17 @@ public class ElAdminConstant {
|
|||
/**
|
||||
* 用于IP定位转换
|
||||
*/
|
||||
static final String REGION = "内网IP|内网IP";
|
||||
public static final String REGION = "内网IP|内网IP";
|
||||
|
||||
/**
|
||||
* win 系统
|
||||
*/
|
||||
public static final String WIN = "win";
|
||||
|
||||
/**
|
||||
* mac 系统
|
||||
*/
|
||||
public static final String MAC = "mac";
|
||||
|
||||
/**
|
||||
* 常用接口
|
||||
|
|
|
@ -27,13 +27,14 @@ import java.nio.charset.StandardCharsets;
|
|||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
|
||||
public class EncryptUtils {
|
||||
|
||||
private static final String strParam = "Passw0rd";
|
||||
private static final String STR_PARAM = "Passw0rd";
|
||||
|
||||
private static Cipher cipher;
|
||||
|
||||
private static IvParameterSpec iv = new IvParameterSpec(strParam.getBytes(StandardCharsets.UTF_8));
|
||||
private static final IvParameterSpec IV = new IvParameterSpec(STR_PARAM.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
private static DESKeySpec getDesKeySpec(String source) throws Exception {
|
||||
if (source == null || source.length() == 0){
|
||||
|
@ -51,7 +52,7 @@ public class EncryptUtils {
|
|||
DESKeySpec desKeySpec = getDesKeySpec(source);
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
|
||||
SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey, IV);
|
||||
return byte2hex(
|
||||
cipher.doFinal(source.getBytes(StandardCharsets.UTF_8))).toUpperCase();
|
||||
}
|
||||
|
@ -64,7 +65,7 @@ public class EncryptUtils {
|
|||
DESKeySpec desKeySpec = getDesKeySpec(source);
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
|
||||
SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
|
||||
cipher.init(Cipher.DECRYPT_MODE, secretKey, iv);
|
||||
cipher.init(Cipher.DECRYPT_MODE, secretKey, IV);
|
||||
byte[] retByte = cipher.doFinal(src);
|
||||
return new String(retByte);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ public class QueryHelp {
|
|||
List<Field> fields = getAllFields(query.getClass(), new ArrayList<>());
|
||||
for (Field field : fields) {
|
||||
boolean accessible = field.isAccessible();
|
||||
// 设置对象的访问权限,保证对private的属性的访
|
||||
field.setAccessible(true);
|
||||
Query q = field.getAnnotation(Query.class);
|
||||
if (q != null) {
|
||||
|
@ -143,6 +144,9 @@ public class QueryHelp {
|
|||
case NOT_NULL:
|
||||
list.add(cb.isNotNull(getExpression(attributeName,join,root)));
|
||||
break;
|
||||
case IS_NULL:
|
||||
list.add(cb.isNull(getExpression(attributeName,join,root)));
|
||||
break;
|
||||
case BETWEEN:
|
||||
List<Object> between = new ArrayList<>((List<Object>)val);
|
||||
list.add(cb.between(getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()),
|
||||
|
@ -182,7 +186,7 @@ public class QueryHelp {
|
|||
return true;
|
||||
}
|
||||
|
||||
private static List<Field> getAllFields(Class clazz, List<Field> fields) {
|
||||
public static List<Field> getAllFields(Class clazz, List<Field> fields) {
|
||||
if (clazz != null) {
|
||||
fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
||||
getAllFields(clazz.getSuperclass(), fields);
|
||||
|
|
|
@ -23,6 +23,7 @@ import lombok.Setter;
|
|||
import me.zhengjie.base.BaseEntity;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhanghouying
|
||||
|
@ -58,4 +59,22 @@ public class ServerDeploy extends BaseEntity implements Serializable {
|
|||
public void copy(ServerDeploy source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ServerDeploy that = (ServerDeploy) o;
|
||||
return Objects.equals(id, that.id) &&
|
||||
Objects.equals(name, that.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -57,4 +58,21 @@ public class DeployDto extends BaseDTO implements Serializable {
|
|||
}
|
||||
return servers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DeployDto deployDto = (DeployDto) o;
|
||||
return Objects.equals(id, deployDto.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhanghouying
|
||||
|
@ -39,4 +40,22 @@ public class ServerDeployDto extends BaseDTO implements Serializable {
|
|||
private String account;
|
||||
|
||||
private String password;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ServerDeployDto that = (ServerDeployDto) o;
|
||||
return Objects.equals(id, that.id) &&
|
||||
Objects.equals(name, that.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,9 @@ public class DeployServiceImpl implements DeployService {
|
|||
private final DeployMapper deployMapper;
|
||||
private final ServerDeployService serverDeployService;
|
||||
private final DeployHistoryService deployHistoryService;
|
||||
// 循环次数
|
||||
/**
|
||||
* 循环次数
|
||||
*/
|
||||
private final Integer count = 30;
|
||||
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ public class ExecutionJob extends QuartzJobBean {
|
|||
private EmailVo taskAlarm(QuartzJob quartzJob, String msg) {
|
||||
EmailVo emailVo = new EmailVo();
|
||||
emailVo.setSubject("定时任务【"+ quartzJob.getJobName() +"】执行失败,请尽快处理!");
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String, Object> data = new HashMap<>(16);
|
||||
data.put("task", quartzJob);
|
||||
data.put("msg", msg);
|
||||
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TokenProvider implements InitializingBean {
|
|||
long time = redisUtils.getExpire(properties.getOnlineKey() + token) * 1000;
|
||||
Date expireDate = DateUtil.offset(new Date(), DateField.MILLISECOND, (int) time);
|
||||
// 判断当前时间与过期时间的时间差
|
||||
long differ = expireDate.getTime() - new Date().getTime();
|
||||
long differ = expireDate.getTime() - System.currentTimeMillis();
|
||||
// 如果在续期检查的范围内,则续期
|
||||
if(differ <= properties.getDetect()){
|
||||
long renew = time + properties.getRenew();
|
||||
|
|
|
@ -49,6 +49,9 @@ public class Dept extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "角色")
|
||||
private Set<Role> roles;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer deptSort;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String name;
|
||||
|
@ -57,7 +60,6 @@ public class Dept extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "上级部门")
|
||||
private Long pid;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.persistence.Table;
|
|||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
|
@ -54,4 +55,21 @@ public class Job extends BaseEntity implements Serializable {
|
|||
@NotNull
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Job job = (Job) o;
|
||||
return Objects.equals(id, job.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
}
|
|
@ -51,7 +51,6 @@ public class Menu extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "菜单角色")
|
||||
private Set<Role> roles;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "菜单标题")
|
||||
private String title;
|
||||
|
||||
|
|
|
@ -36,6 +36,12 @@ public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificat
|
|||
*/
|
||||
List<Dept> findByPid(Long id);
|
||||
|
||||
/**
|
||||
* 获取顶级部门
|
||||
* @return
|
||||
*/
|
||||
List<Dept> findByPidIsNull();
|
||||
|
||||
/**
|
||||
* 根据ID查询名称
|
||||
* @param id ID
|
||||
|
@ -50,4 +56,11 @@ public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificat
|
|||
* @return /
|
||||
*/
|
||||
Set<Dept> findByRoles_Id(Long id);
|
||||
|
||||
/**
|
||||
* 判断是否存在子节点
|
||||
* @param pid /
|
||||
* @return
|
||||
*/
|
||||
int countByPid(Long pid);
|
||||
}
|
|
@ -50,6 +50,12 @@ public interface MenuRepository extends JpaRepository<Menu, Long>, JpaSpecificat
|
|||
*/
|
||||
List<Menu> findByPid(long pid);
|
||||
|
||||
/**
|
||||
* 查询顶级菜单
|
||||
* @return /
|
||||
*/
|
||||
List<Menu> findByPidIsNull();
|
||||
|
||||
/**
|
||||
* 根据角色ID与菜单类型查询菜单
|
||||
* @param roleIds roleIDs
|
||||
|
@ -57,4 +63,11 @@ public interface MenuRepository extends JpaRepository<Menu, Long>, JpaSpecificat
|
|||
* @return /
|
||||
*/
|
||||
LinkedHashSet<Menu> findByRoles_IdInAndTypeNotOrderByMenuSortAsc(Set<Long> roleIds, int type);
|
||||
|
||||
/**
|
||||
* 获取节点数量
|
||||
* @param id /
|
||||
* @return
|
||||
*/
|
||||
int countByPid(Long id);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import me.zhengjie.modules.system.domain.Dept;
|
|||
import me.zhengjie.modules.system.service.DeptService;
|
||||
import me.zhengjie.modules.system.service.dto.DeptDto;
|
||||
import me.zhengjie.modules.system.service.dto.DeptQueryCriteria;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.ThrowableUtil;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -32,10 +33,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
|
@ -54,17 +52,31 @@ public class DeptController {
|
|||
@ApiOperation("导出部门数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dept:list')")
|
||||
public void download(HttpServletResponse response, DeptQueryCriteria criteria) throws IOException {
|
||||
deptService.download(deptService.queryAll(criteria), response);
|
||||
public void download(HttpServletResponse response, DeptQueryCriteria criteria) throws Exception {
|
||||
deptService.download(deptService.queryAll(criteria, false), response);
|
||||
}
|
||||
|
||||
@Log("查询部门")
|
||||
@ApiOperation("查询部门")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
public ResponseEntity<Object> getDepts(DeptQueryCriteria criteria){
|
||||
List<DeptDto> deptDtos = deptService.queryAll(criteria);
|
||||
return new ResponseEntity<>(deptService.buildTree(deptDtos),HttpStatus.OK);
|
||||
public ResponseEntity<Object> getDepts(DeptQueryCriteria criteria) throws Exception {
|
||||
List<DeptDto> deptDtos = deptService.queryAll(criteria, true);
|
||||
return new ResponseEntity<>(PageUtil.toPage(deptDtos, deptDtos.size()),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("查询部门")
|
||||
@ApiOperation("查询部门:根据ID获取同级与上级数据")
|
||||
@GetMapping("/superior")
|
||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
public ResponseEntity<Object> getSuperior(@RequestParam List<Long> ids) {
|
||||
Set<DeptDto> deptDtos = new LinkedHashSet<>();
|
||||
for (Long id : ids) {
|
||||
DeptDto deptDto = deptService.findById(id);
|
||||
List<DeptDto> depts = deptService.getSuperior(deptDto, new ArrayList<>());
|
||||
deptDtos.addAll(depts);
|
||||
}
|
||||
return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptDtos)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增部门")
|
||||
|
|
|
@ -25,6 +25,7 @@ import me.zhengjie.modules.system.service.MenuService;
|
|||
import me.zhengjie.modules.system.service.RoleService;
|
||||
import me.zhengjie.modules.system.service.dto.MenuDto;
|
||||
import me.zhengjie.modules.system.service.dto.MenuQueryCriteria;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.SecurityUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -33,6 +34,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -57,8 +59,8 @@ public class MenuController {
|
|||
@ApiOperation("导出菜单数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public void download(HttpServletResponse response, MenuQueryCriteria criteria) throws IOException {
|
||||
menuService.download(menuService.queryAll(criteria), response);
|
||||
public void download(HttpServletResponse response, MenuQueryCriteria criteria) throws Exception {
|
||||
menuService.download(menuService.queryAll(criteria, false), response);
|
||||
}
|
||||
|
||||
@ApiOperation("获取前端所需菜单")
|
||||
|
@ -70,19 +72,29 @@ public class MenuController {
|
|||
}
|
||||
|
||||
@ApiOperation("返回全部的菜单")
|
||||
@GetMapping(value = "/tree")
|
||||
@GetMapping(value = "/lazy")
|
||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||
public ResponseEntity<Object> getMenuTree(){
|
||||
return new ResponseEntity<>(menuService.getMenuTree(menuService.findByPid(0L)),HttpStatus.OK);
|
||||
public ResponseEntity<Object> getMenus(@RequestParam Long pid){
|
||||
return new ResponseEntity<>(menuService.getMenus(pid),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("查询菜单")
|
||||
@ApiOperation("查询菜单")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public ResponseEntity<Object> getMenus(MenuQueryCriteria criteria){
|
||||
List<MenuDto> menuDtoList = menuService.queryAll(criteria);
|
||||
return new ResponseEntity<>(menuService.buildTree(menuDtoList),HttpStatus.OK);
|
||||
public ResponseEntity<Object> getMenus(MenuQueryCriteria criteria) throws Exception {
|
||||
List<MenuDto> menuDtoList = menuService.queryAll(criteria, true);
|
||||
return new ResponseEntity<>(PageUtil.toPage(menuDtoList, menuDtoList.size()),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("查询菜单")
|
||||
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
||||
@GetMapping("/superior")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public ResponseEntity<Object> getSuperior(@RequestParam Long id) {
|
||||
MenuDto menuDto = menuService.findById(id);
|
||||
List<MenuDto> menuDtos = menuService.getSuperior(menuDto, new ArrayList<>());
|
||||
return new ResponseEntity<>(menuService.buildTree(menuDtos),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增菜单")
|
||||
|
|
|
@ -68,6 +68,8 @@ public class VerifyController {
|
|||
case TWO:
|
||||
verificationCodeService.validated(CodeEnum.EMAIL_RESET_PWD_CODE.getKey() + email ,code);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package me.zhengjie.modules.system.service;
|
|||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.service.dto.DeptDto;
|
||||
import me.zhengjie.modules.system.service.dto.DeptQueryCriteria;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -33,9 +32,11 @@ public interface DeptService {
|
|||
/**
|
||||
* 查询所有数据
|
||||
* @param criteria 条件
|
||||
* @param isQuery /
|
||||
* @throws Exception /
|
||||
* @return /
|
||||
*/
|
||||
List<DeptDto> queryAll(DeptQueryCriteria criteria);
|
||||
List<DeptDto> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
|
@ -64,13 +65,6 @@ public interface DeptService {
|
|||
*/
|
||||
void delete(Set<DeptDto> deptDtos);
|
||||
|
||||
/**
|
||||
* 构建树形数据
|
||||
* @param deptDtos 原始数据
|
||||
* @return /
|
||||
*/
|
||||
Object buildTree(List<DeptDto> deptDtos);
|
||||
|
||||
/**
|
||||
* 根据PID查询
|
||||
* @param pid /
|
||||
|
@ -100,4 +94,19 @@ public interface DeptService {
|
|||
* @return /
|
||||
*/
|
||||
Set<DeptDto> getDeleteDepts(List<Dept> deptList, Set<DeptDto> deptDtos);
|
||||
|
||||
/**
|
||||
* 根据ID获取同级与上级数据
|
||||
* @param deptDto /
|
||||
* @param depts /
|
||||
* @return /
|
||||
*/
|
||||
List<DeptDto> getSuperior(DeptDto deptDto, List<Dept> depts);
|
||||
|
||||
/**
|
||||
* 构建树形数据
|
||||
* @param deptDtos /
|
||||
* @return /
|
||||
*/
|
||||
Object buildTree(List<DeptDto> deptDtos);
|
||||
}
|
|
@ -35,9 +35,11 @@ public interface MenuService {
|
|||
/**
|
||||
* 查询全部数据
|
||||
* @param criteria 条件
|
||||
* @param isQuery /
|
||||
* @throws Exception /
|
||||
* @return /
|
||||
*/
|
||||
List<MenuDto> queryAll(MenuQueryCriteria criteria);
|
||||
List<MenuDto> queryAll(MenuQueryCriteria criteria, Boolean isQuery) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
|
@ -67,13 +69,6 @@ public interface MenuService {
|
|||
*/
|
||||
Set<Menu> getDeleteMenus(List<Menu> menuList, Set<Menu> menuSet);
|
||||
|
||||
/**
|
||||
* 获取菜单树
|
||||
* @param menus /
|
||||
* @return /
|
||||
*/
|
||||
Object getMenuTree(List<Menu> menus);
|
||||
|
||||
/**
|
||||
* 根据pid查询
|
||||
* @param pid /
|
||||
|
@ -122,4 +117,19 @@ public interface MenuService {
|
|||
* @throws IOException /
|
||||
*/
|
||||
void download(List<MenuDto> queryAll, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 懒加载菜单数据
|
||||
* @param pid /
|
||||
* @return /
|
||||
*/
|
||||
Object getMenus(Long pid);
|
||||
|
||||
/**
|
||||
* 根据ID获取同级与上级数据
|
||||
* @param menuDto /
|
||||
* @param objects /
|
||||
* @return /
|
||||
*/
|
||||
List<MenuDto> getSuperior(MenuDto menuDto, List<Menu> objects);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import lombok.Setter;
|
|||
import me.zhengjie.base.BaseDTO;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
|
@ -32,16 +33,40 @@ public class DeptDto extends BaseDTO implements Serializable {
|
|||
|
||||
private Long id;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<DeptDto> children;
|
||||
|
||||
private String name;
|
||||
|
||||
private Boolean enabled;
|
||||
|
||||
private Integer deptSort;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<DeptDto> children;
|
||||
|
||||
private Long pid;
|
||||
|
||||
private Boolean hasChildren = false;
|
||||
|
||||
private Boolean leaf = true;
|
||||
|
||||
public String getLabel() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DeptDto deptDto = (DeptDto) o;
|
||||
return Objects.equals(id, deptDto.id) &&
|
||||
Objects.equals(name, deptDto.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
}
|
|
@ -38,6 +38,9 @@ public class DeptQueryCriteria{
|
|||
@Query
|
||||
private Long pid;
|
||||
|
||||
@Query(type = Query.Type.IS_NULL, propName = "pid")
|
||||
private Boolean pidIsNull;
|
||||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
|
@ -20,6 +20,7 @@ import lombok.Setter;
|
|||
import me.zhengjie.base.BaseDTO;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
|
@ -56,4 +57,29 @@ public class MenuDto extends BaseDTO implements Serializable {
|
|||
private String componentName;
|
||||
|
||||
private String icon;
|
||||
|
||||
private Boolean leaf = true;
|
||||
|
||||
private Boolean hasChildren = false;
|
||||
|
||||
public String getLabel() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MenuDto menuDto = (MenuDto) o;
|
||||
return Objects.equals(id, menuDto.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,15 @@ import java.util.List;
|
|||
@Data
|
||||
public class MenuQueryCriteria {
|
||||
|
||||
@Query(blurry = "title,path,component")
|
||||
@Query(blurry = "title,component,permission")
|
||||
private String blurry;
|
||||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
|
||||
@Query(type = Query.Type.IS_NULL, propName = "pid")
|
||||
private Boolean pidIsNull;
|
||||
|
||||
@Query
|
||||
private Long pid;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
import me.zhengjie.base.BaseDTO;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -42,4 +43,21 @@ public class RoleDto extends BaseDTO implements Serializable {
|
|||
private Integer level;
|
||||
|
||||
private String description;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
RoleDto roleDto = (RoleDto) o;
|
||||
return Objects.equals(id, roleDto.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public class DataServiceImpl implements DataService {
|
|||
private final RoleService roleService;
|
||||
private final DeptService deptService;
|
||||
|
||||
@Override
|
||||
@Cacheable
|
||||
public List<Long> getDeptIds(UserDto user) {
|
||||
// 用于存储部门id
|
||||
|
@ -58,6 +59,8 @@ public class DataServiceImpl implements DataService {
|
|||
case CUSTOMIZE:
|
||||
deptIds.addAll(getCustomize(deptIds, role));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(deptIds);
|
||||
|
@ -86,6 +89,7 @@ public class DataServiceImpl implements DataService {
|
|||
* @param deptList 部门
|
||||
* @return 数据权限
|
||||
*/
|
||||
@Override
|
||||
@Cacheable
|
||||
public List<Long> getDeptChildren(List<Dept> deptList) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
|
@ -29,12 +31,13 @@ import me.zhengjie.modules.system.service.mapstruct.DeptMapper;
|
|||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -53,8 +56,26 @@ public class DeptServiceImpl implements DeptService {
|
|||
|
||||
@Override
|
||||
@Cacheable
|
||||
public List<DeptDto> queryAll(DeptQueryCriteria criteria) {
|
||||
return deptMapper.toDto(deptRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
public List<DeptDto> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception {
|
||||
Sort sort = new Sort(Sort.Direction.ASC, "deptSort");
|
||||
if (isQuery) {
|
||||
criteria.setPidIsNull(true);
|
||||
List<Field> fields = QueryHelp.getAllFields(criteria.getClass(), new ArrayList<>());
|
||||
List<String> fieldNames = new ArrayList<String>(){{ add("pidIsNull");add("enabled");}};
|
||||
for (Field field : fields) {
|
||||
//设置对象的访问权限,保证对private的属性的访问
|
||||
field.setAccessible(true);
|
||||
Object val = field.get(criteria);
|
||||
if(fieldNames.contains(field.getName())){
|
||||
continue;
|
||||
}
|
||||
if (ObjectUtil.isNotNull(val)) {
|
||||
criteria.setPidIsNull(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return deptMapper.toDto(deptRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,46 +97,6 @@ public class DeptServiceImpl implements DeptService {
|
|||
return deptRepository.findByRoles_Id(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable
|
||||
public Object buildTree(List<DeptDto> deptDtos) {
|
||||
Set<DeptDto> trees = new LinkedHashSet<>();
|
||||
Set<DeptDto> depts= new LinkedHashSet<>();
|
||||
List<String> deptNames = deptDtos.stream().map(DeptDto::getName).collect(Collectors.toList());
|
||||
boolean isChild;
|
||||
for (DeptDto deptDTO : deptDtos) {
|
||||
isChild = false;
|
||||
if ("0".equals(deptDTO.getPid().toString())) {
|
||||
trees.add(deptDTO);
|
||||
}
|
||||
for (DeptDto it : deptDtos) {
|
||||
if (it.getPid().equals(deptDTO.getId())) {
|
||||
isChild = true;
|
||||
if (deptDTO.getChildren() == null) {
|
||||
deptDTO.setChildren(new ArrayList<>());
|
||||
}
|
||||
deptDTO.getChildren().add(it);
|
||||
}
|
||||
}
|
||||
if(isChild) {
|
||||
depts.add(deptDTO);
|
||||
} else if(!deptNames.contains(deptRepository.findNameById(deptDTO.getPid()))) {
|
||||
depts.add(deptDTO);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(trees)) {
|
||||
trees = depts;
|
||||
}
|
||||
|
||||
Integer totalElements = deptDtos.size();
|
||||
|
||||
Map<String,Object> map = new HashMap<>(2);
|
||||
map.put("totalElements",totalElements);
|
||||
map.put("content",CollectionUtils.isEmpty(trees)? deptDtos :trees);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(allEntries = true)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -127,7 +108,7 @@ public class DeptServiceImpl implements DeptService {
|
|||
@CacheEvict(allEntries = true)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Dept resources) {
|
||||
if(resources.getId().equals(resources.getPid())) {
|
||||
if(resources.getPid() != null && resources.getId().equals(resources.getPid())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
}
|
||||
Dept dept = deptRepository.findById(resources.getId()).orElseGet(Dept::new);
|
||||
|
@ -169,4 +150,53 @@ public class DeptServiceImpl implements DeptService {
|
|||
}
|
||||
return deptDtos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDto> getSuperior(DeptDto deptDto, List<Dept> depts) {
|
||||
if(deptDto.getPid() == null){
|
||||
depts.addAll(deptRepository.findByPidIsNull());
|
||||
return deptMapper.toDto(depts);
|
||||
}
|
||||
depts.addAll(deptRepository.findByPid(deptDto.getPid()));
|
||||
return getSuperior(findById(deptDto.getPid()), depts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object buildTree(List<DeptDto> deptDtos) {
|
||||
Set<DeptDto> trees = new LinkedHashSet<>();
|
||||
Set<DeptDto> depts= new LinkedHashSet<>();
|
||||
List<String> deptNames = deptDtos.stream().map(DeptDto::getName).collect(Collectors.toList());
|
||||
boolean isChild;
|
||||
for (DeptDto deptDTO : deptDtos) {
|
||||
isChild = false;
|
||||
if (deptDTO.getPid() == null) {
|
||||
trees.add(deptDTO);
|
||||
}
|
||||
for (DeptDto it : deptDtos) {
|
||||
if (it.getPid() != null && it.getPid().equals(deptDTO.getId())) {
|
||||
isChild = true;
|
||||
if (deptDTO.getChildren() == null) {
|
||||
deptDTO.setChildren(new ArrayList<>());
|
||||
}
|
||||
deptDTO.getChildren().add(it);
|
||||
}
|
||||
}
|
||||
if(isChild) {
|
||||
depts.add(deptDTO);
|
||||
} else if(!deptNames.contains(deptRepository.findNameById(deptDTO.getPid()))) {
|
||||
depts.add(deptDTO);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtil.isEmpty(trees)) {
|
||||
trees = depts;
|
||||
}
|
||||
|
||||
Integer totalElements = deptDtos.size();
|
||||
|
||||
Map<String,Object> map = new HashMap<>(2);
|
||||
map.put("totalElements",totalElements);
|
||||
map.put("content",CollectionUtil.isEmpty(trees)? deptDtos :trees);
|
||||
return map;
|
||||
}
|
||||
}
|
|
@ -37,11 +37,13 @@ import me.zhengjie.utils.ValidationUtil;
|
|||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -60,8 +62,25 @@ public class MenuServiceImpl implements MenuService {
|
|||
|
||||
@Override
|
||||
@Cacheable
|
||||
public List<MenuDto> queryAll(MenuQueryCriteria criteria){
|
||||
return menuMapper.toDto(menuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
public List<MenuDto> queryAll(MenuQueryCriteria criteria, Boolean isQuery) throws Exception {
|
||||
Sort sort = new Sort(Sort.Direction.ASC, "menuSort");
|
||||
if(isQuery){
|
||||
criteria.setPidIsNull(true);
|
||||
List<Field> fields = QueryHelp.getAllFields(criteria.getClass(), new ArrayList<>());
|
||||
for (Field field : fields) {
|
||||
//设置对象的访问权限,保证对private的属性的访问
|
||||
field.setAccessible(true);
|
||||
Object val = field.get(criteria);
|
||||
if("pidIsNull".equals(field.getName())){
|
||||
continue;
|
||||
}
|
||||
if (ObjectUtil.isNotNull(val)) {
|
||||
criteria.setPidIsNull(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return menuMapper.toDto(menuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,6 +109,9 @@ public class MenuServiceImpl implements MenuService {
|
|||
throw new EntityExistException(Menu.class,"componentName",resources.getComponentName());
|
||||
}
|
||||
}
|
||||
if(resources.getPid().equals(0L)){
|
||||
resources.setPid(null);
|
||||
}
|
||||
if(resources.getIFrame()){
|
||||
String http = "http://", https = "https://";
|
||||
if (!(resources.getPath().toLowerCase().startsWith(http)||resources.getPath().toLowerCase().startsWith(https))) {
|
||||
|
@ -120,6 +142,9 @@ public class MenuServiceImpl implements MenuService {
|
|||
throw new EntityExistException(Menu.class,"title",resources.getTitle());
|
||||
}
|
||||
|
||||
if(resources.getPid().equals(0L)){
|
||||
resources.setPid(null);
|
||||
}
|
||||
if(StringUtils.isNotBlank(resources.getComponentName())){
|
||||
menu1 = menuRepository.findByComponentName(resources.getComponentName());
|
||||
if(menu1 != null && !menu1.getId().equals(menu.getId())){
|
||||
|
@ -165,23 +190,24 @@ public class MenuServiceImpl implements MenuService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "'tree'")
|
||||
public Object getMenuTree(List<Menu> menus) {
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
menus.forEach(menu -> {
|
||||
if (menu!=null){
|
||||
List<Menu> menuList = menuRepository.findByPid(menu.getId());
|
||||
Map<String,Object> map = new HashMap<>(16);
|
||||
map.put("id",menu.getId());
|
||||
map.put("label",menu.getTitle());
|
||||
if(menuList!=null && menuList.size()!=0){
|
||||
map.put("children",getMenuTree(menuList));
|
||||
public Object getMenus(Long pid) {
|
||||
List<Menu> menus;
|
||||
if(pid != null && !pid.equals(0L)){
|
||||
menus = menuRepository.findByPid(pid);
|
||||
} else {
|
||||
menus = menuRepository.findByPidIsNull();
|
||||
}
|
||||
list.add(map);
|
||||
return menuMapper.toDto(menus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuDto> getSuperior(MenuDto menuDto, List<Menu> menus) {
|
||||
if(menuDto.getPid() == null){
|
||||
menus.addAll(menuRepository.findByPidIsNull());
|
||||
return menuMapper.toDto(menus);
|
||||
}
|
||||
);
|
||||
return list;
|
||||
menus.addAll(menuRepository.findByPid(menuDto.getPid()));
|
||||
return getSuperior(findById(menuDto.getPid()), menus);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -195,11 +221,11 @@ public class MenuServiceImpl implements MenuService {
|
|||
List<MenuDto> trees = new ArrayList<>();
|
||||
Set<Long> ids = new HashSet<>();
|
||||
for (MenuDto menuDTO : menuDtos) {
|
||||
if (menuDTO.getPid() == 0) {
|
||||
if (menuDTO.getPid() == null) {
|
||||
trees.add(menuDTO);
|
||||
}
|
||||
for (MenuDto it : menuDtos) {
|
||||
if (it.getPid().equals(menuDTO.getId())) {
|
||||
if (it.getPid() != null && it.getPid().equals(menuDTO.getId())) {
|
||||
if (menuDTO.getChildren() == null) {
|
||||
menuDTO.setChildren(new ArrayList<>());
|
||||
}
|
||||
|
@ -226,11 +252,11 @@ public class MenuServiceImpl implements MenuService {
|
|||
MenuVo menuVo = new MenuVo();
|
||||
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponentName()) ? menuDTO.getComponentName() : menuDTO.getTitle());
|
||||
// 一级目录需要加斜杠,不然会报警告
|
||||
menuVo.setPath(menuDTO.getPid() == 0 ? "/" + menuDTO.getPath() :menuDTO.getPath());
|
||||
menuVo.setPath(menuDTO.getPid() == null ? "/" + menuDTO.getPath() :menuDTO.getPath());
|
||||
menuVo.setHidden(menuDTO.getHidden());
|
||||
// 如果不是外链
|
||||
if(!menuDTO.getIFrame()){
|
||||
if(menuDTO.getPid() == 0){
|
||||
if(menuDTO.getPid() == null){
|
||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent())?"Layout":menuDTO.getComponent());
|
||||
}else if(!StrUtil.isEmpty(menuDTO.getComponent())){
|
||||
menuVo.setComponent(menuDTO.getComponent());
|
||||
|
@ -242,7 +268,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
menuVo.setRedirect("noredirect");
|
||||
menuVo.setChildren(buildMenus(menuDtoList));
|
||||
// 处理是一级菜单并且没有子菜单的情况
|
||||
} else if(menuDTO.getPid() == 0){
|
||||
} else if(menuDTO.getPid() == null){
|
||||
MenuVo menuVo1 = new MenuVo();
|
||||
menuVo1.setMeta(menuVo.getMeta());
|
||||
// 非外链
|
||||
|
@ -280,7 +306,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
for (MenuDto menuDTO : menuDtos) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("菜单标题", menuDTO.getTitle());
|
||||
map.put("菜单类型", menuDTO.getType() == 0 ? "目录" : menuDTO.getType() == 1 ? "菜单" : "按钮");
|
||||
map.put("菜单类型", menuDTO.getType() == null ? "目录" : menuDTO.getType() == 1 ? "菜单" : "按钮");
|
||||
map.put("权限标识", menuDTO.getPermission());
|
||||
map.put("外链菜单", menuDTO.getIFrame() ? "是" : "否");
|
||||
map.put("菜单可见", menuDTO.getHidden() ? "否" : "是");
|
||||
|
|
|
@ -17,8 +17,12 @@ package me.zhengjie.modules.system.service.mapstruct;
|
|||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.repository.DeptRepository;
|
||||
import me.zhengjie.modules.system.service.dto.DeptDto;
|
||||
import me.zhengjie.utils.SpringContextHolder;
|
||||
import org.mapstruct.AfterMapping;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
|
@ -28,4 +32,19 @@ import org.mapstruct.ReportingPolicy;
|
|||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeptMapper extends BaseMapper<DeptDto, Dept> {
|
||||
|
||||
/**
|
||||
* 转换后的特殊处理
|
||||
* @param deptDto /
|
||||
* @return /
|
||||
*/
|
||||
@AfterMapping
|
||||
default DeptDto dealDto(@MappingTarget DeptDto deptDto) {
|
||||
DeptRepository deptRepository = SpringContextHolder.getBean(DeptRepository.class);
|
||||
if(deptRepository.countByPid(deptDto.getId()) > 0){
|
||||
deptDto.setHasChildren(true);
|
||||
deptDto.setLeaf(false);
|
||||
}
|
||||
return deptDto;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,8 +17,12 @@ package me.zhengjie.modules.system.service.mapstruct;
|
|||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.system.domain.Menu;
|
||||
import me.zhengjie.modules.system.repository.MenuRepository;
|
||||
import me.zhengjie.modules.system.service.dto.MenuDto;
|
||||
import me.zhengjie.utils.SpringContextHolder;
|
||||
import org.mapstruct.AfterMapping;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
|
@ -28,4 +32,18 @@ import org.mapstruct.ReportingPolicy;
|
|||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface MenuMapper extends BaseMapper<MenuDto, Menu> {
|
||||
|
||||
/**
|
||||
* 转换
|
||||
* @param menuDto /
|
||||
* @return /
|
||||
*/
|
||||
@AfterMapping
|
||||
default MenuDto dealDto(@MappingTarget MenuDto menuDto) {
|
||||
MenuRepository menuRepository = SpringContextHolder.getBean(MenuRepository.class);
|
||||
if(menuRepository.countByPid(menuDto.getId()) > 0){
|
||||
menuDto.setLeaf(false);
|
||||
menuDto.setHasChildren(true);
|
||||
}
|
||||
return menuDto;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,10 @@ import lombok.Getter;
|
|||
@AllArgsConstructor
|
||||
public enum CodeBiEnum {
|
||||
|
||||
/* 旧邮箱修改邮箱 */
|
||||
ONE(1, "旧邮箱修改邮箱"),
|
||||
|
||||
/* 通过邮箱修改密码 */
|
||||
TWO(1, "通过邮箱修改密码");
|
||||
|
||||
private final Integer code;
|
||||
|
|
|
@ -29,10 +29,13 @@ import lombok.Getter;
|
|||
@AllArgsConstructor
|
||||
public enum DataScopeEnum {
|
||||
|
||||
/* 全部的数据权限 */
|
||||
ALL("全部", "全部的数据权限"),
|
||||
|
||||
/* 自己部门的数据权限 */
|
||||
THIS_LEVEL("本级", "自己部门的数据权限"),
|
||||
|
||||
/* 自定义的数据权限 */
|
||||
CUSTOMIZE("自定义", "自定义的数据权限");
|
||||
|
||||
private final String value;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
Target Server Version : 50710
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 06/05/2020 13:17:46
|
||||
Date: 10/05/2020 20:31:38
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
@ -191,8 +191,9 @@ CREATE TABLE `mnt_server` (
|
|||
DROP TABLE IF EXISTS `sys_dept`;
|
||||
CREATE TABLE `sys_dept` (
|
||||
`dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`pid` bigint(20) DEFAULT NULL COMMENT '上级部门',
|
||||
`name` varchar(255) NOT NULL COMMENT '名称',
|
||||
`pid` bigint(20) NOT NULL COMMENT '上级部门',
|
||||
`dept_sort` int(5) DEFAULT '999' COMMENT '排序',
|
||||
`enabled` bit(1) NOT NULL COMMENT '状态',
|
||||
`create_by` varchar(255) DEFAULT NULL COMMENT '创建者',
|
||||
`update_by` varchar(255) DEFAULT NULL COMMENT '更新者',
|
||||
|
@ -207,13 +208,12 @@ CREATE TABLE `sys_dept` (
|
|||
-- Records of sys_dept
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_dept` VALUES (1, 'EL-ADMIN', 0, b'1', NULL, NULL, '2019-03-01 12:07:37', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (2, '研发部', 7, b'1', NULL, NULL, '2019-03-25 09:15:32', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (5, '运维部', 7, b'1', NULL, NULL, '2019-03-25 09:20:44', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (6, '测试部', 8, b'1', NULL, NULL, '2019-03-25 09:52:18', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (7, '华南分部', 1, b'1', NULL, NULL, '2019-03-25 11:04:50', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (8, '华北分部', 1, b'1', NULL, NULL, '2019-03-25 11:04:53', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (11, '人事部', 8, b'1', NULL, 'admin', '2019-03-25 11:07:58', '2020-05-03 18:03:04');
|
||||
INSERT INTO `sys_dept` VALUES (2, 7, '研发部', 3, b'1', NULL, 'admin', '2019-03-25 09:15:32', '2020-05-10 17:37:58');
|
||||
INSERT INTO `sys_dept` VALUES (5, 7, '运维部', 4, b'1', NULL, NULL, '2019-03-25 09:20:44', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (6, 8, '测试部', 6, b'1', NULL, NULL, '2019-03-25 09:52:18', NULL);
|
||||
INSERT INTO `sys_dept` VALUES (7, NULL, '华南分部', 0, b'1', NULL, 'admin', '2019-03-25 11:04:50', '2020-05-10 19:59:12');
|
||||
INSERT INTO `sys_dept` VALUES (8, NULL, '华北分部', 1, b'1', NULL, 'admin', '2019-03-25 11:04:53', '2020-05-10 19:59:20');
|
||||
INSERT INTO `sys_dept` VALUES (11, 8, '人事部', 5, b'1', NULL, 'admin', '2019-03-25 11:07:58', '2020-05-10 17:40:06');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -295,7 +295,7 @@ BEGIN;
|
|||
INSERT INTO `sys_job` VALUES (8, '人事专员', b'1', 3, NULL, NULL, '2019-03-29 14:52:28', NULL);
|
||||
INSERT INTO `sys_job` VALUES (10, '产品经理', b'1', 4, NULL, NULL, '2019-03-29 14:55:51', NULL);
|
||||
INSERT INTO `sys_job` VALUES (11, '全栈开发', b'1', 2, NULL, 'admin', '2019-03-31 13:39:30', '2020-05-05 11:33:43');
|
||||
INSERT INTO `sys_job` VALUES (12, '软件测试', b'1', 5, NULL, 'admin', '2019-03-31 13:39:43', '2020-05-03 18:16:57');
|
||||
INSERT INTO `sys_job` VALUES (12, '软件测试', b'1', 5, NULL, 'admin', '2019-03-31 13:39:43', '2020-05-10 19:56:26');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -318,13 +318,7 @@ CREATE TABLE `sys_log` (
|
|||
PRIMARY KEY (`log_id`) USING BTREE,
|
||||
KEY `log_create_time_index` (`create_time`),
|
||||
KEY `inx_log_type` (`log_type`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=414646 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统日志';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_log
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
COMMIT;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2094 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统日志';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_menu
|
||||
|
@ -332,7 +326,7 @@ COMMIT;
|
|||
DROP TABLE IF EXISTS `sys_menu`;
|
||||
CREATE TABLE `sys_menu` (
|
||||
`menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`pid` bigint(20) NOT NULL COMMENT '上级菜单ID',
|
||||
`pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID',
|
||||
`type` int(11) DEFAULT NULL COMMENT '菜单类型',
|
||||
`title` varchar(255) DEFAULT NULL COMMENT '菜单标题',
|
||||
`name` varchar(255) DEFAULT NULL COMMENT '组件名称',
|
||||
|
@ -358,21 +352,21 @@ CREATE TABLE `sys_menu` (
|
|||
-- Records of sys_menu
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_menu` VALUES (1, 0, 0, '系统管理', NULL, NULL, 1, 'system', 'system', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:11:29', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (1, NULL, 0, '系统管理', NULL, NULL, 1, 'system', 'system', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:11:29', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (2, 1, 1, '用户管理', 'User', 'system/user/index', 2, 'peoples', 'user', b'0', b'0', b'0', 'user:list', NULL, NULL, '2018-12-18 15:14:44', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (3, 1, 1, '角色管理', 'Role', 'system/role/index', 3, 'role', 'role', b'0', b'0', b'0', 'roles:list', NULL, NULL, '2018-12-18 15:16:07', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (5, 1, 1, '菜单管理', 'Menu', 'system/menu/index', 5, 'menu', 'menu', b'0', b'0', b'0', 'menu:list', NULL, NULL, '2018-12-18 15:17:28', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (6, 0, 0, '系统监控', NULL, NULL, 10, 'monitor', 'monitor', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:17:48', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (6, NULL, 0, '系统监控', NULL, NULL, 10, 'monitor', 'monitor', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:17:48', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (7, 6, 1, '操作日志', 'Log', 'monitor/log/index', 11, 'log', 'logs', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:18:26', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (9, 6, 1, 'SQL监控', 'Sql', 'monitor/sql/index', 18, 'sqlMonitor', 'druid', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:19:34', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (10, 0, 0, '组件管理', NULL, NULL, 50, 'zujian', 'components', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-19 13:38:16', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (10, NULL, 0, '组件管理', NULL, NULL, 50, 'zujian', 'components', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-19 13:38:16', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (11, 10, 1, '图标库', 'Icons', 'components/icons/index', 51, 'icon', 'icon', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-19 13:38:49', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (14, 36, 1, '邮件工具', 'Email', 'tools/email/index', 35, 'email', 'email', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-27 10:13:09', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (15, 10, 1, '富文本', 'Editor', 'components/Editor', 52, 'fwb', 'tinymce', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-27 11:58:25', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (16, 36, 1, '图床管理', 'Pictures', 'tools/picture/index', 33, 'image', 'pictures', b'0', b'0', b'0', 'pictures:list', NULL, NULL, '2018-12-28 09:36:53', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (18, 36, 1, '存储管理', 'Storage', 'tools/storage/index', 34, 'qiniu', 'storage', b'0', b'0', b'0', 'storage:list', NULL, NULL, '2018-12-31 11:12:15', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (19, 36, 1, '支付宝工具', 'AliPay', 'tools/aliPay/index', 37, 'alipay', 'aliPay', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-31 14:52:38', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (21, 0, 0, '多级菜单', NULL, '', 900, 'menu', 'nested', b'0', b'0', b'1', NULL, NULL, NULL, '2019-01-04 16:22:03', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (21, NULL, 0, '多级菜单', NULL, '', 900, 'menu', 'nested', b'0', b'0', b'1', NULL, NULL, NULL, '2019-01-04 16:22:03', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (22, 21, 1, '二级菜单1', NULL, 'nested/menu1/index', 999, 'menu', 'menu1', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:23:29', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (23, 21, 1, '二级菜单2', NULL, 'nested/menu2/index', 999, 'menu', 'menu2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:23:57', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (24, 22, 1, '三级菜单1', NULL, 'nested/menu1/menu1-1', 999, 'menu', 'menu1-1', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:24:48', NULL);
|
||||
|
@ -383,7 +377,7 @@ INSERT INTO `sys_menu` VALUES (32, 6, 1, '异常日志', 'ErrorLog', 'monitor/lo
|
|||
INSERT INTO `sys_menu` VALUES (33, 10, 1, 'Markdown', 'Markdown', 'components/MarkDown', 53, 'markdown', 'markdown', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-08 13:46:44', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (34, 10, 1, 'Yaml编辑器', 'YamlEdit', 'components/YamlEdit', 54, 'dev', 'yaml', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-08 15:49:40', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (35, 1, 1, '部门管理', 'Dept', 'system/dept/index', 6, 'dept', 'dept', b'0', b'0', b'0', 'dept:list', NULL, NULL, '2019-03-25 09:46:00', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (36, 0, 0, '系统工具', NULL, '', 30, 'sys-tools', 'sys-tools', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 10:57:35', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (36, NULL, 0, '系统工具', NULL, '', 30, 'sys-tools', 'sys-tools', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 10:57:35', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (37, 1, 1, '岗位管理', 'Job', 'system/job/index', 7, 'Steve-Jobs', 'job', b'0', b'0', b'0', 'job:list', NULL, NULL, '2019-03-29 13:51:18', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (38, 36, 1, '接口文档', 'Swagger', 'tools/swagger/index', 36, 'swagger', 'swagger2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 19:57:53', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (39, 1, 1, '字典管理', 'Dict', 'system/dict/index', 8, 'dictionary', 'dict', b'0', b'0', b'0', 'dict:list', NULL, NULL, '2019-04-10 11:49:04', NULL);
|
||||
|
@ -417,7 +411,7 @@ INSERT INTO `sys_menu` VALUES (79, 18, 2, '文件删除', NULL, '', 4, '', '', b
|
|||
INSERT INTO `sys_menu` VALUES (80, 6, 1, '服务监控', 'ServerMonitor', 'monitor/server/index', 14, 'codeConsole', 'server', b'0', b'0', b'0', 'monitor:list', NULL, 'admin', '2019-11-07 13:06:39', '2020-05-04 18:20:50');
|
||||
INSERT INTO `sys_menu` VALUES (82, 36, 1, '生成配置', 'GeneratorConfig', 'generator/config', 33, 'dev', 'generator/config/:tableName', b'0', b'1', b'1', '', NULL, NULL, '2019-11-17 20:08:56', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (83, 10, 1, '图表库', 'Echarts', 'components/Echarts', 50, 'chart', 'echarts', b'0', b'1', b'0', '', NULL, NULL, '2019-11-21 09:04:32', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (90, 0, 1, '运维管理', 'Mnt', '', 20, 'mnt', 'mnt', b'0', b'0', b'0', NULL, NULL, NULL, '2019-11-09 10:31:08', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (90, NULL, 1, '运维管理', 'Mnt', '', 20, 'mnt', 'mnt', b'0', b'0', b'0', NULL, NULL, NULL, '2019-11-09 10:31:08', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (92, 90, 1, '服务器', 'ServerDeploy', 'mnt/server/index', 22, 'server', 'mnt/serverDeploy', b'0', b'0', b'0', 'serverDeploy:list', NULL, NULL, '2019-11-10 10:29:25', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (93, 90, 1, '应用管理', 'App', 'mnt/app/index', 23, 'app', 'mnt/app', b'0', b'0', b'0', 'app:list', NULL, NULL, '2019-11-10 11:05:16', NULL);
|
||||
INSERT INTO `sys_menu` VALUES (94, 90, 1, '部署管理', 'Deploy', 'mnt/deploy/index', 24, 'deploy', 'mnt/deploy', b'0', b'0', b'0', 'deploy:list', NULL, NULL, '2019-11-10 15:56:55', NULL);
|
||||
|
@ -469,7 +463,7 @@ CREATE TABLE `sys_quartz_job` (
|
|||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_quartz_job` VALUES (2, 'testTask', '0/5 * * * * ?', b'1', '测试1', 'run1', 'test', '带参测试,多参使用json', NULL, NULL, NULL, NULL, NULL, 'admin', '2019-08-22 14:08:29', '2020-05-05 17:26:19');
|
||||
INSERT INTO `sys_quartz_job` VALUES (3, 'testTask', '0/5 * * * * ?', b'1', '测试', 'run', '', '不带参测试', 'Zheng Jie', '', '2', b'1', NULL, 'admin', '2019-09-26 16:44:39', '2020-05-05 20:45:39');
|
||||
INSERT INTO `sys_quartz_job` VALUES (3, 'testTask', '0/5 * * * * ?', b'1', '测试', 'run', '', '不带参测试', 'Zheng Jie', '', '2,6', b'1', NULL, 'admin', '2019-09-26 16:44:39', '2020-05-05 20:45:39');
|
||||
INSERT INTO `sys_quartz_job` VALUES (5, 'Test', '0/5 * * * * ?', b'1', '任务告警测试', 'run', NULL, '测试', 'test', '', NULL, b'1', 'admin', 'admin', '2020-05-05 20:32:41', '2020-05-05 20:36:13');
|
||||
INSERT INTO `sys_quartz_job` VALUES (6, 'testTask', '0/5 * * * * ?', b'1', '测试3', 'run2', NULL, '测试3', 'Zheng Jie', '', NULL, b'1', 'admin', 'admin', '2020-05-05 20:35:41', '2020-05-05 20:36:07');
|
||||
COMMIT;
|
||||
|
@ -490,7 +484,7 @@ CREATE TABLE `sys_quartz_log` (
|
|||
`params` varchar(255) DEFAULT NULL,
|
||||
`time` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`log_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=331 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='定时任务日志';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='定时任务日志';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_quartz_log
|
||||
|
@ -522,7 +516,7 @@ CREATE TABLE `sys_role` (
|
|||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_role` VALUES (1, '超级管理员', 1, '-', '全部', NULL, 'admin', '2018-11-23 11:04:37', '2020-05-05 11:24:24');
|
||||
INSERT INTO `sys_role` VALUES (2, '普通用户', 2, '-', '本级', NULL, 'admin', '2018-11-23 13:09:06', '2020-05-03 16:44:23');
|
||||
INSERT INTO `sys_role` VALUES (2, '普通用户', 2, '-', '自定义', NULL, 'admin', '2018-11-23 13:09:06', '2020-05-10 12:32:52');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -540,6 +534,7 @@ CREATE TABLE `sys_roles_depts` (
|
|||
-- Records of sys_roles_depts
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_roles_depts` VALUES (2, 7);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -626,33 +621,20 @@ INSERT INTO `sys_roles_menus` VALUES (2, 2);
|
|||
INSERT INTO `sys_roles_menus` VALUES (3, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (5, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (6, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (9, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (10, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (11, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (14, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (15, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (18, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (19, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (21, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (23, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (24, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (27, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (28, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (30, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (33, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (34, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (35, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (36, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (37, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (38, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (39, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (44, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (48, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (49, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (50, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (77, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (78, 2);
|
||||
INSERT INTO `sys_roles_menus` VALUES (79, 2);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
@ -848,6 +830,6 @@ CREATE TABLE `tool_qiniu_content` (
|
|||
`update_time` datetime DEFAULT NULL COMMENT '上传或同步的时间',
|
||||
PRIMARY KEY (`content_id`) USING BTREE,
|
||||
UNIQUE KEY `uniq_name` (`name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='七牛云文件存储';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='七牛云文件存储';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
|
|
@ -41,6 +41,8 @@ alter table sys_menu CHANGE name title VARCHAR(255) COMMENT '菜单标题';
|
|||
alter table sys_menu CHANGE component_name name VARCHAR(255) COMMENT '组件名称';
|
||||
/* sort 改为 menu_sort */
|
||||
alter table sys_menu CHANGE sort menu_sort INT(5) COMMENT '排序';
|
||||
/* pid 允许为空 */
|
||||
alter table sys_menu modify pid BIGINT(20) null;
|
||||
/* 加入通用字段 */
|
||||
alter table sys_menu add update_by VARCHAR(255) COMMENT '更新者';
|
||||
alter table sys_menu add create_by VARCHAR(255) COMMENT '创建者';
|
||||
|
@ -63,6 +65,10 @@ alter table sys_job add update_time datetime COMMENT '更新时间';
|
|||
-- sys_dept 表改动 start--
|
||||
/* id 改为 menu_id */
|
||||
alter table sys_dept CHANGE id dept_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
|
||||
/* pid 允许为空 */
|
||||
alter table sys_dept modify pid BIGINT(20) null;
|
||||
/* 加入排序字段 */
|
||||
alter table sys_dept add dept_sort int(5) DEFAULT 999 COMMENT '排序';
|
||||
/* 加入通用字段 */
|
||||
alter table sys_dept add create_by VARCHAR(255) COMMENT '创建者';
|
||||
alter table sys_dept add update_by VARCHAR(255) COMMENT '更新者';
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
/** 将admin改为管理员 */
|
||||
update sys_user set is_admin = 1 WHERE user_id = 1
|
||||
UPDATE sys_dept SET pid = NULL WHERE pid = 0;
|
||||
UPDATE sys_menu SET pid = NULL WHERE pid = 0;
|
Loading…
Reference in New Issue