Ver código fonte

管理级次分类、组织类型分类

lizhenhao 2 anos atrás
pai
commit
b435ec2fcb
15 arquivos alterados com 892 adições e 6 exclusões
  1. 132 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/controller/CwManageLevelTypeController.java
  2. 131 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/controller/CwOrganizationTypeController.java
  3. 49 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/domain/CwManageLevelType.java
  4. 49 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/domain/CwOrganizationType.java
  5. 31 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/mapper/CwManageLevelTypeMapper.java
  6. 31 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/mapper/CwOrganizationTypeMapper.java
  7. 79 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/mapper/xml/CwManageLevelTypeMapper.xml
  8. 79 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/mapper/xml/CwOrganizationTypeMapper.xml
  9. 80 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/CwManageLevelTypeService.java
  10. 79 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/CwOrganizationTypeService.java
  11. 54 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/dto/CwManageLevelTypeDTO.java
  12. 53 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/dto/CwOrganizationTypeDTO.java
  13. 17 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/mapstruct/CwManageLevelTypeWrapper.java
  14. 17 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/mapstruct/CwOrganizationTypeWrapper.java
  15. 11 6
      jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/UserController.java

+ 132 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/controller/CwManageLevelTypeController.java

@@ -0,0 +1,132 @@
+package com.jeeplus.test.cw.workClientInfo.controller;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.aop.logging.annotation.ApiLog;
+import com.jeeplus.sys.constant.enums.LogTypeEnum;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.cw.workClientInfo.domain.CwManageLevelType;
+import com.jeeplus.test.cw.workClientInfo.domain.CwOrganizationType;
+import com.jeeplus.test.cw.workClientInfo.service.CwManageLevelTypeService;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwManageLevelTypeDTO;
+import io.swagger.annotations.Api;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Api("客户配置管理-管理级次分类")
+@RestController
+@RequestMapping(value = "/cw_work_client/manage_level_type")
+public class CwManageLevelTypeController {
+
+    @Resource
+    private CwManageLevelTypeService cwManageLevelTypeService;
+
+    /**
+     * 查询管理级次分类列表
+     * @param cwManageLevelTypeDTO
+     * @param page
+     * @return
+     * @throws Exception
+     */
+    @ApiLog("查询管理级次分类列表")
+    @PreAuthorize("hasAuthority('cw_work_client:manage_level_type:list')")
+    @GetMapping("list")
+    public ResponseEntity<IPage<CwManageLevelTypeDTO>> data(CwManageLevelTypeDTO cwManageLevelTypeDTO, Page<CwManageLevelTypeDTO> page) throws Exception {
+        page.setSize(-1);
+        IPage<CwManageLevelTypeDTO> result = new Page<CwManageLevelTypeDTO>();
+        if(ObjectUtil.isNotEmpty(cwManageLevelTypeDTO)){
+            if(StringUtils.isNotBlank(cwManageLevelTypeDTO.getName())){
+                //根据type模糊查询
+                List<CwManageLevelType> cwManageLevelTypeList = cwManageLevelTypeService.list(new QueryWrapper<CwManageLevelType>().lambda()
+                        .like(StringUtils.isNotBlank(cwManageLevelTypeDTO.getName()), CwManageLevelType::getName, cwManageLevelTypeDTO.getName())
+                );
+                List<String> idList = new ArrayList<>();
+                cwManageLevelTypeList.stream().forEach(item->{
+                    if (StringUtils.isNotBlank(item.getParentIds())){
+                        String[] split = item.getParentIds().split(",");
+                        for (String s : split) {
+                            idList.add(s);
+                        }
+                    }
+                    List<CwManageLevelType> list = cwManageLevelTypeService.list(new QueryWrapper<CwManageLevelType>().lambda().like(CwManageLevelType::getParentIds, "," + item.getId() + ","));
+                    idList.addAll(list.stream().map(CwManageLevelType::getId).collect(Collectors.toList()));
+                    idList.add(item.getId());
+                });
+                List<String> ids = idList.stream().distinct().filter(item->{
+                    if (!"0".equals(item)){
+                        return true;
+                    }
+                    return false;
+                }).collect(Collectors.toList());
+                if(CollectionUtil.isNotEmpty(ids)){
+                    QueryWrapper<CwManageLevelType> wrapper = new QueryWrapper<CwManageLevelType>()
+                            .in("cw_mlt.id",idList);
+                    result = cwManageLevelTypeService.findList (page,wrapper);
+                }
+            }else{
+                result = cwManageLevelTypeService.findList (page,new QueryWrapper<CwManageLevelType>());
+            }
+        }
+        return ResponseEntity.ok (result);
+    }
+
+    /**
+     * 查询管理级次分类数据
+     * @param id
+     * @return
+     */
+    @ApiLog("查询管理级次分类数据")
+    @PreAuthorize ("hasAnyAuthority('cw_work_client:manage_level_type:view','cw_work_client:manage_level_type:add','cw_work_client:manage_level_type:edit')")
+    @GetMapping("queryById")
+    public ResponseEntity queryById(@RequestParam("id") String id) {
+        CwManageLevelTypeDTO cwManageLevelTypeDTO = cwManageLevelTypeService.queryById ( id );
+        return ResponseEntity.ok (cwManageLevelTypeDTO);
+    }
+
+    /**
+     * 查询全部一级管理级次分类
+     * @return
+     */
+    @ApiLog("查询全部一级管理级次分类")
+    @GetMapping("getList")
+    public ResponseEntity<List<CwManageLevelTypeDTO>> getList() {
+        List<CwManageLevelTypeDTO> list = cwManageLevelTypeService.getList();
+        return ResponseEntity.ok (list);
+    }
+
+    /**
+     * 保存管理级次分类
+     * @param cwManageLevelTypeDTO
+     * @return
+     */
+    @ApiLog(value = "修改/新增管理级次分类", type = LogTypeEnum.SAVE)
+    @PreAuthorize("hasAnyAuthority('cw_work_client:manage_level_type:save','cw_work_client:manage_level_type:edit')")
+    @PostMapping("save")
+    public ResponseEntity save(@Valid @RequestBody CwManageLevelTypeDTO cwManageLevelTypeDTO) {
+        cwManageLevelTypeService.saveType(cwManageLevelTypeDTO);
+        return ResponseEntity.ok ("操作成功");
+    }
+
+    /**
+     * 删除管理级次分类
+     * @param ids
+     * @return
+     */
+    @ApiLog(value = "删除管理级次分类", type = LogTypeEnum.SAVE)
+    @PreAuthorize ("hasAuthority('cw_work_client:manage_level_type:del')")
+    @DeleteMapping("delete")
+    public ResponseEntity delete(String ids) {
+        return cwManageLevelTypeService.deleteByIds(ids);
+    }
+
+}

