Procházet zdrojové kódy

添加后线人员管联前线部门的逻辑
添加内部机构
添加后线人员分配内部机构

hxl13994548489 před 2 roky
rodič
revize
fb699db700
22 změnil soubory, kde provedl 1376 přidání a 0 odebrání
  1. 94 0
      src/main/java/com/ydtech/modules/admin/controller/SysDeptInternalAgentController.java
  2. 94 0
      src/main/java/com/ydtech/modules/admin/controller/SysUserLinkDeptInternalAgentController.java
  3. 27 0
      src/main/java/com/ydtech/modules/admin/dao/SysDeptInternalAgentMapper.java
  4. 8 0
      src/main/java/com/ydtech/modules/admin/dao/SysDeptMapper.java
  5. 48 0
      src/main/java/com/ydtech/modules/admin/dao/SysUserLinkDeptInternalAgentMapper.java
  6. 4 0
      src/main/java/com/ydtech/modules/admin/model/SysDept.java
  7. 57 0
      src/main/java/com/ydtech/modules/admin/model/dto/SysDeptInternalAgentDto.java
  8. 54 0
      src/main/java/com/ydtech/modules/admin/model/dto/SysUserLinkDeptInternalAgentDto.java
  9. 174 0
      src/main/java/com/ydtech/modules/admin/model/po/SysDeptInternalAgent.java
  10. 128 0
      src/main/java/com/ydtech/modules/admin/model/po/SysUserLinkDeptInternalAgent.java
  11. 128 0
      src/main/java/com/ydtech/modules/admin/model/po/SysUserLinkFrontLineDept.java
  12. 61 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysDeptInternalAgentAddVo.java
  13. 24 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysDeptInternalAgentIdsVo.java
  14. 23 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysDeptInternalAgentQueryVo.java
  15. 30 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserLinkDeptInternalAgentAddVo.java
  16. 24 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserLinkDeptInternalAgentIdsVo.java
  17. 25 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserLinkDeptInternalAgentQueryVo.java
  18. 53 0
      src/main/java/com/ydtech/modules/admin/service/SysDeptInternalAgentService.java
  19. 47 0
      src/main/java/com/ydtech/modules/admin/service/SysUserLinkDeptInternalAgentService.java
  20. 127 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysDeptInternalAgentServiceImpl.java
  21. 129 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserLinkDeptInternalAgentServiceImpl.java
  22. 17 0
      src/main/resources/mapper/modules/admin/SysDeptMapper.xml

+ 94 - 0
src/main/java/com/ydtech/modules/admin/controller/SysDeptInternalAgentController.java

