Jelajahi Sumber

查看区域列表(五级区域下拉)、获取用户权限列表

zhj 2 tahun lalu
induk
melakukan
eb28d76a89

+ 1 - 1
src/main/java/com/welampiot/controller/MapController.java

@@ -1609,7 +1609,7 @@ public class MapController{
         List<GlobalLocationDTO> list = new ArrayList<>();
         pidList.forEach(dto -> {
             if (dto.getPid() != null && dto.getPid() != 0) {
-                GlobalLocationDTO areaDTO = globalLocationService.getAreaById(dto.getPid(),version);
+                GlobalLocationDTO areaDTO = globalLocationService.getGlobalLocationDTOById(dto.getPid(),version);
                 if (areaDTO != null && areaDTO.getId() != null) {
                     sectionDTO.setPid(areaDTO.getId());
                     List<SectionDTO> sectionList = sectionService.getSectionListByDTO(sectionDTO);

+ 295 - 10
src/main/java/com/welampiot/controller/UserController.java

@@ -39,6 +39,8 @@ public class UserController {
     private DicInfoService dicInfoService;
     @Autowired
     private CompanyService companyService;
+    @Autowired
+    private PrivilegeNodeService privilegeNodeService;
 
     /**
      * 登录demo做测试,后续删除
@@ -266,20 +268,232 @@ public class UserController {
      */
     @RequestMapping(value = "areaList", method = RequestMethod.POST)
     public BaseResult<?> areaList(HttpServletRequest request) {
-        int version = (int) toolUtils.getRequestContent(request,"version",1);
-        int pid = (int) toolUtils.getRequestContent(request,"pid",1);
-        List<GlobalLocationDTO> list = new ArrayList<>();
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer pid = (Integer) toolUtils.getRequestContent(request,"pid",1);
+        List<GlobalLocationDTO> list1;
+        List<SectionDTO> list2;
+        List<GlobalLocationDTO> countryList;
+        List<GlobalLocationDTO> provinceList;
+        List<GlobalLocationDTO> cityList;
+        List<GlobalLocationDTO> areaList;
+        List<SectionDTO> sectionList;
+
         if (pid == 0) {
-            GlobalLocationDTO dto = new GlobalLocationDTO();
-            dto.setPid(0);
-            dto.setLevel(1);
-            dto.setVersion(version);
-            List<GlobalLocationDTO> countryList = globalLocationService.getLocationListByDTO(dto);
+            countryList = globalLocationService.getGlobalList(1, version);
+            provinceList = globalLocationService.getGlobalList(2, version);
+            cityList = globalLocationService.getGlobalList(3, version);
+            areaList = globalLocationService.getGlobalList(4, version);
+            sectionList = sectionService.getAllSectionList();
+            for (GlobalLocationDTO g : areaList) {
+                list2 = new ArrayList<>();
+                boolean isFlag = false;
+                for (SectionDTO s : sectionList) {
+                    if (Objects.equals(g.getId(),s.getPid())) {
+                        list2.add(s);
+                        g.setSectionList(list2);
+                        isFlag = true;
+                    }
+                }
+                if (!isFlag) {
+                    SectionDTO sectionDTO = new SectionDTO();
+                    sectionDTO.setId(g.getId());
+                    sectionDTO.setName(g.getName());
+                    sectionDTO.setPid(g.getPid());
+                    list2.add(sectionDTO);
+                    g.setSectionList(list2);
+                }
+            }
+
+            for (GlobalLocationDTO g : cityList) {
+                list1 = new ArrayList<>();
+                boolean isFlag = false;
+                for (GlobalLocationDTO g1 : areaList) {
+                    if (Objects.equals(g.getId(),g1.getPid())) {
+                        list1.add(g1);
+                        g.setAreaList(list1);
+                        isFlag = true;
+                    }
+                }
+                if (!isFlag) {
+                    list1.add(new GlobalLocationDTO(g.getId(),g.getPid(),g.getName()));
+                    g.setAreaList(list1);
+                    list2 = new ArrayList<>();
+                    GlobalLocationDTO dto1 = g.getAreaList().get(0);
+                    SectionDTO sectionDTO = new SectionDTO();
+                    sectionDTO.setId(g.getId());
+                    sectionDTO.setName(g.getName());
+                    sectionDTO.setPid(g.getPid());
+                    list2.add(sectionDTO);
+                    dto1.setSectionList(list2);
+                }
+            }
+
+            for (GlobalLocationDTO g : provinceList) {
+                list1 = new ArrayList<>();
+                boolean isFlag = false;
+                for (GlobalLocationDTO g1 : cityList) {
+                    if (Objects.equals(g.getId(),g1.getPid())) {
+                        list1.add(g1);
+                        g.setCityList(list1);
+                        isFlag = true;
+                    }
+                }
+                if (!isFlag) {
+                    list1.add(new GlobalLocationDTO(g.getId(),g.getPid(),g.getName()));
+                    g.setCityList(list1);
+                    GlobalLocationDTO dto1 = g.getCityList().get(0);
+                    list1 = new ArrayList<>();
+                    list1.add(new GlobalLocationDTO(g.getId(),g.getPid(),g.getName()));
+                    dto1.setAreaList(list1);
+                    GlobalLocationDTO dto2 = g.getCityList().get(0).getAreaList().get(0);
+                    SectionDTO sectionDTO = new SectionDTO();
+                    sectionDTO.setId(g.getId());
+                    sectionDTO.setName(g.getName());
+                    sectionDTO.setPid(g.getPid());
+                    list2 = new ArrayList<>();
+                    list2.add(sectionDTO);
+                    dto2.setSectionList(list2);
+                }
+            }
+
+            for (GlobalLocationDTO g : countryList) {
+                boolean isFlag = false;
+                list1 = new ArrayList<>();
+                for (GlobalLocationDTO g1 : provinceList) {
+                    if (Objects.equals(g.getId(),g1.getPid())) {
+                        list1.add(g1);
+                        g.setProvinceList(list1);
+                        isFlag = true;
+                    }
+                }
+                if (!isFlag) {
+                    GlobalLocationDTO dto = new GlobalLocationDTO(g.getId(), g.getPid(), g.getName());
+                    list1.add(dto);
+                    g.setProvinceList(list1);
+                    GlobalLocationDTO dto1 = g.getProvinceList().get(0);
+                    list1 = new ArrayList<>();
+                    list1.add(new GlobalLocationDTO(dto.getId(),dto.getPid(),dto.getName()));
+                    dto1.setCityList(list1);
+                    GlobalLocationDTO dto2 = g.getProvinceList().get(0).getCityList().get(0);
+                    list1 = new ArrayList<>();
+                    list1.add(new GlobalLocationDTO(dto.getId(),dto.getPid(),dto.getName()));
+                    dto2.setAreaList(list1);
+                    GlobalLocationDTO dto3 = g.getProvinceList().get(0).getCityList().get(0).getAreaList().get(0);
+                    SectionDTO sectionDTO = new SectionDTO();
+                    sectionDTO.setId(dto.getId());
+                    sectionDTO.setName(dto.getName());
+                    sectionDTO.setPid(dto.getPid());
+                    list2 = new ArrayList<>();
+                    list2.add(sectionDTO);
+                    dto3.setSectionList(list2);
+                }
+            }
         } else {
-            GlobalLocationDTO locationDTO = globalLocationService.getAreaById(pid, version);
+            GlobalLocationDTO dto = globalLocationService.getGlobalLocationDTOById(pid, version);
+            if (dto == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
+            provinceList = globalLocationService.getLocationListByPid(pid, version);
+            cityList = globalLocationService.getCityListByPid(pid,version);
+            areaList = globalLocationService.getAreaListByPid(pid,version);
+            sectionList = sectionService.getAllSectionListByPid(pid);
+            for (GlobalLocationDTO g : areaList) {
+                list2 = new ArrayList<>();
+                boolean isFlag = false;
+                for (SectionDTO s : sectionList) {
+                    if (Objects.equals(g.getId(),s.getPid())) {
+                        list2.add(s);
+                        g.setSectionList(list2);
+                        isFlag = true;
+                    }
+                }
+                if (!isFlag) {
+                    SectionDTO sectionDTO = new SectionDTO();
+                    sectionDTO.setId(g.getId());
+                    sectionDTO.setName(g.getName());
+                    sectionDTO.setPid(g.getPid());
+                    list2.add(sectionDTO);
+                    g.setSectionList(list2);
+                }
+            }
+
+            for (GlobalLocationDTO g : cityList) {
+                list1 = new ArrayList<>();
+                boolean isFlag = false;
+                for (GlobalLocationDTO g1 : areaList) {
+                    if (Objects.equals(g.getId(),g1.getPid())) {
+                        list1.add(g1);
+                        g.setAreaList(list1);
+                        isFlag = true;
+                    }
+                }
+                if (!isFlag) {
+                    list1.add(new GlobalLocationDTO(g.getId(),g.getPid(),g.getName()));
+                    g.setAreaList(list1);
+                    list2 = new ArrayList<>();
+                    GlobalLocationDTO dto1 = g.getAreaList().get(0);
+                    SectionDTO sectionDTO = new SectionDTO();
+                    sectionDTO.setId(g.getId());
+                    sectionDTO.setName(g.getName());
+                    sectionDTO.setPid(g.getPid());
+                    list2.add(sectionDTO);
+                    dto1.setSectionList(list2);
+                }
+            }
+
+            for (GlobalLocationDTO g : provinceList) {
+                list1 = new ArrayList<>();
+                boolean isFlag = false;
+                for (GlobalLocationDTO g1 : cityList) {
+                    if (Objects.equals(g.getId(),g1.getPid())) {
+                        list1.add(g1);
+                        g.setCityList(list1);
+                        isFlag = true;
+                    }
+                }
+                if (!isFlag) {
+                    list1.add(new GlobalLocationDTO(g.getId(),g.getPid(),g.getName()));
+                    g.setCityList(list1);
+                    GlobalLocationDTO dto1 = g.getCityList().get(0);
+                    list1 = new ArrayList<>();
+                    list1.add(new GlobalLocationDTO(g.getId(),g.getPid(),g.getName()));
+                    dto1.setAreaList(list1);
+                    GlobalLocationDTO dto2 = g.getCityList().get(0).getAreaList().get(0);
+                    SectionDTO sectionDTO = new SectionDTO();
+                    sectionDTO.setId(g.getId());
+                    sectionDTO.setName(g.getName());
+                    sectionDTO.setPid(g.getPid());
+                    list2 = new ArrayList<>();
+                    list2.add(sectionDTO);
+                    dto2.setSectionList(list2);
+                }
+            }
+            dto.setProvinceList(provinceList);
+            if (dto.getProvinceList().isEmpty() || dto.getProvinceList() == null) {
+                list1 = new ArrayList<>();
+                list1.add(new GlobalLocationDTO(dto.getId(),dto.getPid(),dto.getName()));
+                dto.setProvinceList(list1);
+                GlobalLocationDTO dto1 = dto.getProvinceList().get(0);
+                list1 = new ArrayList<>();
+                list1.add(new GlobalLocationDTO(dto.getId(),dto.getPid(),dto.getName()));
+                dto1.setCityList(list1);
+                GlobalLocationDTO dto2 = dto.getProvinceList().get(0).getCityList().get(0);
+                list1 = new ArrayList<>();
+                list1.add(new GlobalLocationDTO(dto.getId(),dto.getPid(),dto.getName()));
+                dto2.setAreaList(list1);
+                GlobalLocationDTO dto3 = dto.getProvinceList().get(0).getCityList().get(0).getAreaList().get(0);
+                SectionDTO sectionDTO = new SectionDTO();
+                sectionDTO.setId(dto.getId());
+                sectionDTO.setName(dto.getName());
+                sectionDTO.setPid(dto.getPid());
+                list2 = new ArrayList<>();
+                list2.add(sectionDTO);
+                dto3.setSectionList(list2);
+            }
+            countryList = new ArrayList<>();
+            countryList.add(dto);
         }
+
         GlobalLocationVO globalLocationVO = new GlobalLocationVO();
-        globalLocationVO.setList(list);
+        globalLocationVO.setList(countryList);
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,globalLocationVO);
     }
 
@@ -642,4 +856,75 @@ public class UserController {
         companyVO.setId(id);
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,companyVO);
     }
+
+    /**
+     * 获取用户权限列表
+     * @param request 用户名
+     * @return 用户权限列表
+     */
+    @RequestMapping(value = "/privilegeList", method = RequestMethod.POST)
+    public BaseResult<?> privilegeList(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        String username = (String) toolUtils.getRequestContent(request,"username",2);
+        if (username.length() == 0)
+            return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        UserDTO userDTO = userService.getPrivilegeList(username);
+        if (userDTO == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
+        String[] strings = userDTO.getPrivilegeList().split(",");
+        List<PrivilegeNodeDTO> list = new ArrayList<>();
+        // 查看权限
+        List<PrivilegeNodeDTO> privilegeList = privilegeNodeService.getPrivilegeListByParentId(1, version);
+        List<PrivilegeNodeDTO> subList = new ArrayList<>();
+        for (PrivilegeNodeDTO dto : privilegeList) {
+            boolean isFlag = false;
+            for (String s : strings) {
+                if (Objects.equals(Integer.valueOf(s),dto.getId())) {
+                    subList.add(new PrivilegeNodeDTO(dto.getId(),dto.getName(),1));
+                    isFlag = true;
+                    break;
+                }
+            }
+            if (!isFlag) {
+                subList.add(new PrivilegeNodeDTO(dto.getId(),dto.getName(),0));
+            }
+        }
+        list.add(new PrivilegeNodeDTO(1,"查看权限",1,subList));
+        // 操作权限
+        List<PrivilegeNodeDTO> privilegeList1 = privilegeNodeService.getPrivilegeListByParentId(14, version);
+        List<PrivilegeNodeDTO> subList1 = new ArrayList<>();
+        for (PrivilegeNodeDTO dto : privilegeList1) {
+            boolean isFlag = false;
+            for (String s : strings) {
+                if (Objects.equals(Integer.valueOf(s),dto.getId())) {
+                    subList1.add(new PrivilegeNodeDTO(dto.getId(),dto.getName(),1));
+                    isFlag = true;
+                    break;
+                }
+            }
+            if (!isFlag) {
+                subList1.add(new PrivilegeNodeDTO(dto.getId(),dto.getName(),0));
+            }
+        }
+        list.add(new PrivilegeNodeDTO(14,"操作权限",1,subList1));
+        // 命令权限
+        List<PrivilegeNodeDTO> privilegeList2 = privilegeNodeService.getPrivilegeListByParentId(26, version);
+        List<PrivilegeNodeDTO> subList2 = new ArrayList<>();
+        for (PrivilegeNodeDTO dto : privilegeList2) {
+            boolean isFlag = false;
+            for (String s : strings) {
+                if (Objects.equals(Integer.valueOf(s),dto.getId())) {
+                    subList2.add(new PrivilegeNodeDTO(dto.getId(),dto.getName(),1));
+                    isFlag = true;
+                    break;
+                }
+            }
+            if (!isFlag) {
+                subList2.add(new PrivilegeNodeDTO(dto.getId(),dto.getName(),0));
+            }
+        }
+        list.add(new PrivilegeNodeDTO(26,"命令权限",1,subList2));
+        PrivilegeVO privilegeVO = new PrivilegeVO();
+        privilegeVO.setList(list);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,privilegeVO);
+    }
 }

+ 6 - 4
src/main/java/com/welampiot/dao/GlobalLocationDao.java

@@ -25,13 +25,15 @@ public interface GlobalLocationDao {
     List<GlobalLocationDTO> getUserProvinceNav(GlobalLocationVO globalLocationVO);
     GlobalLocationDTO getOneById(@Param("id") Integer id);
 
-    GlobalLocationDTO getAreaById(@Param("id") Integer id, @Param("version") Integer version);
+    GlobalLocationDTO getGlobalLocationDTOById(@Param("id") Integer id, @Param("version") Integer version);
 
     List<GlobalLocationDTO> getLocationListByPid(@Param("pid") Integer pid, @Param("version") Integer version);
 
-    List<GlobalLocationDTO> getLocationListByDTO(GlobalLocationDTO dto);
-
-    List<Integer> getPidList(@Param("level") Integer level);
+    List<GlobalLocationDTO> getGlobalList(@Param("level") Integer level,@Param("version") Integer version);
 
     Integer getAreaTimezoneById(@Param("id") Integer id);
+
+    List<GlobalLocationDTO> getAreaListByPid(@Param("pid") Integer pid, @Param("version") Integer version);
+
+    List<GlobalLocationDTO> getCityListByPid(@Param("pid") Integer pid, @Param("version") Integer version);
 }

+ 19 - 0
src/main/java/com/welampiot/dao/PrivilegeNodeDao.java

@@ -0,0 +1,19 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.PrivilegeNodeDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: PrivilegeNodeDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/7/10 - 11:47
+ * @Version: v1.0
+ */
+public interface PrivilegeNodeDao {
+    List<PrivilegeNodeDTO> getPrivilegeListByParentId(@Param("parentId") Integer parentId, @Param("version") Integer version);
+}

+ 2 - 0
src/main/java/com/welampiot/dao/SectionDao.java

@@ -18,4 +18,6 @@ public interface SectionDao {
     Integer getSectionPidById(@Param("id") Integer id);
     void updateSectionData(SectionDTO dto);
     void deleteSectionDataById(@Param("id") Integer id);
+    List<SectionDTO> getAllSectionList();
+    List<SectionDTO> getAllSectionListByPid(@Param("id") Integer id);
 }

+ 1 - 0
src/main/java/com/welampiot/dao/UserDao.java

@@ -35,4 +35,5 @@ public interface UserDao {
     void addUserData(UserDTO dto);
     void updateUserAuth(UserDTO dto);
     void updateUserArea(UserDTO dto);
+    UserDTO getPrivilegeList(@Param("username") String username);
 }

+ 6 - 0
src/main/java/com/welampiot/dto/GlobalLocationDTO.java

@@ -60,5 +60,11 @@ public class GlobalLocationDTO implements Serializable {
     private List<GlobalLocationDTO> cityList;
     private List<GlobalLocationDTO> areaList;
 
+    public GlobalLocationDTO(Integer id, Integer pid, String name) {
+        this.id = id;
+        this.pid = pid;
+        this.name = name;
+    }
+
     private static final long serialVersionUID = 1L;
 }

+ 55 - 0
src/main/java/com/welampiot/dto/PrivilegeNodeDTO.java

@@ -0,0 +1,55 @@
+package com.welampiot.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: PrivilnodeDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/7/10 - 11:40
+ * @Version: v1.0
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PrivilegeNodeDTO implements Serializable {
+    private Integer id;
+
+    private Integer parentId;
+
+    private String name;
+
+    private String enName;
+
+    private String ruName;
+
+    private Integer level;
+
+    private Integer status;
+
+    private String action;
+
+    private Integer select;
+
+    private List<PrivilegeNodeDTO> subList;
+
+    public PrivilegeNodeDTO(Integer id, String name, Integer select) {
+        this.id = id;
+        this.name = name;
+        this.select = select;
+    }
+
+    public PrivilegeNodeDTO(Integer id, String name, Integer select, List<PrivilegeNodeDTO> subList) {
+        this.id = id;
+        this.name = name;
+        this.select = select;
+        this.subList = subList;
+    }
+}

+ 4 - 3
src/main/java/com/welampiot/service/GlobalLocationService.java

@@ -25,9 +25,10 @@ public interface GlobalLocationService {
     List<GlobalLocationDTO> getUserCityNav(GlobalLocationVO globalLocationVO);
     List<GlobalLocationDTO> getUserAreaNav(GlobalLocationVO globalLocationVO);
     GlobalLocationDTO getOneById(@Param("id") Integer id);
-    GlobalLocationDTO getAreaById(Integer id, Integer version);
+    GlobalLocationDTO getGlobalLocationDTOById(Integer id, Integer version);
     List<GlobalLocationDTO> getLocationListByPid(Integer pid, Integer version);
-    List<GlobalLocationDTO> getLocationListByDTO(GlobalLocationDTO dto);
-    List<Integer> getPidList(Integer level);
+    List<GlobalLocationDTO> getGlobalList(@Param("level") Integer level,@Param("version") Integer version);
     Integer getAreaTimezoneById(Integer id);
+    List<GlobalLocationDTO> getAreaListByPid(@Param("pid") Integer pid, @Param("version") Integer version);
+    List<GlobalLocationDTO> getCityListByPid(@Param("pid") Integer pid, @Param("version") Integer version);
 }

+ 18 - 0
src/main/java/com/welampiot/service/PrivilegeNodeService.java

@@ -0,0 +1,18 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.PrivilegeNodeDTO;
+
+import java.util.List;
+
+/**
+ * ClassName: PrivilegeNodeService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/7/10 - 11:48
+ * @Version: v1.0
+ */
+public interface PrivilegeNodeService {
+    List<PrivilegeNodeDTO> getPrivilegeListByParentId(Integer parentId, Integer version);
+}

+ 2 - 0
src/main/java/com/welampiot/service/SectionService.java

@@ -19,4 +19,6 @@ public interface SectionService {
     Integer getSectionPidById(Integer id);
     void updateSectionData(SectionDTO dto);
     void deleteSectionDataById(Integer id);
+    List<SectionDTO> getAllSectionList();
+    List<SectionDTO> getAllSectionListByPid(@Param("id") Integer id);
 }

+ 1 - 0
src/main/java/com/welampiot/service/UserService.java

@@ -34,4 +34,5 @@ public interface UserService {
     void addUserData(UserDTO dto);
     void updateUserAuth(UserDTO dto);
     void updateUserArea(UserDTO dto);
+    UserDTO getPrivilegeList(String username);
 }

+ 14 - 8
src/main/java/com/welampiot/service/impl/GlobalLocationServiceImpl.java

@@ -4,6 +4,7 @@ import com.welampiot.dao.GlobalLocationDao;
 import com.welampiot.dto.GlobalLocationDTO;
 import com.welampiot.service.GlobalLocationService;
 import com.welampiot.vo.GlobalLocationVO;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -161,8 +162,8 @@ public class GlobalLocationServiceImpl implements GlobalLocationService {
     }
 
     @Override
-    public GlobalLocationDTO getAreaById(Integer id, Integer version) {
-        return globalLocationDao.getAreaById(id,version);
+    public GlobalLocationDTO getGlobalLocationDTOById(Integer id, Integer version) {
+        return globalLocationDao.getGlobalLocationDTOById(id,version);
     }
 
     @Override
@@ -171,17 +172,22 @@ public class GlobalLocationServiceImpl implements GlobalLocationService {
     }
 
     @Override
-    public List<GlobalLocationDTO> getLocationListByDTO(GlobalLocationDTO dto) {
-        return globalLocationDao.getLocationListByDTO(dto);
+    public List<GlobalLocationDTO> getGlobalList(@Param("level") Integer level, @Param("version") Integer version) {
+        return globalLocationDao.getGlobalList(level,version);
     }
 
     @Override
-    public List<Integer> getPidList(Integer level) {
-        return globalLocationDao.getPidList(level);
+    public Integer getAreaTimezoneById(Integer id) {
+        return globalLocationDao.getAreaTimezoneById(id);
     }
 
     @Override
-    public Integer getAreaTimezoneById(Integer id) {
-        return globalLocationDao.getAreaTimezoneById(id);
+    public List<GlobalLocationDTO> getAreaListByPid(Integer pid, Integer version) {
+        return globalLocationDao.getAreaListByPid(pid,version);
+    }
+
+    @Override
+    public List<GlobalLocationDTO> getCityListByPid(Integer pid, Integer version) {
+        return globalLocationDao.getCityListByPid(pid,version);
     }
 }

+ 29 - 0
src/main/java/com/welampiot/service/impl/PrivilegeNodeServiceImpl.java

@@ -0,0 +1,29 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.PrivilegeNodeDao;
+import com.welampiot.dto.PrivilegeNodeDTO;
+import com.welampiot.service.PrivilegeNodeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: PrivilegeNodeServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/7/10 - 11:49
+ * @Version: v1.0
+ */
+@Service
+public class PrivilegeNodeServiceImpl implements PrivilegeNodeService {
+    @Autowired
+    private PrivilegeNodeDao privilegeNodeDao;
+
+    @Override
+    public List<PrivilegeNodeDTO> getPrivilegeListByParentId(Integer parentId, Integer version) {
+        return privilegeNodeDao.getPrivilegeListByParentId(parentId,version);
+    }
+}

+ 10 - 0
src/main/java/com/welampiot/service/impl/SectionServiceImpl.java

@@ -63,4 +63,14 @@ public class SectionServiceImpl implements SectionService {
     public void deleteSectionDataById(Integer id) {
         sectionDao.deleteSectionDataById(id);
     }
+
+    @Override
+    public List<SectionDTO> getAllSectionList() {
+        return sectionDao.getAllSectionList();
+    }
+
+    @Override
+    public List<SectionDTO> getAllSectionListByPid(Integer id) {
+        return sectionDao.getAllSectionListByPid(id);
+    }
 }

+ 6 - 1
src/main/java/com/welampiot/service/impl/UserServiceImpl.java

@@ -152,6 +152,11 @@ public class UserServiceImpl implements UserService {
 
     @Override
     public void updateUserArea(UserDTO dto) {
-        userDao.updateUserAuth(dto);
+        userDao.updateUserArea(dto);
+    }
+
+    @Override
+    public UserDTO getPrivilegeList(String username) {
+        return userDao.getPrivilegeList(username);
     }
 }

+ 21 - 0
src/main/java/com/welampiot/vo/PrivilegeVO.java

@@ -0,0 +1,21 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.PrivilegeNodeDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: PrivilegeVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/7/10 - 17:20
+ * @Version: v1.0
+ */
+@Data
+public class PrivilegeVO implements Serializable {
+    private List<PrivilegeNodeDTO> list;
+}

+ 64 - 23
src/main/resources/mapper/GlobalLocationMapper.xml

@@ -92,26 +92,26 @@
         from global_location where id = #{id}
     </select>
 
-    <select id="getAreaById" resultType="com.welampiot.dto.GlobalLocationDTO">
+    <select id="getGlobalLocationDTOById" resultType="com.welampiot.dto.GlobalLocationDTO">
         select
-            <choose>
-                <when test="version == 0">
-                    g.chinese_name as `name`,
-                </when>
-                <when test="version == 1">
-                    g.english_name as `name`,
-                </when>
-                <otherwise>
-                    g.ru_name as `name`,
-                </otherwise>
-            </choose>
-            g.id
+            g.id,g.pid
+        <choose>
+            <when test="version == 0">
+                ,g.chinese_name as `name`
+            </when>
+            <when test="version == 1">
+                ,g.english_name as `name`
+            </when>
+            <otherwise>
+                ,g.ru_name as `name`
+            </otherwise>
+        </choose>
         from global_location g
         where g.id = #{id}
     </select>
     
-    <select id="getLocationListByPid" parameterType="GlobalLocationDTO">
-        select g.id
+    <select id="getLocationListByPid" resultType="GlobalLocationDTO">
+        select g.id,g.pid
                 <choose>
                     <when test="version == 0">
                         ,g.chinese_name as `name`
@@ -127,8 +127,8 @@
         where g.pid = #{pid}
     </select>
 
-    <select id="getLocationListByDTO" resultType="GlobalLocationDTO">
-        select g.id
+    <select id="getGlobalList" resultType="GlobalLocationDTO">
+        select g.id,g.pid
         <choose>
             <when test="version == 0">
                 ,g.chinese_name as `name`
@@ -141,12 +141,6 @@
             </otherwise>
         </choose>
         from global_location g
-        where g.level = #{level} and g.pid = #{pid}
-    </select>
-
-    <select id="getPidList" resultType="java.util.List">
-        select g.id
-        from global_location g
         where g.level = #{level}
     </select>
 
@@ -155,5 +149,52 @@
         from global_location g
         where g.id = #{id}
     </select>
+
+    <select id="getAreaListByPid" resultType="GlobalLocationDTO">
+        SELECT
+            g.id,
+            g.pid
+            <choose>
+                <when test="version == 0">
+                    ,g.chinese_name AS `name`
+                </when>
+                <when test="version == 1">
+                    ,g.english_name AS `name`
+                </when>
+                <otherwise>
+                    ,g.ru_name AS `name`
+                </otherwise>
+            </choose>
+        FROM
+            global_location g
+                LEFT JOIN global_location a ON g.pid = a.id
+                LEFT JOIN global_location c ON a.pid = c.id
+                LEFT JOIN global_location p ON c.pid = p.id
+        WHERE
+            p.id = #{pid}
+    </select>
+
+    <select id="getCityListByPid" resultType="GlobalLocationDTO">
+        SELECT
+            g.id,
+            g.pid
+            <choose>
+                <when test="version == 0">
+                    ,g.chinese_name AS `name`
+                </when>
+                <when test="version == 1">
+                    ,g.english_name AS `name`
+                </when>
+                <otherwise>
+                    ,g.ru_name AS `name`
+                </otherwise>
+            </choose>
+        FROM
+            global_location g
+            LEFT JOIN global_location a ON g.pid = a.id
+            LEFT JOIN global_location c ON a.pid = c.id
+        WHERE
+            c.id = #{pid}
+    </select>
     
 </mapper>

+ 22 - 0
src/main/resources/mapper/PrivilegeNodeMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.welampiot.dao.PrivilegeNodeDao">
+
+    <select id="getPrivilegeListByParentId" resultType="PrivilegeNodeDTO">
+        select p.id,
+               <choose>
+                   <when test="version == 0">
+                       p.name as `name`
+                   </when>
+                   <when test="version == 1">
+                       p.en_name as `name`
+                   </when>
+                   <otherwise>
+                       p.ru_name as `name`
+                   </otherwise>
+               </choose>
+        from privilnode p
+        where p.parentid = #{parentId}
+    </select>
+
+</mapper>

+ 15 - 0
src/main/resources/mapper/SectionMapper.xml

@@ -85,4 +85,19 @@
         from section
         where id = #{id};
     </delete>
+
+    <select id="getAllSectionList" resultType="SectionDTO">
+        SELECT s.id,s.name,s.pid
+        FROM section s
+    </select>
+
+    <select id="getAllSectionListByPid" resultType="SectionDTO">
+        select s.id,s.name,s.pid
+        from section s
+        left join global_location a on s.pid = a.id
+        left join global_location c on a.pid = c.id
+        left join global_location p on c.pid = p.id
+        left join global_location g on p.pid = g.id
+        where g.id = #{id}
+    </select>
 </mapper>

+ 6 - 0
src/main/resources/mapper/UserMapper.xml

@@ -338,5 +338,11 @@
             u.zone_list = #{zoneList}
         where u.id = #{id}
     </update>
+
+    <select id="getPrivilegeList" resultType="UserDTO">
+        select u.privilege_list as privilegeList
+        from user u
+        where u.username = #{username}
+    </select>
     
 </mapper>