+ 131 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/controller/CwOrganizationTypeController.java

@@ -0,0 +1,131 @@
+package com.jeeplus.test.cw.workClientInfo.controller;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.aop.logging.annotation.ApiLog;
+import com.jeeplus.sys.constant.enums.LogTypeEnum;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.cw.workClientInfo.domain.CwOrganizationType;
+import com.jeeplus.test.cw.workClientInfo.service.CwOrganizationTypeService;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwOrganizationTypeDTO;
+import io.swagger.annotations.Api;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Api("客户配置管理-组织类型分类")
+@RestController
+@RequestMapping(value = "/cw_work_client/organization_type")
+public class CwOrganizationTypeController {
+
+    @Resource
+    private CwOrganizationTypeService cwOrganizationTypeService;
+
+    /**
+     * 查询组织类型分类列表
+     * @param cwOrganizationTypeDTO
+     * @param page
+     * @return
+     * @throws Exception
+     */
+    @ApiLog("查询组织类型分类列表")
+    @PreAuthorize("hasAuthority('cw_work_client:organization_type:list')")
+    @GetMapping("list")
+    public ResponseEntity<IPage<CwOrganizationTypeDTO>> data(CwOrganizationTypeDTO cwOrganizationTypeDTO, Page<CwOrganizationTypeDTO> page) throws Exception {
+        page.setSize(-1);
+        IPage<CwOrganizationTypeDTO> result = new Page<CwOrganizationTypeDTO>();
+        if(ObjectUtil.isNotEmpty(cwOrganizationTypeDTO)){
+            if(StringUtils.isNotBlank(cwOrganizationTypeDTO.getName())){
+                //根据type模糊查询
+                List<CwOrganizationType> cwOrganizationTypeList = cwOrganizationTypeService.list(new QueryWrapper<CwOrganizationType>().lambda()
+                        .like(StringUtils.isNotBlank(cwOrganizationTypeDTO.getName()), CwOrganizationType::getName, cwOrganizationTypeDTO.getName())
+                );
+                List<String> idList = new ArrayList<>();
+                cwOrganizationTypeList.stream().forEach(item->{
+                    if (StringUtils.isNotBlank(item.getParentIds())){
+                        String[] split = item.getParentIds().split(",");
+                        for (String s : split) {
+                            idList.add(s);
+                        }
+                    }
+                    List<CwOrganizationType> list = cwOrganizationTypeService.list(new QueryWrapper<CwOrganizationType>().lambda().like(CwOrganizationType::getParentIds, "," + item.getId() + ","));
+                    idList.addAll(list.stream().map(CwOrganizationType::getId).collect(Collectors.toList()));
+                    idList.add(item.getId());
+                });
+                List<String> ids = idList.stream().distinct().filter(item->{
+                    if (!"0".equals(item)){
+                        return true;
+                    }
+                    return false;
+                }).collect(Collectors.toList());
+                if(CollectionUtil.isNotEmpty(ids)){
+                    QueryWrapper<CwOrganizationType> wrapper = new QueryWrapper<CwOrganizationType>()
+                            .in("cw_ot.id",ids);
+                    result = cwOrganizationTypeService.findList (page,wrapper);
+                }
+            }else{
+                result = cwOrganizationTypeService.findList (page,new QueryWrapper<CwOrganizationType>());
+            }
+        }
+        return ResponseEntity.ok (result);
+    }
+
+    /**
+     * 查询组织类型分类数据
+     * @param id
+     * @return
+     */
+    @ApiLog("查询组织类型分类数据")
+    @PreAuthorize ("hasAnyAuthority('cw_work_client:organization_type:view','cw_work_client:organization_type:add','cw_work_client:organization_type:edit')")
+    @GetMapping("queryById")
+    public ResponseEntity queryById(@RequestParam("id") String id) {
+        CwOrganizationTypeDTO cwOrganizationTypeDTO = cwOrganizationTypeService.queryById ( id );
+        return ResponseEntity.ok (cwOrganizationTypeDTO);
+    }
+
+    /**
+     * 查询全部一级组织类型分类
+     * @return
+     */
+    @ApiLog("查询全部一级组织类型分类")
+    @GetMapping("getList")
+    public ResponseEntity<List<CwOrganizationTypeDTO>> getList() {
+        List<CwOrganizationTypeDTO> list = cwOrganizationTypeService.getList();
+        return ResponseEntity.ok (list);
+    }
+
+    /**
+     * 保存组织类型分类
+     * @param cwOrganizationTypeDTO
+     * @return
+     */
+    @ApiLog(value = "修改/新增组织类型分类", type = LogTypeEnum.SAVE)
+    @PreAuthorize("hasAnyAuthority('cw_work_client:organization_type:save','cw_work_client:organization_type:edit')")
+    @PostMapping("save")
+    public ResponseEntity save(@Valid @RequestBody CwOrganizationTypeDTO cwOrganizationTypeDTO) {
+        cwOrganizationTypeService.saveType(cwOrganizationTypeDTO);
+        return ResponseEntity.ok ("操作成功");
+    }
+
+    /**
+     * 删除组织类型分类
+     * @param ids
+     * @return
+     */
+    @ApiLog(value = "删除组织类型分类", type = LogTypeEnum.SAVE)
+    @PreAuthorize ("hasAuthority('cw_work_client:organization_type:del')")
+    @DeleteMapping("delete")
+    public ResponseEntity delete(String ids) {
+        return cwOrganizationTypeService.deleteByIds(ids);
+    }
+
+}

