iam数据同步修改
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.jero.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
@@ -70,6 +68,7 @@ public class SysDepart implements Serializable {
|
||||
private String status;
|
||||
/**删除状态(0,正常,1已删除)*/
|
||||
@Dict(dicCode = "del_flag")
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
/**创建人*/
|
||||
private String createBy;
|
||||
|
||||
+26
-2
@@ -1,6 +1,9 @@
|
||||
package com.jero.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import com.jero.modules.system.entity.SysDepart;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
@@ -11,12 +14,12 @@ import java.util.List;
|
||||
* <p>
|
||||
* 部门 Mapper 接口
|
||||
* <p>
|
||||
*
|
||||
*
|
||||
* @Author: Steve
|
||||
* @Since: 2019-01-22
|
||||
*/
|
||||
public interface SysDepartMapper extends BaseMapper<SysDepart> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID查询部门集合
|
||||
*/
|
||||
@@ -71,4 +74,25 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
|
||||
*/
|
||||
@Select("SELECT * FROM sys_depart where del_flag ='0' AND parent_id = #{parentId,jdbcType=VARCHAR}")
|
||||
List<SysDepart> queryDeptByPid(@Param("parentId")String parentId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询部门数据
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<SysDepart> queryDeptList(@org.apache.ibatis.annotations.Param(Constants.WRAPPER) LambdaQueryWrapper<SysDepart> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查詢數據
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SysDepart queryId(String id);
|
||||
/**
|
||||
* 更新id
|
||||
* @param id
|
||||
*/
|
||||
void updateId(String id);
|
||||
|
||||
}
|
||||
|
||||
+16
-2
@@ -2,7 +2,8 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.system.mapper.SysDepartMapper">
|
||||
|
||||
<select id="queryUserDeparts" parameterType="String" resultType="com.jero.modules.system.entity.SysDepart">
|
||||
|
||||
<select id="queryUserDeparts" parameterType="String" resultType="com.jero.modules.system.entity.SysDepart">
|
||||
select * from sys_depart where id IN ( select dep_id from sys_user_depart where user_id = #{userId} )
|
||||
</select>
|
||||
|
||||
@@ -52,4 +53,17 @@
|
||||
<select id="queryCompByOrgCode" resultType="com.jero.modules.system.entity.SysDepart">
|
||||
select * from sys_depart where del_flag = '0' and org_category='1' and org_code= #{orgCode,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
<select id="queryDeptList" resultType="com.jero.modules.system.entity.SysDepart">
|
||||
select * from sys_depart
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryId" resultType="com.jero.modules.system.entity.SysDepart">
|
||||
select * from sys_depart where del_flag = 1 and id =#{id}
|
||||
</select>
|
||||
|
||||
<update id="updateId">
|
||||
update sys_depart set del_flag = 0 where id =#{id}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.jero.common.handler.IFillRuleHandler;
|
||||
import com.jero.common.util.SpringContextUtils;
|
||||
import com.jero.common.util.YouBianCodeUtil;
|
||||
import com.jero.modules.system.entity.SysDepart;
|
||||
import com.jero.modules.system.mapper.SysDepartMapper;
|
||||
import com.jero.modules.system.service.ISysDepartService;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -21,7 +22,7 @@ public class OrgCodeRule implements IFillRuleHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(JSONObject params, JSONObject formData) {
|
||||
ISysDepartService sysDepartService = (ISysDepartService) SpringContextUtils.getBean("sysDepartServiceImpl");
|
||||
SysDepartMapper sysDepartService = (SysDepartMapper) SpringContextUtils.getBean("sysDepartMapper");
|
||||
|
||||
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<>();
|
||||
LambdaQueryWrapper<SysDepart> query1 = new LambdaQueryWrapper<>();
|
||||
@@ -42,7 +43,7 @@ public class OrgCodeRule implements IFillRuleHandler {
|
||||
// 线判断数据库中的表是否为空,空则直接返回初始编码
|
||||
query1.eq(SysDepart::getParentId, "").or().isNull(SysDepart::getParentId);
|
||||
query1.orderByDesc(SysDepart::getOrgCode);
|
||||
departList = sysDepartService.list(query1);
|
||||
departList = sysDepartService.queryDeptList(query1);
|
||||
if (departList == null || departList.isEmpty()) {
|
||||
strArray[0] = YouBianCodeUtil.getNextYouBianCode(null);
|
||||
strArray[1] = "1";
|
||||
@@ -59,9 +60,9 @@ public class OrgCodeRule implements IFillRuleHandler {
|
||||
// 降序排序
|
||||
query.orderByDesc(SysDepart::getOrgCode);
|
||||
// 查询出同级部门的集合
|
||||
List<SysDepart> parentList = sysDepartService.list(query);
|
||||
List<SysDepart> parentList = sysDepartService.queryDeptList(query);
|
||||
// 查询出父级部门
|
||||
SysDepart depart = sysDepartService.getById(parentId);
|
||||
SysDepart depart = sysDepartService.selectById(parentId);
|
||||
// 获取父级部门的Code
|
||||
String parentCode = depart.getOrgCode();
|
||||
// 根据父级部门类型算出当前部门的类型
|
||||
|
||||
Reference in New Issue
Block a user