feat:改进部门模块

This commit is contained in:
wangyu 2021-11-28 21:04:46 +08:00
parent 32cc830fdc
commit 73ee8dff47
5 changed files with 19 additions and 38 deletions

View File

@ -4,6 +4,8 @@ import com.flyfish.framework.builder.CriteriaBuilder;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* 属性菜单的qo
*/
@ -11,13 +13,15 @@ import lombok.Setter;
@Setter
public class TreeQo<T extends Domain> extends NameLikeQo<T> {
private Boolean leaf;
private Integer depth;
private Integer level;
private String parentId;
private List<String> parentIds;
@Override
public CriteriaBuilder<T> criteriaBuilder() {
return super.criteriaBuilder()
.with("level", "leaf");
.with("depth", "parentId").with("parentIds", "parentId", CriteriaBuilder.Builders.IN);
}
}

View File

@ -1,6 +1,6 @@
package com.flyfish.framework.domain.po;
import com.flyfish.framework.domain.base.AuditDomain;
import com.flyfish.framework.domain.base.TreeDomain;
import lombok.*;
import org.springframework.data.mongodb.core.mapping.Document;
@ -15,7 +15,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Department extends AuditDomain {
public class Department extends TreeDomain<Department> {
/**
* 默认选中
@ -32,23 +32,18 @@ public class Department extends AuditDomain {
*/
private String phone;
/**
* 层级
*/
private Integer level;
/**
* 地址
*/
private String address;
/**
* 父节点根节点0
*/
private String parentId;
/**
* 是否是部门叶子节点
*/
private Boolean leaf;
/**
* 排序字段
*/
private String pos;
}

View File

@ -10,6 +10,6 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/departments")
public class DepartmentController extends BaseController<Department, DepartmentQo> {
public class DepartmentController extends TreeController<Department, DepartmentQo> {
}

View File

@ -1,7 +1,6 @@
package com.flyfish.framework.domain;
import com.flyfish.framework.builder.CriteriaBuilder;
import com.flyfish.framework.domain.base.NameLikeQo;
import com.flyfish.framework.domain.base.TreeQo;
import com.flyfish.framework.domain.po.Department;
import lombok.Getter;
import lombok.Setter;
@ -13,15 +12,6 @@ import lombok.Setter;
*/
@Getter
@Setter
public class DepartmentQo extends NameLikeQo<Department> {
public class DepartmentQo extends TreeQo<Department> {
private Boolean leaf;
private Integer level;
@Override
public CriteriaBuilder<Department> criteriaBuilder() {
return super.criteriaBuilder()
.with("level", "leaf");
}
}

View File

@ -2,14 +2,11 @@ package com.flyfish.framework.domain;
import com.flyfish.framework.builder.CriteriaBuilder;
import com.flyfish.framework.domain.base.NameLikeQo;
import com.flyfish.framework.domain.base.TreeQo;
import com.flyfish.framework.domain.po.Permission;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* 权限查询实体
*
@ -21,15 +18,10 @@ public class PermissionQo extends TreeQo<Permission> {
private Boolean admin;
private String parentId;
private String type;
private List<String> parentIds;
@Override
public CriteriaBuilder<Permission> criteriaBuilder() {
return super.criteriaBuilder().with("admin", "parentId", "type")
.with("parentIds", "parentId", CriteriaBuilder.Builders.IN);
return super.criteriaBuilder().with("admin", "type");
}
}