+ 49 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/domain/CwManageLevelType.java

@@ -0,0 +1,49 @@
+package com.jeeplus.test.cw.workClientInfo.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 财务-客户信息管理-管理级次分类
+ * @TableName cw_manage_level_type
+ */
+@Data
+@TableName("cw_manage_level_type")
+public class CwManageLevelType extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 分类名称
+     */
+    private String name;
+
+    /**
+     * 父id
+     */
+    private String parentId;
+
+    /**
+     * 等级
+     */
+    private Integer level;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 父ids
+     */
+    private String parentIds;
+
+    private static final long serialVersionUID = 1L;
+}

+ 49 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/domain/CwOrganizationType.java

@@ -0,0 +1,49 @@
+package com.jeeplus.test.cw.workClientInfo.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 财务-客户信息管理-组织类型分类
+ * @TableName cw_organization_type
+ */
+@Data
+@TableName("cw_organization_type")
+public class CwOrganizationType extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 分类名称
+     */
+    private String name;
+
+    /**
+     * 父id
+     */
+    private String parentId;
+
+    /**
+     * 等级
+     */
+    private Integer level;
+
+    /**
+     * 排序
+     */
+    private String sort;
+
+    /**
+     * 父ids
+     */
+    private String parentIds;
+
+    private static final long serialVersionUID = 1L;
+}

