parent
017386100f
commit
7977664146
|
@ -1,16 +1,20 @@
|
|||
package com.ydool.boot.api.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.api.R;
|
||||
import com.ydool.boot.api.util.Kv;
|
||||
import com.ydool.boot.common.cache.ConfigUtils;
|
||||
import com.ydool.boot.common.cache.DictUtils;
|
||||
import com.ydool.boot.common.cache.StreetUtils;
|
||||
import com.ydool.boot.common.result.Ret;
|
||||
import com.ydool.boot.core.mybatis.Condition;
|
||||
import com.ydool.boot.modules.rddb.entity.*;
|
||||
import com.ydool.boot.modules.rddb.service.*;
|
||||
import com.ydool.boot.modules.rddb.wrapper.OfficeWrapper;
|
||||
import com.ydool.boot.modules.sys.entity.Config;
|
||||
import com.ydool.boot.modules.sys.entity.Dept;
|
||||
import com.ydool.boot.modules.sys.entity.DictData;
|
||||
import com.ydool.boot.modules.sys.entity.Street;
|
||||
import com.ydool.boot.modules.sys.service.StreetService;
|
||||
|
@ -20,10 +24,7 @@ import io.swagger.annotations.ApiImplicitParams;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
@ -59,6 +60,17 @@ public class ApiBaseDataController extends ApiBaseController {
|
|||
@Autowired
|
||||
private OfficeService officeService;
|
||||
|
||||
@Autowired
|
||||
private RdDeptService rdDeptService;
|
||||
|
||||
|
||||
@PostMapping("deptTree")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "获取部门列表")
|
||||
public void deptTree() {
|
||||
List<RdDept> rdDeptTree = rdDeptService.getRdDeptTree();
|
||||
render(Ret.ok().data(rdDeptTree));
|
||||
}
|
||||
|
||||
@GetMapping("street")
|
||||
@ResponseBody
|
||||
|
|
|
@ -53,6 +53,9 @@ public class ContactDbMessage extends BaseEntity{
|
|||
@ApiModelProperty(value = "联系电话")
|
||||
private String telephone;
|
||||
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
|
|
|
@ -39,6 +39,9 @@ public class CwhContactVoterMessage extends BaseEntity{
|
|||
@ApiModelProperty(value = "联系电话")
|
||||
private String telephone;
|
||||
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(value = "部门")
|
||||
private String dept;
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ public class DbContactVoterMessage extends BaseEntity{
|
|||
@ApiModelProperty(value = "联系电话")
|
||||
private String telephone;
|
||||
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(value = "部门")
|
||||
private String dept;
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.ydool.boot.modules.rddb.entity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ydool.boot.core.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-11-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("t_rd_dept")
|
||||
@ApiModel(value="RdDept对象", description="部门表")
|
||||
public class RdDept{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "父部门id")
|
||||
private String pid;
|
||||
|
||||
@TableField(exist = false)
|
||||
List<RdDept> children;
|
||||
|
||||
|
||||
}
|
|
@ -29,6 +29,9 @@ public class ContactDbMessageRequest {
|
|||
@ApiModelProperty(value = "联系电话")
|
||||
private String telephone;
|
||||
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
|
|
|
@ -23,6 +23,9 @@ public class MessageRequest {
|
|||
@ApiModelProperty(value = "联系电话")
|
||||
private String telephone;
|
||||
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
|
|
|
@ -23,6 +23,9 @@ public class MessageRequest {
|
|||
@ApiModelProperty(value = "联系电话")
|
||||
private String telephone;
|
||||
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,7 @@ public class MyGenerator {
|
|||
public static void main(String[] args) {
|
||||
|
||||
//表名
|
||||
String tableName = "t_db_contact_voter_user";
|
||||
String tableName = "t_rd_dept";
|
||||
|
||||
//表前缀
|
||||
String tablePrefix = "t_";
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.ydool.boot.modules.rddb.mapper;
|
||||
|
||||
import com.ydool.boot.modules.rddb.entity.RdDept;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-11-24
|
||||
*/
|
||||
public interface RdDeptMapper extends BaseMapper<RdDept> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?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.ydool.boot.modules.rddb.mapper.RdDeptMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,50 @@
|
|||
package com.ydool.boot.modules.rddb.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ydool.boot.modules.rddb.entity.RdDept;
|
||||
import com.ydool.boot.modules.rddb.mapper.RdDeptMapper;
|
||||
import com.ydool.boot.modules.rddb.service.inter.IRdDeptService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-11-24
|
||||
*/
|
||||
@Service
|
||||
public class RdDeptService extends ServiceImpl<RdDeptMapper, RdDept> implements IRdDeptService {
|
||||
|
||||
public List<RdDept> getRdDeptTree() {
|
||||
//查询下一级标签
|
||||
List<RdDept> rdDeptList = list(new LambdaQueryWrapper<RdDept>().eq(RdDept::getPid, "0"));
|
||||
if (CollectionUtil.isNotEmpty(rdDeptList)) {
|
||||
//递归
|
||||
rdDeptList.stream().forEach(rdDept -> {
|
||||
getRdDeptByPid(rdDept);
|
||||
});
|
||||
}
|
||||
return rdDeptList;
|
||||
}
|
||||
|
||||
public void getRdDeptByPid(RdDept rdDept) {
|
||||
List<RdDept> rdDeptList = list(new LambdaQueryWrapper<RdDept>().eq(RdDept::getPid, rdDept.getId()));
|
||||
if (CollectionUtil.isNotEmpty(rdDeptList)) {
|
||||
rdDept.setChildren(rdDeptList);
|
||||
rdDeptList.forEach(dept -> {
|
||||
getRdDeptByPid(dept);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.ydool.boot.modules.rddb.service.inter;
|
||||
|
||||
import com.ydool.boot.modules.rddb.entity.RdDept;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-11-24
|
||||
*/
|
||||
public interface IRdDeptService extends IService<RdDept> {
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.ydool.boot.modules.rddb.web;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.ydool.boot.core.web.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-11-24
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/rddb/rdDept")
|
||||
public class RdDeptController extends BaseController {
|
||||
|
||||
}
|
Loading…
Reference in New Issue