diff --git a/diboot-example/src/main/java/com/diboot/example/config/Cons.java b/diboot-example/src/main/java/com/diboot/example/config/Cons.java index 9d994fc..030c169 100644 --- a/diboot-example/src/main/java/com/diboot/example/config/Cons.java +++ b/diboot-example/src/main/java/com/diboot/example/config/Cons.java @@ -1,7 +1,8 @@ package com.diboot.example.config; -import com.diboot.example.entity.Department; -import com.diboot.example.entity.Organization; +import com.diboot.example.vo.DepartmentVO; +import com.diboot.example.vo.OrganizationVO; +import com.diboot.example.vo.PositionVO; import java.util.HashMap; import java.util.Map; @@ -14,19 +15,27 @@ public class Cons { * 树图标常量 * */ public static enum TREE_ICON_LEVEL{ - ONE, - TWO + ONE, //一级图标 + TWO //二级图标 } public static Map> ICON = new HashMap(){{ - put(Organization.class.getSimpleName(), new HashMap(){{ - put(TREE_ICON_LEVEL.ONE.name(), ""); - put(TREE_ICON_LEVEL.TWO.name(), ""); + //组织 + put(OrganizationVO.class.getSimpleName(), new HashMap(){{ + put(TREE_ICON_LEVEL.ONE.name(), "gold"); + put(TREE_ICON_LEVEL.TWO.name(), "bank"); }} ); - put(Department.class.getSimpleName(), new HashMap(){{ - put(TREE_ICON_LEVEL.ONE.name(), ""); - put(TREE_ICON_LEVEL.TWO.name(), ""); + //部门 + put(DepartmentVO.class.getSimpleName(), new HashMap(){{ + put(TREE_ICON_LEVEL.ONE.name(), "gold"); + put(TREE_ICON_LEVEL.TWO.name(), "bank"); + }} + ); + //职位 + put(PositionVO.class.getSimpleName(), new HashMap(){{ + put(TREE_ICON_LEVEL.ONE.name(), "gold"); + put(TREE_ICON_LEVEL.TWO.name(), "bank"); }} ); }}; diff --git a/diboot-example/src/main/java/com/diboot/example/service/impl/EmployeeServiceImpl.java b/diboot-example/src/main/java/com/diboot/example/service/impl/EmployeeServiceImpl.java index 17bec6e..d9e6628 100644 --- a/diboot-example/src/main/java/com/diboot/example/service/impl/EmployeeServiceImpl.java +++ b/diboot-example/src/main/java/com/diboot/example/service/impl/EmployeeServiceImpl.java @@ -54,12 +54,16 @@ public class EmployeeServiceImpl extends BaseServiceImpl deptList = departmentService.getEntityList(queryWrapper); List deptIdList = getIdList(deptList); - + if(V.isEmpty(deptIdList)){ + return null; + } queryWrapper = new LambdaQueryWrapper() .in(EmployeePositionDepartment::getDepartmentId, deptIdList); List epdList = employeePositionDepartmentService.getEntityList(queryWrapper); List empIdList = getIdList(epdList, "getEmployeeId"); - + if(V.isEmpty(empIdList)){ + return null; + } wrapper.lambda().in(Employee::getId, empIdList); List empList = super.getEntityList(wrapper, pagination); List voList = RelationsBinder.convertAndBind(empList, EmployeeVO.class); diff --git a/diboot-example/src/main/java/com/diboot/example/service/impl/PositionServiceImpl.java b/diboot-example/src/main/java/com/diboot/example/service/impl/PositionServiceImpl.java index a95a0c1..2785708 100644 --- a/diboot-example/src/main/java/com/diboot/example/service/impl/PositionServiceImpl.java +++ b/diboot-example/src/main/java/com/diboot/example/service/impl/PositionServiceImpl.java @@ -197,6 +197,9 @@ public class PositionServiceImpl extends BaseServiceImpl() .in(PositionDepartment::getDepartmentId, deptIdList); @@ -207,6 +210,9 @@ public class PositionServiceImpl extends BaseServiceImpl positionList = super.getEntityListByIds(positionIdList); List volist = RelationsBinder.convertAndBind(positionList, PositionVO.class); diff --git a/diboot-example/src/main/java/com/diboot/example/vo/DepartmentVO.java b/diboot-example/src/main/java/com/diboot/example/vo/DepartmentVO.java index aa60475..f641313 100644 --- a/diboot-example/src/main/java/com/diboot/example/vo/DepartmentVO.java +++ b/diboot-example/src/main/java/com/diboot/example/vo/DepartmentVO.java @@ -27,12 +27,4 @@ public class DepartmentVO extends Department { private List children; - // 直接关联Entity - /*@BindEntity(entity = Organization.class, condition="this.org_id=id") - private Organization organization;*/ - - // 直接关联多个Entity - /*@BindEntityList(entity = Department.class, condition = "this.id=parent_id") - private List children;*/ - } \ No newline at end of file diff --git a/diboot-example/src/main/java/com/diboot/example/vo/EmployeeVO.java b/diboot-example/src/main/java/com/diboot/example/vo/EmployeeVO.java index e0480b2..e6083fd 100644 --- a/diboot-example/src/main/java/com/diboot/example/vo/EmployeeVO.java +++ b/diboot-example/src/main/java/com/diboot/example/vo/EmployeeVO.java @@ -19,10 +19,10 @@ public class EmployeeVO extends Employee { @BindDict(type="GENDER", field="gender") private String genderLabel; - @BindEntity(entity = Department.class, condition = "this.id = if_employee_position_department.employee_id AND if_employee_position_department.department_id = id") + @BindEntity(entity = Department.class, condition = "this.id = if_employee_position_department.employee_id AND if_employee_position_department.department_id = id AND if_employee_position_department.deleted = 0") private Department department; - @BindEntity(entity = Position.class, condition = "this.id = if_employee_position_department.employee_id AND if_employee_position_department.position_id = id") + @BindEntity(entity = Position.class, condition = "this.id = if_employee_position_department.employee_id AND if_employee_position_department.position_id = id AND if_employee_position_department.deleted = 0") private Position position; private EmployeePositionDepartment empPosiDept; diff --git a/diboot-example/src/main/java/com/diboot/example/vo/PositionVO.java b/diboot-example/src/main/java/com/diboot/example/vo/PositionVO.java index 88e6ca1..777349b 100644 --- a/diboot-example/src/main/java/com/diboot/example/vo/PositionVO.java +++ b/diboot-example/src/main/java/com/diboot/example/vo/PositionVO.java @@ -27,7 +27,7 @@ public class PositionVO extends Position { @BindEntity(entity = Position.class, condition = "this.parent_id = id") private Position parentPosition; - @BindEntityList(entity = Department.class, condition = "this.id = if_position_department.position_id AND if_position_department.department_id = id") + @BindEntityList(entity = Department.class, condition = "this.id = if_position_department.position_id AND if_position_department.department_id = id AND if_position_department.deleted = 0") private List departmentList; private List children;