+ 31 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/mapper/CwManageLevelTypeMapper.java

@@ -0,0 +1,31 @@
+package com.jeeplus.test.cw.workClientInfo.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.test.cw.workClientInfo.domain.CwManageLevelType;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwManageLevelTypeDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Entity com.jeeplus.test.cw.workClientInfo.domain.CwManageLevelType
+ */
+@Mapper
+public interface CwManageLevelTypeMapper extends BaseMapper<CwManageLevelType> {
+
+    public IPage<CwManageLevelTypeDTO> findList(Page<CwManageLevelTypeDTO> page, @Param(Constants.WRAPPER) QueryWrapper<CwManageLevelType> queryWrapper);
+
+    public CwManageLevelTypeDTO queryById(@Param("id") String id);
+
+    public List<CwManageLevelTypeDTO> getList();
+
+}
+
+
+
+

+ 31 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/mapper/CwOrganizationTypeMapper.java

@@ -0,0 +1,31 @@
+package com.jeeplus.test.cw.workClientInfo.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.test.cw.workClientInfo.domain.CwOrganizationType;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwOrganizationTypeDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Entity com.jeeplus.test.cw.workClientInfo.domain.CwOrganizationType
+ */
+@Mapper
+public interface CwOrganizationTypeMapper extends BaseMapper<CwOrganizationType> {
+
+    public IPage<CwOrganizationTypeDTO> findList(Page<CwOrganizationTypeDTO> page, @Param(Constants.WRAPPER) QueryWrapper<CwOrganizationType> queryWrapper);
+
+    public CwOrganizationTypeDTO queryById(@Param("id") String id);
+
+    public List<CwOrganizationTypeDTO> getList();
+
+}
+
+
+
+

+ 79 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/mapper/xml/CwManageLevelTypeMapper.xml

