heheng
13 hours ago d45f521ab36d3c4759fc3ac3a6e0d6548c233567
功能修改
6 files modified
100 ■■■■■ changed files
expert-admin/src/main/java/com/gkhy/web/controller/system/SysDeptController.java 11 ●●●● patch | view | raw | blame | history
expert-system/src/main/java/com/gkhy/system/domain/SysExpertClassify.java 8 ●●●●● patch | view | raw | blame | history
expert-system/src/main/java/com/gkhy/system/mapper/SysExpertClassifyMapper.java 5 ●●●●● patch | view | raw | blame | history
expert-system/src/main/java/com/gkhy/system/service/SysExpertClassifyService.java 7 ●●●●● patch | view | raw | blame | history
expert-system/src/main/java/com/gkhy/system/service/impl/SysExpertClassifyServiceImpl.java 45 ●●●● patch | view | raw | blame | history
expert-system/src/main/resources/mapper/system/SysExpertClassifyMapper.xml 24 ●●●●● patch | view | raw | blame | history
expert-admin/src/main/java/com/gkhy/web/controller/system/SysDeptController.java
@@ -10,6 +10,7 @@
import com.gkhy.common.enums.BusinessType;
import com.gkhy.common.utils.StringUtils;
import com.gkhy.system.service.ISysDeptService;
import com.gkhy.system.service.SysExpertClassifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -34,6 +35,9 @@
{
    @Autowired
    private ISysDeptService deptService;
    @Autowired
    private SysExpertClassifyService expertClassifyService;
    /**
     * 获取部门列表
@@ -144,11 +148,14 @@
    {
        if (deptService.hasChildByDeptId(deptId))
        {
            return warn("存在下级部门,不允许删除");
            return warn("存在下级处室,不允许删除");
        }
        if (deptService.checkDeptExistUser(deptId))
        {
            return warn("部门存在用户,不允许删除");
            return warn("处室存在用户,不允许删除");
        }
        if (expertClassifyService.countByDeptId(deptId) > 0){
            return warn("处室存在专业领域,不允许删除,请先专业领域删除对应处室绑定");
        }
        //todo  校验专家是否申请复用
        deptService.checkDeptDataScope(deptId);
expert-system/src/main/java/com/gkhy/system/domain/SysExpertClassify.java
@@ -52,6 +52,14 @@
    @TableField("version")
    private Integer version;
    @ApiModelProperty("部门id")
    @TableField("dept_id")
    private Long deptId;
    @ApiModelProperty("部门名称")
    @TableField(exist = false)
    private String deptName;
    @ApiModelProperty("子分类")
    @TableField(exist = false)
    private List<SysExpertClassify> children;
expert-system/src/main/java/com/gkhy/system/mapper/SysExpertClassifyMapper.java
@@ -4,6 +4,8 @@
import com.gkhy.system.domain.SysExpertClassify;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
 * <p>
 * 系统专家分类表 Mapper 接口
@@ -15,4 +17,7 @@
@Mapper
public interface SysExpertClassifyMapper extends BaseMapper<SysExpertClassify> {
    List<SysExpertClassify> classifyList(SysExpertClassify expertClassify);
}
expert-system/src/main/java/com/gkhy/system/service/SysExpertClassifyService.java
@@ -41,4 +41,11 @@
     * @return
     */
    int addClassify(SysExpertClassify expertClassify);
    /**
     * 根据部门id查询
     * @param deptId
     * @return
     */
    long countByDeptId(Long deptId);
}
expert-system/src/main/java/com/gkhy/system/service/impl/SysExpertClassifyServiceImpl.java
@@ -1,15 +1,15 @@
package com.gkhy.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.common.enums.DeleteFlagEnum;
import com.gkhy.common.exception.ServiceException;
import com.gkhy.common.utils.SecurityUtils;
import com.gkhy.common.utils.StringUtils;
import com.gkhy.system.domain.SysExpertClassify;
import com.gkhy.system.mapper.SysExpertClassifyMapper;
import com.gkhy.system.service.SysExpertClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -27,14 +27,17 @@
@Service
public class SysExpertClassifyServiceImpl extends ServiceImpl<SysExpertClassifyMapper, SysExpertClassify> implements SysExpertClassifyService {
    @Autowired
    private SysExpertClassifyMapper sysExpertClassifyMapper;
    @Override
    public List<SysExpertClassify> classifyTree(SysExpertClassify expertClassify) {
        LambdaQueryWrapper<SysExpertClassify> lambdaQueryWrapper = Wrappers.<SysExpertClassify>lambdaQuery();
        if(StringUtils.isNotBlank(expertClassify.getClassifyName())){
            lambdaQueryWrapper.like(SysExpertClassify::getClassifyName,expertClassify.getClassifyName());
        }
        lambdaQueryWrapper.eq(SysExpertClassify::getDelFlag, DeleteFlagEnum.UN_DELETE.getCode());
        List<SysExpertClassify> classifies= list(lambdaQueryWrapper);
//        LambdaQueryWrapper<SysExpertClassify> lambdaQueryWrapper = Wrappers.<SysExpertClassify>lambdaQuery();
//        if(StringUtils.isNotBlank(expertClassify.getClassifyName())){
//            lambdaQueryWrapper.like(SysExpertClassify::getClassifyName,expertClassify.getClassifyName());
//        }
//        lambdaQueryWrapper.eq(SysExpertClassify::getDelFlag, DeleteFlagEnum.UN_DELETE.getCode());
//        List<SysExpertClassify> classifies= list(lambdaQueryWrapper);
        List<SysExpertClassify> classifies = sysExpertClassifyMapper.classifyList(expertClassify);
        //筛选出所有一级标签
        return classifies.stream()
                .filter(classifyEntity -> classifyEntity.getParentId()==0L)
@@ -53,6 +56,7 @@
    @Override
    public int modClassify(SysExpertClassify expertClassify) {
        //checkParams(expertClassify);
        expertClassify.setUpdateBy(SecurityUtils.getUsername());
        boolean b=updateById(expertClassify);
        if(!b){
@@ -76,6 +80,7 @@
    @Override
    public int addClassify(SysExpertClassify expertClassify) {
        //checkParams(expertClassify);
        expertClassify.setCreateBy(SecurityUtils.getUsername());
        boolean b=save(expertClassify);
        if(!b){
@@ -83,4 +88,28 @@
        }
        return 1;
    }
    @Override
    public long countByDeptId(Long deptId) {
        LambdaQueryWrapper<SysExpertClassify> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysExpertClassify::getDeptId,deptId).eq(SysExpertClassify::getDelFlag, DeleteFlagEnum.UN_DELETE.getCode());
        return baseMapper.selectCount(queryWrapper);
    }
    private void checkParams(SysExpertClassify expertClassify){
        if(expertClassify==null){
            throw new ServiceException("参数错误");
        }
        if(expertClassify.getDeptId() != null){
           LambdaQueryWrapper<SysExpertClassify> queryWrapper = new LambdaQueryWrapper<>();
           queryWrapper.eq(SysExpertClassify::getDeptId,expertClassify.getDeptId()).eq(SysExpertClassify::getDelFlag, DeleteFlagEnum.UN_DELETE.getCode());
           if (expertClassify.getId() != null){
               queryWrapper.ne(SysExpertClassify::getId,expertClassify.getId());
           }
            List<SysExpertClassify> sysExpertClassifies = baseMapper.selectList(queryWrapper);
            if(ObjectUtil.isNotEmpty(sysExpertClassifies)){
               throw new ServiceException("该处室已被"+sysExpertClassifies.get(0).getClassifyName()+"专业领域选中,请修改或者重新选择!");
           }
        }
    }
}
expert-system/src/main/resources/mapper/system/SysExpertClassifyMapper.xml
@@ -2,4 +2,28 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gkhy.system.mapper.SysExpertClassifyMapper">
    <resultMap id="BaseResultMap" type="com.gkhy.system.domain.SysExpertClassify">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="classify_name" jdbcType="VARCHAR" property="classifyName" />
        <result column="parent_id" jdbcType="BIGINT" property="parentId" />
        <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
        <result column="version" jdbcType="INTEGER" property="version" />
        <result column="dept_id" jdbcType="BIGINT" property="deptId" />
        <result column="create_by" jdbcType="VARCHAR" property="createBy" />
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
        <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
        <result column="remark" jdbcType="VARCHAR" property="remark" />
        <result column="dept_name" jdbcType="VARCHAR" property="deptName" />
    </resultMap>
    <select id="classifyList" parameterType="com.gkhy.system.domain.SysExpertClassify"  resultMap="BaseResultMap">
        select a.*,b.dept_name from sys_expert_classify a
            left join sys_dept b on a.dept_id = b.dept_id
        where a.del_flag = 0
        <if test="classifyName != null and classifyName != ''">
            and a.classify_name like concat('%',#{classifyName},'%')
        </if>
    </select>
</mapper>