@@ -0,0 +1,94 @@
+package com.ydtech.modules.admin.controller;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.dto.SysDeptInternalAgentDto;
+import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
+import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentAddVo;
+import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentIdsVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkAreaVo;
+import com.ydtech.modules.admin.service.SysDeptInternalAgentService;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.entity.BasePageResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/26 17:42
+ *  @Description: 内部机构管理
+ */
+@Api(tags = "内部机构管理")
+@RequestMapping("/sysDeptInternalAgent")
+@RestController
+public class SysDeptInternalAgentController extends BaseController {
+
+
+    @Autowired
+    private SysDeptInternalAgentService sysDeptInternalAgentService;
+
+    @PostMapping("queryPage")
+    @ApiOperation(value = "内部机构分页")
+    public HttpResult<BasePageResult<SysDeptInternalAgentDto>> queryPage(@RequestBody SysUserLinkAreaVo sysUserLinkAreaVo) {
+
+        try{
+            BasePageResult<SysDeptInternalAgentDto> result = sysDeptInternalAgentService.queryPage(sysUserLinkAreaVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
+    @PostMapping("addOrUpdate")
+    @ApiOperation("内部机构添加修改")
+    public HttpResult<Object> addOrUpdate(@RequestBody SysDeptInternalAgentAddVo sysDeptInternalAgentAddVo) {
+        try{
+            sysDeptInternalAgentService.addOrUpdate(sysDeptInternalAgentAddVo);
+            return HttpResult.ok("操作成功");
+        }catch (Exception e){
+            return HttpResult.error("操作失败"+e.getMessage());
+        }
+
+    }
+
+
+    @GetMapping("/findSysDeptInternalAgentById")
+    @ApiOperation(value = "内部机构编辑回显")
+    public HttpResult<SysDeptInternalAgent> findSysDeptInternalAgentById(String id) {
+        if(id==null || "".equals(id)) {
+            return HttpResult.error("内部机构id不能为空");
+        }
+        try{
+            SysDeptInternalAgent sysDeptInternalAgent = sysDeptInternalAgentService.findSysDeptInternalAgentById(id);
+            return HttpResult.ok(sysDeptInternalAgent);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+
+    }
+    @ApiOperation(value = "获取树结构")
+    @GetMapping(value = "/findTree")
+    public HttpResult<List<SysDeptInternalAgent>> findTree(String deptId,String comtype) {
+        return HttpResult.ok(sysDeptInternalAgentService.findTree(deptId,comtype));
+    }
+
+    @PostMapping("delete")
+    @ApiOperation("内部机构删除")
+    public HttpResult<Object> delete(@RequestBody SysDeptInternalAgentIdsVo idsVo) {
+        if(idsVo.getIds()==null || idsVo.getIds().size()==0){
+            return HttpResult.error("内部机构ids不能为空");
+        }
+        try{
+            sysDeptInternalAgentService.deleteByIds(idsVo.getIds());
+            return HttpResult.ok("删除成功");
+        }catch (Exception e){
+            return HttpResult.error("删除失败"+e.getMessage());
+        }
+    }
+
+}

+ 94 - 0
src/main/java/com/ydtech/modules/admin/controller/SysUserLinkDeptInternalAgentController.java

@@ -0,0 +1,94 @@
+package com.ydtech.modules.admin.controller;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
+import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
+import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentQueryVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentAddVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentIdsVo;
+import com.ydtech.modules.admin.service.SysUserLinkDeptInternalAgentService;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.entity.BasePageResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/4/26 11:09
+ *  @Description:  后线人员区域配置
+ */
+@Api(tags = "后线人员配置内部机构")
+@RequestMapping("/sysUserLinkDeptInternalAgent")
+@RestController
+public class SysUserLinkDeptInternalAgentController extends BaseController {
+
+
+    @Autowired
+    private SysUserLinkDeptInternalAgentService sysUserLinkDeptInternalAgentService;
+
+    @GetMapping("queryOrgTree")
+    @ApiOperation(value = "获取内部机构树")
+    public HttpResult<List<SysDeptInternalAgent>> queryOrgTree() {
+
+        try{
+            List<SysDeptInternalAgent> tree = sysUserLinkDeptInternalAgentService.queryOrgTree();
+            return HttpResult.ok("查询数据成功", tree);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
+    @PostMapping("addOrUpdate")
+    @ApiOperation("后线人员配置内部机构添加修改")
+    public HttpResult<Object> addOrUpdate(@RequestBody SysUserLinkDeptInternalAgentAddVo sysUserLinkDeptInternalAgentAddVo) {
+        if(sysUserLinkDeptInternalAgentAddVo.getUserIds()==null || sysUserLinkDeptInternalAgentAddVo.getUserIds().size()==0) {
+            return HttpResult.error("后线人员ids不能为空");
+        }
+        if(sysUserLinkDeptInternalAgentAddVo.getDeptId()==null || "".equals(sysUserLinkDeptInternalAgentAddVo.getDeptId())) {
+            return HttpResult.error("机构id不能为空");
+        }
+        try{
+            sysUserLinkDeptInternalAgentService.addOrUpdate(sysUserLinkDeptInternalAgentAddVo);
+            return HttpResult.ok("操作成功");
+        }catch (Exception e){
+            return HttpResult.error("操作失败"+e.getMessage());
+        }
+
+    }
+
+    @PostMapping("delete")
+    @ApiOperation("后线人员配置内部机构删除")
+    public HttpResult<Object> delete(@RequestBody SysUserLinkDeptInternalAgentIdsVo idsVo) {
+        if(idsVo.getIds()==null || idsVo.getIds().size()==0){
+            return HttpResult.error("后线人员关联内部机构ids不能为空");
+        }
+        try{
+            sysUserLinkDeptInternalAgentService.deleteByIds(idsVo.getIds());
+            return HttpResult.ok("删除成功");
+        }catch (Exception e){
+            return HttpResult.error("删除失败"+e.getMessage());
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/4/26 17:44
+     *  @Description: 查询所有的后线人员列表+分页
+     */
+    @PostMapping("queryPage")
+    @ApiOperation("查询后线人员配置内部机构列表+分页")
+    public HttpResult<BasePageResult<SysUserLinkDeptInternalAgentDto>> queryPage(@RequestBody SysDeptInternalAgentQueryVo sysDeptInternalAgentQueryVo) {
+        try{
+            BasePageResult<SysUserLinkDeptInternalAgentDto> result = sysUserLinkDeptInternalAgentService.queryPage(sysDeptInternalAgentQueryVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+}

+ 27 - 0
src/main/java/com/ydtech/modules/admin/dao/SysDeptInternalAgentMapper.java

@@ -0,0 +1,27 @@
+package com.ydtech.modules.admin.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
+
+import java.util.List;
+
+
+/**
+* @author Administrator
+* @description 针对表【sys_dept_internal_agent(内部机构管理)】的数据库操作Mapper
+* @createDate 2024-06-26 17:28:34
+* @Entity generator.domain.SysDeptInternalAgent
+*/
+public interface SysDeptInternalAgentMapper extends BaseMapper<SysDeptInternalAgent> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/27 11:20
+     *  @Description: 查询所有的机构
+     */
+    List<SysDeptInternalAgent> queryDeptList();
+}
+
+
+
+

+ 8 - 0
src/main/java/com/ydtech/modules/admin/dao/SysDeptMapper.java

@@ -17,6 +17,14 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
      *  @Description: 通过县级code查询门店列表
      */
     List<SysDept> queryListByParentId(@Param(value = "level") String level,@Param(value = "parentId") String parentId);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 19:55
+     *  @Description: 获取前线机构列表
+     */
+    List<SysDept> queryListByQXDept();
 }
 
 

+ 48 - 0
src/main/java/com/ydtech/modules/admin/dao/SysUserLinkDeptInternalAgentMapper.java

@@ -0,0 +1,48 @@
+package com.ydtech.modules.admin.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
+import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
+import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
+import com.ydtech.modules.admin.model.po.SysUserLinkDeptInternalAgent;
+import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentQueryVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【sys_user_link_dept_internal_agent(后线人员配置内部机构表)】的数据库操作Mapper
+* @createDate 2024-06-26 17:28:11
+* @Entity generator.domain.SysUserLinkDeptInternalAgent
+*/
+public interface SysUserLinkDeptInternalAgentMapper extends BaseMapper<SysUserLinkDeptInternalAgent> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 19:10
+     *  @Description: 查询分页数据
+     */
+    Page<SysUserLinkDeptInternalAgentDto> queryPage(@Param("page") Page<SysUserLinkPtlAgreementDto> page,@Param("vo")  SysDeptInternalAgentQueryVo sysDeptInternalAgentQueryVo);
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 19:26
+     *  @Description: 通过机构id删除的绑定的数据
+     */
+    void deleteByDeptId(@Param("deptId") String deptId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/27 11:21
+     *  @Description: 查询用户
+     */
+    List<SysDeptInternalAgent> findDeptListByUserId(String userId);
+}
+
+
+
+

+ 4 - 0
src/main/java/com/ydtech/modules/admin/model/SysDept.java

@@ -160,6 +160,10 @@ public class SysDept implements Serializable {
     @TableField(exist = false)
     private Integer mark;
 
+    // 机构绑定标识
+    @TableField(exist = false)
+    private boolean flag;
+
 }
 
 

+ 57 - 0
src/main/java/com/ydtech/modules/admin/model/dto/SysDeptInternalAgentDto.java

@@ -0,0 +1,57 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 内部机构管理
+ * @TableName sys_dept_internal_agent
+ */
+@TableName(value ="sys_dept_internal_agent")
+@Data
+public class SysDeptInternalAgentDto implements Serializable {
+    /**
+     * 编号
+     */
+    @ApiModelProperty(value = "备注")
+    private String id;
+
+    /**
+     * 机构名称
+     */
+    @ApiModelProperty(value = "备注")
+    private String name;
+
+    /**
+     * 上级机构ID,一级机构为0
+     */
+    @ApiModelProperty(value = "备注")
+    private String parentId;
+
+    /**
+     * 排序
+     */
+    @ApiModelProperty(value = "备注")
+    private Integer orderNum;
+    /**
+     * 机构类型(1.机构 2.组长3.组员)
+     */
+    @ApiModelProperty(value = "备注")
+    private String comtype;
+
+    /**
+     * 机构级别
+     */
+    @ApiModelProperty(value = "机构级别")
+    private String comlevel;
+
+    /**
+     * 机构编码
+     */
+    @ApiModelProperty(value = "机构编码")
+    private String deptCode;
+
+}

+ 54 - 0
src/main/java/com/ydtech/modules/admin/model/dto/SysUserLinkDeptInternalAgentDto.java

@@ -0,0 +1,54 @@
+package com.ydtech.modules.admin.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 后线人员配置内部机构表
+ * @TableName sys_user_link_dept_internal_agent
+ */
+@Data
+@ApiModel("后线人员配置内部机构列表数据")
+public class SysUserLinkDeptInternalAgentDto implements Serializable {
+    /**
+     * 主键
+     */
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    /**
+     * 后线人员id
+     */
+    @ApiModelProperty(value = "后线人员id")
+    private String userId;
+    /**
+     * 后线人员id
+     */
+    @ApiModelProperty(value = "后线人员名称")
+    private String userName;
+
+    /**
+     * 内部机构id
+     */
+    @ApiModelProperty(value = "机构id")
+    private String deptId;
+
+
+    /**
+     * 内部机构id
+     */
+    @ApiModelProperty(value = "机构名称")
+    private String deptName;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date createTime;
+}

+ 174 - 0
src/main/java/com/ydtech/modules/admin/model/po/SysDeptInternalAgent.java

@@ -0,0 +1,174 @@
+package com.ydtech.modules.admin.model.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 内部机构管理
+ * @TableName sys_dept_internal_agent
+ */
+@TableName(value ="sys_dept_internal_agent")
+@Data
+public class SysDeptInternalAgent implements Serializable {
+    /**
+     * 编号
+     */
+    @TableId
+    private String id;
+
+    /**
+     * 机构名称
+     */
+    @TableField(value = "name")
+    private String name;
+
+    /**
+     * 上级机构ID,一级机构为0
+     */
+    @TableField(value = "parent_id")
+    private String parentId;
+
+    /**
+     * 排序
+     */
+    @TableField(value = "order_num")
+    private Integer orderNum;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_by")
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    /**
+     * 更新人
+     */
+    @TableField(value = "last_update_by")
+    private String lastUpdateBy;
+
+    /**
+     * 更新时间
+     */
+    @TableField(value = "last_update_time")
+    private Date lastUpdateTime;
+
+    /**
+     * 是否删除  -1:已删除  0:正常
+     */
+    @TableField(value = "del_flag")
+    private Integer delFlag;
+
+    /**
+     * 机构类型(1.机构 2.组长3.组员)
+     */
+    @TableField(value = "comtype")
+    private String comtype;
+
+    /**
+     * 机构级别
+     */
+    @TableField(value = "comlevel")
+    private String comlevel;
+
+    /**
+     * 机构编码
+     */
+    @TableField(value = "dept_code")
+    private String deptCode;
+
+    @TableField(value = "parent_name")
+    private String parentName;
+
+    @TableField(value = "parent_ids")
+    private String parentIds;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+
+    @TableField(exist = false)
+    private List<SysDeptInternalAgent> children;
+
+    @TableField(exist = false)
+    private String flag;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        SysDeptInternalAgent other = (SysDeptInternalAgent) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
+            && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
+            && (this.getOrderNum() == null ? other.getOrderNum() == null : this.getOrderNum().equals(other.getOrderNum()))
+            && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getLastUpdateBy() == null ? other.getLastUpdateBy() == null : this.getLastUpdateBy().equals(other.getLastUpdateBy()))
+            && (this.getLastUpdateTime() == null ? other.getLastUpdateTime() == null : this.getLastUpdateTime().equals(other.getLastUpdateTime()))
+            && (this.getDelFlag() == null ? other.getDelFlag() == null : this.getDelFlag().equals(other.getDelFlag()))
+            && (this.getComtype() == null ? other.getComtype() == null : this.getComtype().equals(other.getComtype()))
+            && (this.getComlevel() == null ? other.getComlevel() == null : this.getComlevel().equals(other.getComlevel()))
+            && (this.getDeptCode() == null ? other.getDeptCode() == null : this.getDeptCode().equals(other.getDeptCode()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
+        result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
+        result = prime * result + ((getOrderNum() == null) ? 0 : getOrderNum().hashCode());
+        result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getLastUpdateBy() == null) ? 0 : getLastUpdateBy().hashCode());
+        result = prime * result + ((getLastUpdateTime() == null) ? 0 : getLastUpdateTime().hashCode());
+        result = prime * result + ((getDelFlag() == null) ? 0 : getDelFlag().hashCode());
+        result = prime * result + ((getComtype() == null) ? 0 : getComtype().hashCode());
+        result = prime * result + ((getComlevel() == null) ? 0 : getComlevel().hashCode());
+        result = prime * result + ((getDeptCode() == null) ? 0 : getDeptCode().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", name=").append(name);
+        sb.append(", parentId=").append(parentId);
+        sb.append(", orderNum=").append(orderNum);
+        sb.append(", createBy=").append(createBy);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", lastUpdateBy=").append(lastUpdateBy);
+        sb.append(", lastUpdateTime=").append(lastUpdateTime);
+        sb.append(", delFlag=").append(delFlag);
+        sb.append(", comtype=").append(comtype);
+        sb.append(", comlevel=").append(comlevel);
+        sb.append(", deptCode=").append(deptCode);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 128 - 0
src/main/java/com/ydtech/modules/admin/model/po/SysUserLinkDeptInternalAgent.java

@@ -0,0 +1,128 @@
+package com.ydtech.modules.admin.model.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 后线人员配置内部机构表
+ * @TableName sys_user_link_dept_internal_agent
+ */
+@TableName(value ="sys_user_link_dept_internal_agent")
+@Data
+public class SysUserLinkDeptInternalAgent implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 后线人员id
+     */
+    @TableField(value = "user_id")
+    private String userId;
+
+    /**
+     * 内部机构id
+     */
+    @TableField(value = "sys_dept_internal_agent_id")
+    private String sysDeptInternalAgentId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_user")
+    private String createUser;
+
+    /**
+     * 修改时间
+     */
+    @TableField(value = "update_time")
+    private Date updateTime;
+
+    /**
+     * 修改人
+     */
+    @TableField(value = "update_user")
+    private String updateUser;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        SysUserLinkDeptInternalAgent other = (SysUserLinkDeptInternalAgent) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
+            && (this.getSysDeptInternalAgentId() == null ? other.getSysDeptInternalAgentId() == null : this.getSysDeptInternalAgentId().equals(other.getSysDeptInternalAgentId()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
+            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
+            && (this.getUpdateUser() == null ? other.getUpdateUser() == null : this.getUpdateUser().equals(other.getUpdateUser()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
+        result = prime * result + ((getSysDeptInternalAgentId() == null) ? 0 : getSysDeptInternalAgentId().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
+        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
+        result = prime * result + ((getUpdateUser() == null) ? 0 : getUpdateUser().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", userId=").append(userId);
+        sb.append(", sysDeptInternalAgentId=").append(sysDeptInternalAgentId);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUser=").append(createUser);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", updateUser=").append(updateUser);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public SysUserLinkDeptInternalAgent() {
+    }
+
+    public SysUserLinkDeptInternalAgent(String userId, String sysDeptInternalAgentId, Date createTime, String createUser, Date updateTime, String updateUser) {
+        this.userId = userId;
+        this.sysDeptInternalAgentId = sysDeptInternalAgentId;
+        this.createTime = createTime;
+        this.createUser = createUser;
+        this.updateTime = updateTime;
+        this.updateUser = updateUser;
+    }
+}

+ 128 - 0
src/main/java/com/ydtech/modules/admin/model/po/SysUserLinkFrontLineDept.java

@@ -0,0 +1,128 @@
+package com.ydtech.modules.admin.model.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 后线人员配置内部机构表
+ * @TableName sys_user_link_front_line_dept
+ */
+@TableName(value ="sys_user_link_front_line_dept")
+@Data
+public class SysUserLinkFrontLineDept implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 后线人员id
+     */
+    @TableField(value = "user_id")
+    private String userId;
+
+    /**
+     * 内部机构id
+     */
+    @TableField(value = "front_line_dept_id")
+    private String frontLineDeptId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_user")
+    private String createUser;
+
+    /**
+     * 修改时间
+     */
+    @TableField(value = "update_time")
+    private Date updateTime;
+
+    /**
+     * 修改人
+     */
+    @TableField(value = "update_user")
+    private String updateUser;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        SysUserLinkFrontLineDept other = (SysUserLinkFrontLineDept) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
+            && (this.getFrontLineDeptId() == null ? other.getFrontLineDeptId() == null : this.getFrontLineDeptId().equals(other.getFrontLineDeptId()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
+            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
+            && (this.getUpdateUser() == null ? other.getUpdateUser() == null : this.getUpdateUser().equals(other.getUpdateUser()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
+        result = prime * result + ((getFrontLineDeptId() == null) ? 0 : getFrontLineDeptId().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
+        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
+        result = prime * result + ((getUpdateUser() == null) ? 0 : getUpdateUser().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", userId=").append(userId);
+        sb.append(", frontLineDeptId=").append(frontLineDeptId);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUser=").append(createUser);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", updateUser=").append(updateUser);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public SysUserLinkFrontLineDept() {
+    }
+
+    public SysUserLinkFrontLineDept(String userId, String frontLineDeptId, Date createTime, String createUser, Date updateTime, String updateUser) {
+        this.userId = userId;
+        this.frontLineDeptId = frontLineDeptId;
+        this.createTime = createTime;
+        this.createUser = createUser;
+        this.updateTime = updateTime;
+        this.updateUser = updateUser;
+    }
+}

+ 61 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysDeptInternalAgentAddVo.java

@@ -0,0 +1,61 @@
+package com.ydtech.modules.admin.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/26 18:04
+ *  @Description: 内部机构添加对象
+ */
+@Data
+@ApiModel("内部机构添加对象")
+public class SysDeptInternalAgentAddVo implements Serializable {
+    /**
+     * 编号
+     */
+    @ApiModelProperty("编号")
+    private String id;
+
+    /**
+     * 机构名称
+     */
+    @ApiModelProperty("机构名称")
+    private String name;
+
+    /**
+     * 上级机构ID,一级机构为0
+     */
+    @ApiModelProperty("上级机构ID")
+    private String parentId;
+
+    /**
+     * 排序
+     */
+    @ApiModelProperty("排序")
+    private Integer orderNum;
+
+    /**
+     * 机构类型(1.机构 2.组长3.组员)
+     */
+    @ApiModelProperty("机构类型")
+    private String comtype;
+
+    /**
+     * 机构级别
+     */
+    @ApiModelProperty("机构级别")
+    private String comlevel;
+
+    /**
+     * 机构编码
+     */
+    @ApiModelProperty("机构编码")
+    private String deptCode;
+
+
+}

+ 24 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysDeptInternalAgentIdsVo.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.admin.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/26 17:59
+ *  @Description: 内部机构删除Vo
+ */
+@Data
+@ApiModel("内部机构删除Vo")
+public class SysDeptInternalAgentIdsVo {
+
+    /***
+     * 内部机构ID
+     */
+    @ApiModelProperty("内部机构ids")
+    private List<String> ids;
+}

+ 23 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysDeptInternalAgentQueryVo.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.admin.model.vo;
+
+import com.ydtech.core.page.BasePageVO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/26 18:02
+ *  @Description: 内部机构的查询vo
+ */
+@Data
+@ApiModel("内部机构的查询vo")
+public class SysDeptInternalAgentQueryVo extends BasePageVO {
+
+    @ApiModelProperty("内部机构编码")
+    private String orgCode;
+
+    @ApiModelProperty("内部机构名称")
+    private String orgName;
+}

+ 30 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysUserLinkDeptInternalAgentAddVo.java

@@ -0,0 +1,30 @@
+package com.ydtech.modules.admin.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/26 18:08
+ *  @Description: 后线人员配置内部机构添加
+ */
+@Data
+@ApiModel("后线人员配置内部机构添加对象")
+public class SysUserLinkDeptInternalAgentAddVo implements Serializable {
+    /**
+     *  内部机构id
+     */
+    private String deptId;
+
+    /**
+     *  后线人员用户ids
+     */
+    private List<String> userIds =new ArrayList<String>();
+
+
+}

+ 24 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysUserLinkDeptInternalAgentIdsVo.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.admin.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/26 17:59
+ *  @Description: 内部机构删除Vo
+ */
+@Data
+@ApiModel("后线人员配置内部机构删除Vo")
+public class SysUserLinkDeptInternalAgentIdsVo {
+
+    /***
+     * 后线人员配置内部机构ids
+     */
+    @ApiModelProperty("后线人员配置内部机构ids")
+    private List<String> ids;
+}

+ 25 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysUserLinkDeptInternalAgentQueryVo.java

@@ -0,0 +1,25 @@
+package com.ydtech.modules.admin.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/26 18:02
+ *  @Description: 内部机构的查询vo
+ */
+@Data
+@ApiModel("后线人员配置内部机构的查询vo")
+public class SysUserLinkDeptInternalAgentQueryVo {
+
+    @ApiModelProperty("内部机构id")
+    private String deptId;
+
+    @ApiModelProperty("后线人员名称")
+    private String userName;
+
+    @ApiModelProperty("后线人员工号")
+    private String userId;
+}

+ 53 - 0
src/main/java/com/ydtech/modules/admin/service/SysDeptInternalAgentService.java

@@ -0,0 +1,53 @@
+package com.ydtech.modules.admin.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.admin.model.dto.SysDeptInternalAgentDto;
+import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
+import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentAddVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkAreaVo;
+import com.ydtech.modules.order.entity.BasePageResult;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【sys_dept_internal_agent(内部机构管理)】的数据库操作Service
+* @createDate 2024-06-26 17:28:34
+*/
+public interface SysDeptInternalAgentService extends IService<SysDeptInternalAgent> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:26
+     *  @Description:  内部机构分页
+     */
+    BasePageResult<SysDeptInternalAgentDto> queryPage(SysUserLinkAreaVo sysUserLinkAreaVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:27
+     *  @Description: 内部机构的添加、修改
+     */
+    void addOrUpdate(SysDeptInternalAgentAddVo sysDeptInternalAgentAddVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:27
+     *  @Description: 内部机构的删除
+     */
+    void deleteByIds(List<String> ids);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:30
+     *  @Description: 内部机构回显
+     */
+    SysDeptInternalAgent findSysDeptInternalAgentById(String id);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/27 12:04
+     *  @Description: 查询机构与树
+     */
+    List<SysDeptInternalAgent> findTree(String deptId, String comtype);
+}

+ 47 - 0
src/main/java/com/ydtech/modules/admin/service/SysUserLinkDeptInternalAgentService.java

@@ -0,0 +1,47 @@
+package com.ydtech.modules.admin.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
+import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
+import com.ydtech.modules.admin.model.po.SysUserLinkDeptInternalAgent;
+import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentQueryVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentAddVo;
+import com.ydtech.modules.order.entity.BasePageResult;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【sys_user_link_dept_internal_agent(后线人员配置内部机构表)】的数据库操作Service
+* @createDate 2024-06-26 17:28:11
+*/
+public interface SysUserLinkDeptInternalAgentService extends IService<SysUserLinkDeptInternalAgent> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:32
+     *  @Description:  查询内部机构树
+     */
+    List<SysDeptInternalAgent> queryOrgTree();
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:35
+     *  @Description: 添加后线人员关联内部机构数据
+     */
+    void addOrUpdate(SysUserLinkDeptInternalAgentAddVo sysUserLinkDeptInternalAgentAddVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:38
+     *  @Description: 批量删除数据
+     */
+    void deleteByIds(List<String> ids);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:43
+     *  @Description:  分页接口
+     */
+    BasePageResult<SysUserLinkDeptInternalAgentDto> queryPage(SysDeptInternalAgentQueryVo sysDeptInternalAgentQueryVo);
+}

+ 127 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysDeptInternalAgentServiceImpl.java

@@ -0,0 +1,127 @@
+package com.ydtech.modules.admin.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.admin.dao.SysDeptInternalAgentMapper;
+import com.ydtech.modules.admin.model.dto.SysDeptInternalAgentDto;
+import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
+import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentAddVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkAreaVo;
+import com.ydtech.modules.admin.service.SysDeptInternalAgentService;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.utils.HeadUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+* @author Administrator
+* @description 针对表【sys_dept_internal_agent(内部机构管理)】的数据库操作Service实现
+* @createDate 2024-06-26 17:28:34
+*/
+@Service
+public class SysDeptInternalAgentServiceImpl extends ServiceImpl<SysDeptInternalAgentMapper, SysDeptInternalAgent>
+    implements SysDeptInternalAgentService {
+
+    @Autowired
+    private SysDeptInternalAgentMapper sysDeptInternalAgentMapper;
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:53
+     *  @Description: 分页
+     */
+    @Override
+    public BasePageResult<SysDeptInternalAgentDto> queryPage(SysUserLinkAreaVo sysUserLinkAreaVo) {
+        return null;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:53
+     *  @Description: 添加或修改
+     */
+    @Override
+    public void addOrUpdate(SysDeptInternalAgentAddVo sysDeptInternalAgentAddVo) {
+        String parentId = sysDeptInternalAgentAddVo.getParentId();
+        String id = sysDeptInternalAgentAddVo.getId();
+        SysDeptInternalAgent sysDept = new SysDeptInternalAgent();
+        BeanUtils.copyProperties(sysDeptInternalAgentAddVo, sysDept);
+        String uuid = HeadUtils.get16UUID();
+        SysDeptInternalAgent sysDeptInternalAgentParent = sysDeptInternalAgentMapper.selectById(parentId);
+        if(StringUtils.isNotBlank(id)){
+            //更新操作
+            sysDeptInternalAgentMapper.updateById(sysDept);
+        }else{
+            //插入操作
+            sysDept.setId(uuid);
+            sysDept.setParentName(sysDeptInternalAgentParent.getName());
+            sysDept.setParentIds(sysDeptInternalAgentParent.getParentIds()+","+uuid);
+            sysDept.setComlevel(sysDeptInternalAgentParent.getComlevel()+1);
+            sysDeptInternalAgentMapper.insert(sysDept);
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:53
+     *  @Description:  删除
+     */
+    @Override
+    public void deleteByIds(List<String> ids) {
+        sysDeptInternalAgentMapper.deleteBatchIds(ids);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:54
+     *  @Description: 查询对象
+     */
+    @Override
+    public SysDeptInternalAgent findSysDeptInternalAgentById(String id) {
+        return sysDeptInternalAgentMapper.selectById(id);
+    }
+
+    @Override
+    public List<SysDeptInternalAgent> findTree(String deptId, String comtype) {
+        List<SysDeptInternalAgent> sysDeptAll =sysDeptInternalAgentMapper.queryDeptList();
+        List<SysDeptInternalAgent> resultList =new ArrayList<SysDeptInternalAgent>();
+        List<SysDeptInternalAgent> sysDeptTop = sysDeptAll.stream().filter(item ->"0".equals(item.getParentId())).collect(Collectors.toList());
+        for (SysDeptInternalAgent dept : sysDeptTop) {
+            resultList.add(buildDeptTree(dept,sysDeptAll));
+        }
+        return resultList;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/27 8:42
+     *  @Description: 获取顶级机构的数据
+     */
+    /**
+     * 递归构建树形结构
+     */
+    private SysDeptInternalAgent buildDeptTree(SysDeptInternalAgent dept, List<SysDeptInternalAgent> deptList){
+        for (SysDeptInternalAgent d : deptList) {
+            if (dept.getId().equals(d.getParentId())) {
+                if (null == dept.getChildren()) {
+                    dept.setChildren(new ArrayList<SysDeptInternalAgent>());
+                }
+                //递归调用
+                dept.getChildren().add(buildDeptTree(d, deptList));
+            }
+        }
+        return dept;
+    }
+}
+
+
+
+

+ 129 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysUserLinkDeptInternalAgentServiceImpl.java

@@ -0,0 +1,129 @@
+package com.ydtech.modules.admin.service.impl;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.admin.dao.SysDeptInternalAgentMapper;
+import com.ydtech.modules.admin.dao.SysUserLinkDeptInternalAgentMapper;
+import com.ydtech.modules.admin.model.SysDept;
+import com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto;
+import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
+import com.ydtech.modules.admin.model.po.SysDeptInternalAgent;
+import com.ydtech.modules.admin.model.po.SysUserLinkDeptInternalAgent;
+import com.ydtech.modules.admin.model.vo.SysDeptInternalAgentQueryVo;
+import com.ydtech.modules.admin.model.vo.SysUserLinkDeptInternalAgentAddVo;
+import com.ydtech.modules.admin.service.SysUserLinkDeptInternalAgentService;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.entity.BasePageResult;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+* @author Administrator
+* @description 针对表【sys_user_link_dept_internal_agent(后线人员配置内部机构表)】的数据库操作Service实现
+* @createDate 2024-06-26 17:28:11
+*/
+@Service
+public class SysUserLinkDeptInternalAgentServiceImpl extends ServiceImpl<SysUserLinkDeptInternalAgentMapper, SysUserLinkDeptInternalAgent>
+    implements SysUserLinkDeptInternalAgentService {
+
+    @Autowired
+    private SysUserLinkDeptInternalAgentMapper  sysUserLinkDeptInternalAgentMapper;
+
+    @Autowired
+    private SysDeptInternalAgentMapper sysDeptInternalAgentMapper;
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:54
+     *  @Description: 查询内部机构树
+     */
+    @Override
+    public List<SysDeptInternalAgent> queryOrgTree() {
+        List<SysDeptInternalAgent> sysDeptAll =sysDeptInternalAgentMapper.queryDeptList();
+        List<SysDeptInternalAgent> resultList =new ArrayList<SysDeptInternalAgent>();
+        List<SysDeptInternalAgent> sysDeptTop = sysDeptAll.stream().filter(item ->"3".equals(item.getComlevel())).collect(Collectors.toList());
+        for (SysDeptInternalAgent dept : sysDeptTop) {
+            resultList.add(buildDeptTree(dept,sysDeptAll));
+        }
+        return resultList;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/27 8:42
+     *  @Description: 获取顶级机构的数据
+     */
+    /**
+     * 递归构建树形结构
+     */
+    private SysDeptInternalAgent buildDeptTree(SysDeptInternalAgent dept, List<SysDeptInternalAgent> deptList){
+        for (SysDeptInternalAgent d : deptList) {
+            if (dept.getId().equals(d.getParentId())) {
+                if (null == dept.getChildren()) {
+                    dept.setChildren(new ArrayList<SysDeptInternalAgent>());
+                }
+                //递归调用
+                dept.getChildren().add(buildDeptTree(d, deptList));
+            }
+        }
+        return dept;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:54
+     *  @Description: 添加或修改
+     */
+    @Override
+    public void addOrUpdate(SysUserLinkDeptInternalAgentAddVo sysUserLinkDeptInternalAgentAddVo) {
+        String deptId = sysUserLinkDeptInternalAgentAddVo.getDeptId();
+        List<String> userIds = sysUserLinkDeptInternalAgentAddVo.getUserIds();
+        //删除数据重新添加
+        sysUserLinkDeptInternalAgentMapper.deleteByDeptId(deptId);
+        List<SysUserLinkDeptInternalAgent> addList= new ArrayList<>();
+        //重新添加
+        if(userIds!=null && userIds.size()>0){
+            for (String userId : userIds) {
+                SysUserLinkDeptInternalAgent add=new SysUserLinkDeptInternalAgent(userId,deptId,new Date(),
+                        new BaseController().getUser().getId(),new Date(),new BaseController().getUser().getId());
+                addList.add(add);
+            }
+        }
+        this.saveBatch(addList);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:54
+     *  @Description:  批量删除
+     */
+    @Override
+    public void deleteByIds(List<String> ids) {
+        sysUserLinkDeptInternalAgentMapper.deleteBatchIds(ids);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/26 18:55
+     *  @Description: 分页
+     */
+    @Override
+    public BasePageResult<SysUserLinkDeptInternalAgentDto> queryPage(SysDeptInternalAgentQueryVo sysDeptInternalAgentQueryVo) {
+        Page<SysUserLinkPtlAgreementDto> page = new Page<>(sysDeptInternalAgentQueryVo.getPageNum(),
+                sysDeptInternalAgentQueryVo.getPageSize());
+        Page<SysUserLinkDeptInternalAgentDto> pageResult = sysUserLinkDeptInternalAgentMapper.queryPage(page, sysDeptInternalAgentQueryVo);
+        return  new BasePageResult<>(sysDeptInternalAgentQueryVo.getPageNum(), page.getSize(), pageResult.getTotal(), page.getPages(),
+                pageResult.getRecords());
+    }
+}
+
+
+
+

+ 17 - 0
src/main/resources/mapper/modules/admin/SysDeptMapper.xml

@@ -80,4 +80,21 @@
             AND dept.parent_id = #{parentId}
         </if>
     </select>
+
+    <select id="queryListByQXDept" resultType="com.ydtech.modules.admin.model.SysDept">
+        SELECT
+            sd.id as id,
+            sd.name as name,
+            sd.parent_id as parentId,
+            sd.comlevel as comlevel,
+            false as flag
+        FROM
+            sys_dept sd
+        WHERE
+            ( sd.comlevel = 3 )
+           OR  ( sd.comlevel = 4 )
+           OR ( sd.comlevel > 4 AND id LIKE '%M%' )
+           OR ( sd.comlevel > 4 AND id LIKE '%D%' )
+        ORDER BY comlevel
+    </select>
 </mapper>