@@ -0,0 +1,79 @@
+<?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.jeeplus.test.cw.workClientInfo.mapper.CwManageLevelTypeMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.test.cw.workClientInfo.service.dto.CwManageLevelTypeDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+            <result property="level" column="level" jdbcType="INTEGER"/>
+            <result property="sort" column="sort" jdbcType="INTEGER"/>
+            <result property="parentIds" column="parent_ids" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        cw_mlt.id,
+        cw_mlt.create_by,
+        cw_mlt.create_date,
+        cw_mlt.update_by,
+        cw_mlt.update_date,
+        cw_mlt.del_flag,
+        cw_mlt.remarks,
+        cw_mlt.name,
+        cw_mlt.parent_id,
+        cw_mlt.level,
+        cw_mlt.sort
+    </sql>
+
+    <select id="findList" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"></include>
+        from cw_manage_level_type cw_mlt
+        ${ew.customSqlSegment}
+    </select>
+
+    <select id="queryById" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"></include>
+        from cw_manage_level_type cw_mlt
+        where cw_mlt.del_flag = '0' and cw_mlt.id = #{id}
+    </select>
+
+    <select id="getList" resultMap="map">
+        select
+        <include refid="Base_Column_List"></include>
+        from cw_manage_level_type cw_mlt
+        where cw_mlt.del_flag = '0' and cw_mlt.parent_id = '0'
+    </select>
+
+    <resultMap id="map" type="com.jeeplus.test.cw.workClientInfo.service.dto.CwManageLevelTypeDTO">
+        <id property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+        <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+        <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
+        <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+        <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+        <result property="level" column="level" jdbcType="INTEGER"/>
+        <result property="sort" column="sort" jdbcType="INTEGER"/>
+        <result property="parentIds" column="parent_ids" jdbcType="VARCHAR"/>
+        <collection property="childrenList" column="id" select="getChildList" ofType="com.jeeplus.test.cw.workClientInfo.service.dto.CwManageLevelTypeDTO"/>
+    </resultMap>
+
+    <select id="getChildList" resultType="com.jeeplus.test.cw.workClientInfo.service.dto.CwManageLevelTypeDTO">
+        select
+        <include refid="Base_Column_List"></include>
+        from cw_manage_level_type cw_mlt
+        where cw_mlt.del_flag = '0' and cw_mlt.parent_id = ${id}
+    </select>
+</mapper>

+ 79 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/mapper/xml/CwOrganizationTypeMapper.xml

@@ -0,0 +1,79 @@
+<?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.jeeplus.test.cw.workClientInfo.mapper.CwOrganizationTypeMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.test.cw.workClientInfo.service.dto.CwOrganizationTypeDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+            <result property="level" column="level" jdbcType="INTEGER"/>
+            <result property="sort" column="sort" jdbcType="VARCHAR"/>
+            <result property="parentIds" column="parent_ids" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        cw_ot.id,
+        cw_ot.create_by,
+        cw_ot.create_date,
+        cw_ot.update_by,
+        cw_ot.update_date,
+        cw_ot.del_flag,
+        cw_ot.remarks,
+        cw_ot.name,
+        cw_ot.parent_id,
+        cw_ot.level,
+        cw_ot.sort
+    </sql>
+
+    <select id="findList" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"></include>
+        from cw_organization_type cw_ot
+        ${ew.customSqlSegment}
+    </select>
+
+    <select id="queryById" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"></include>
+        from cw_organization_type cw_ot
+        where cw_ot.del_flag = '0' and cw_ot.id = #{id}
+    </select>
+
+    <select id="getList" resultMap="map">
+        select
+        <include refid="Base_Column_List"></include>
+        from cw_organization_type cw_ot
+        where cw_ot.del_flag = '0' and cw_ot.parent_id = '0'
+    </select>
+
+    <resultMap id="map" type="com.jeeplus.test.cw.workClientInfo.service.dto.CwOrganizationTypeDTO">
+        <id property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+        <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+        <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
+        <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+        <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
+        <result property="level" column="level" jdbcType="INTEGER"/>
+        <result property="sort" column="sort" jdbcType="VARCHAR"/>
+        <result property="parentIds" column="parent_ids" jdbcType="VARCHAR"/>
+        <collection property="childrenList" column="id" select="getChildList" ofType="com.jeeplus.test.cw.workClientInfo.service.dto.CwOrganizationTypeDTO"/>
+    </resultMap>
+
+    <select id="getChildList" resultType="com.jeeplus.test.cw.workClientInfo.service.dto.CwOrganizationTypeDTO">
+        select
+        <include refid="Base_Column_List"></include>
+        from cw_organization_type cw_ot
+        where cw_ot.del_flag = '0' and cw_ot.parent_id = ${id}
+    </select>
+</mapper>

+ 80 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/CwManageLevelTypeService.java

@@ -0,0 +1,80 @@
+package com.jeeplus.test.cw.workClientInfo.service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.cw.workClientInfo.domain.CwManageLevelType;
+import com.jeeplus.test.cw.workClientInfo.domain.CwOrganizationType;
+import com.jeeplus.test.cw.workClientInfo.mapper.CwManageLevelTypeMapper;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwManageLevelTypeDTO;
+import com.jeeplus.test.cw.workClientInfo.service.mapstruct.CwManageLevelTypeWrapper;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Transactional
+public class CwManageLevelTypeService extends ServiceImpl<CwManageLevelTypeMapper, CwManageLevelType> {
+
+    @Resource
+    private CwManageLevelTypeMapper cwManageLevelTypeMapper;
+
+    public IPage<CwManageLevelTypeDTO> findList(Page<CwManageLevelTypeDTO> page, QueryWrapper<CwManageLevelType> queryWrapper){
+        queryWrapper.eq("cw_mlt.del_flag","0").orderByAsc("cw_mlt.sort");
+        return cwManageLevelTypeMapper.findList(page,queryWrapper);
+    }
+
+    public CwManageLevelTypeDTO queryById(String id) {
+
+        CwManageLevelTypeDTO cwManageLevelTypeDTO = cwManageLevelTypeMapper.queryById(id);
+
+        return cwManageLevelTypeDTO;
+    }
+
+    public List<CwManageLevelTypeDTO> getList() {
+        List<CwManageLevelTypeDTO> list = cwManageLevelTypeMapper.getList();
+        return list;
+    }
+
+    public ResponseEntity saveType(CwManageLevelTypeDTO cwManageLevelTypeDTO) {
+        CwManageLevelType cwManageLevelType = CwManageLevelTypeWrapper.INSTANCE.toEntity(cwManageLevelTypeDTO);
+        if (ObjectUtil.isNotEmpty(cwManageLevelTypeDTO)) {
+            if (StringUtils.isBlank(cwManageLevelTypeDTO.getId())) {
+                if (StringUtils.isNotBlank(cwManageLevelTypeDTO.getParentId())){
+                    if ("0".equals(cwManageLevelTypeDTO.getParentId())){
+                        cwManageLevelType.setLevel(1);
+                        cwManageLevelType.setParentIds("0,");
+                    }else{
+                        CwManageLevelType mlt = this.getById(cwManageLevelTypeDTO.getParentId());
+                        if(ObjectUtil.isNotEmpty(mlt)){
+                            cwManageLevelType.setLevel(mlt.getLevel()+1);
+                            cwManageLevelType.setParentIds(mlt.getParentIds()+mlt.getId()+",");
+                        }
+                    }
+                }
+            }
+        }
+        this.saveOrUpdate(cwManageLevelType);
+        return ResponseEntity.ok("保存成功");
+    }
+
+    public ResponseEntity deleteByIds(String ids) {
+        String idArray[] =ids.split(",");
+        if(CollectionUtil.isNotEmpty(Lists.newArrayList (idArray))){
+            List<String> list = this.list(new QueryWrapper<CwManageLevelType>().lambda().in(CwManageLevelType::getParentId, Lists.newArrayList(idArray))).stream().distinct().map(CwManageLevelType::getId).collect(Collectors.toList());
+            this.removeByIds (list);
+        }
+        this.removeByIds (Lists.newArrayList (idArray));
+        return ResponseEntity.ok ("删除成功");
+    }
+
+}

+ 79 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/CwOrganizationTypeService.java

@@ -0,0 +1,79 @@
+package com.jeeplus.test.cw.workClientInfo.service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.cw.workClientInfo.domain.CwOrganizationType;
+import com.jeeplus.test.cw.workClientInfo.mapper.CwOrganizationTypeMapper;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwOrganizationTypeDTO;
+import com.jeeplus.test.cw.workClientInfo.service.mapstruct.CwOrganizationTypeWrapper;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Transactional
+public class CwOrganizationTypeService extends ServiceImpl<CwOrganizationTypeMapper, CwOrganizationType> {
+
+    @Resource
+    private CwOrganizationTypeMapper cwOrganizationTypeMapper;
+
+    public IPage<CwOrganizationTypeDTO> findList(Page<CwOrganizationTypeDTO> page, QueryWrapper<CwOrganizationType> queryWrapper){
+        queryWrapper.eq("cw_ot.del_flag","0").orderByAsc("cw_ot.sort");
+        return cwOrganizationTypeMapper.findList(page,queryWrapper);
+    }
+
+    public CwOrganizationTypeDTO queryById(String id) {
+
+        CwOrganizationTypeDTO cwOrganizationTypeDTO = cwOrganizationTypeMapper.queryById(id);
+
+        return cwOrganizationTypeDTO;
+    }
+
+    public List<CwOrganizationTypeDTO> getList() {
+        List<CwOrganizationTypeDTO> list = cwOrganizationTypeMapper.getList();
+        return list;
+    }
+
+    public ResponseEntity saveType(CwOrganizationTypeDTO cwOrganizationTypeDTO) {
+        CwOrganizationType cwOrganizationType = CwOrganizationTypeWrapper.INSTANCE.toEntity(cwOrganizationTypeDTO);
+        if (ObjectUtil.isNotEmpty(cwOrganizationTypeDTO)) {
+            if (StringUtils.isBlank(cwOrganizationTypeDTO.getId())) {
+                if (StringUtils.isNotBlank(cwOrganizationTypeDTO.getParentId())){
+                    if ("0".equals(cwOrganizationTypeDTO.getParentId())){
+                        cwOrganizationType.setLevel(1);
+                        cwOrganizationType.setParentIds("0,");
+                    }else{
+                        CwOrganizationType ot = this.getById(cwOrganizationTypeDTO.getParentId());
+                        if(ObjectUtil.isNotEmpty(ot)){
+                            cwOrganizationType.setLevel(ot.getLevel()+1);
+                            cwOrganizationType.setParentIds(ot.getParentIds()+ot.getId()+",");
+                        }
+                    }
+                }
+            }
+        }
+        this.saveOrUpdate(cwOrganizationType);
+        return ResponseEntity.ok("保存成功");
+    }
+
+    public ResponseEntity deleteByIds(String ids) {
+        String idArray[] =ids.split(",");
+        if(CollectionUtil.isNotEmpty(Lists.newArrayList (idArray))){
+            List<String> list = this.list(new QueryWrapper<CwOrganizationType>().lambda().in(CwOrganizationType::getParentId, Lists.newArrayList(idArray))).stream().distinct().map(CwOrganizationType::getId).collect(Collectors.toList());
+            this.removeByIds (list);
+        }
+        this.removeByIds (Lists.newArrayList (idArray));
+        return ResponseEntity.ok ("删除成功");
+    }
+
+}

+ 54 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/dto/CwManageLevelTypeDTO.java

@@ -0,0 +1,54 @@
+package com.jeeplus.test.cw.workClientInfo.service.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.service.dto.BaseDTO;
+import com.jeeplus.test.cw.workClientInfo.domain.CwManageLevelType;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 财务-客户信息管理-管理级次分类
+ * @TableName cw_manage_level_type
+ */
+@Data
+public class CwManageLevelTypeDTO extends BaseDTO {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 分类名称
+     */
+    private String name;
+
+    /**
+     * 父id
+     */
+    private String parentId;
+
+    /**
+     * 等级
+     */
+    private String level;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 父ids
+     */
+    private String parentIds;
+
+    /**
+     * 子集合
+     */
+    private List<CwManageLevelType> childrenList;
+
+    private static final long serialVersionUID = 1L;
+}

+ 53 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/dto/CwOrganizationTypeDTO.java

@@ -0,0 +1,53 @@
+package com.jeeplus.test.cw.workClientInfo.service.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.service.dto.BaseDTO;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 财务-客户信息管理-组织类型分类
+ * @TableName cw_organization_type
+ */
+@Data
+public class CwOrganizationTypeDTO extends BaseDTO {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 分类名称
+     */
+    private String name;
+
+    /**
+     * 父id
+     */
+    private String parentId;
+
+    /**
+     * 等级
+     */
+    private String level;
+
+    /**
+     * 排序
+     */
+    private String sort;
+
+    /**
+     * 父ids
+     */
+    private String parentIds;
+
+    /**
+     * 子集合
+     */
+    private List<CwOrganizationTypeDTO> childrenList;
+
+    private static final long serialVersionUID = 1L;
+}

+ 17 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/mapstruct/CwManageLevelTypeWrapper.java

@@ -0,0 +1,17 @@
+package com.jeeplus.test.cw.workClientInfo.service.mapstruct;
+
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import com.jeeplus.test.changes.dimission.domain.ChangesDimission;
+import com.jeeplus.test.changes.dimission.service.dto.ChangesDimissionDTO;
+import com.jeeplus.test.cw.workClientInfo.domain.CwManageLevelType;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwManageLevelTypeDTO;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface CwManageLevelTypeWrapper extends EntityWrapper<CwManageLevelTypeDTO, CwManageLevelType>{
+
+        CwManageLevelTypeWrapper INSTANCE = Mappers.getMapper(CwManageLevelTypeWrapper.class);
+
+}

+ 17 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/workClientInfo/service/mapstruct/CwOrganizationTypeWrapper.java

@@ -0,0 +1,17 @@
+package com.jeeplus.test.cw.workClientInfo.service.mapstruct;
+
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import com.jeeplus.test.cw.workClientInfo.domain.CwManageLevelType;
+import com.jeeplus.test.cw.workClientInfo.domain.CwOrganizationType;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwManageLevelTypeDTO;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwOrganizationTypeDTO;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface CwOrganizationTypeWrapper extends EntityWrapper<CwOrganizationTypeDTO, CwOrganizationType>{
+
+        CwOrganizationTypeWrapper INSTANCE = Mappers.getMapper(CwOrganizationTypeWrapper.class);
+
+}

+ 11 - 6
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -195,7 +195,7 @@ public class UserController {
         if ( StrUtil.isNotBlank ( userDTO.getNewPassword ( ) ) ) {
             userDTO.setPassword ( SecurityUtils.encryptPassword ( userDTO.getNewPassword ( ) ) );
         }
-        if ( !isCheckLoginName ( userDTO.getOldLoginName ( ), userDTO.getLoginName ( ) ) ) {
+        if ( isCheckLoginName ( userDTO.getOldLoginName ( ), userDTO.getLoginName ( ) ) ) {
             return ResponseEntity.badRequest ( ).body ( "保存用户'" + userDTO.getLoginName ( ) + "'失败,登录名已存在!" );
         }
         // 保存用户信息
@@ -404,11 +404,16 @@ public class UserController {
 
 
     private boolean isCheckLoginName(String oldLoginName, String loginName) {
-        UserDTO userByLoginName = userService.getUserByLoginName(loginName);
-        if ( loginName != null && loginName.equals ( oldLoginName ) ) {
-            return true;
-        } else if ( loginName != null && userByLoginName == null ) {
-            return true;
+        if (StringUtils.isNotBlank(loginName)) {
+            List<User> userList = userService.list(new QueryWrapper<User>().lambda().eq(User::getLoginName,loginName));
+            if (CollectionUtil.isNotEmpty(userList)) {
+                return true;
+            }
+            if (StringUtils.isNotBlank(oldLoginName)){
+                if ( loginName.equals ( oldLoginName ) ) {
+                    return true;
+                }
+            }
         }
         return false;
     }