基础模块修改
This commit is contained in:
parent
e5126b4a95
commit
781d104afb
|
|
@ -1,9 +1,11 @@
|
|||
package com.securitycontrol.common.core.utils.aes;
|
||||
|
||||
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* @author HeiZi
|
||||
|
|
@ -37,4 +39,14 @@ public class ListHelper {
|
|||
return strs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 集合校验
|
||||
* @param keyExtractor
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
||||
Map<Object, Boolean> seen = new ConcurrentHashMap<>(10);
|
||||
return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
package com.securitycontrol.entity.system.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典查询
|
||||
* @author HeiZi
|
||||
*/
|
||||
@Data
|
||||
public class DictDto {
|
||||
|
||||
private String keyWord;
|
||||
|
||||
private String dictId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
package com.securitycontrol.entity.system.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典管理 实体类
|
||||
* @author HeiZi
|
||||
*/
|
||||
@Data
|
||||
public class DictVo {
|
||||
/**字典id*/
|
||||
private Integer dictId;
|
||||
|
||||
/**
|
||||
* 字典编码
|
||||
*/
|
||||
private Integer dictCode;
|
||||
|
||||
/**
|
||||
* 上级节点编码
|
||||
*/
|
||||
private Integer pidCode;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
|
||||
@NotBlank(message = "字典名称不能为空")
|
||||
@Length(max = 100,message = "字典名称长度不能超过100个字符")
|
||||
private String dictName;
|
||||
/**
|
||||
* 字典值
|
||||
*/
|
||||
private Integer dictValue;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Length(max = 100,message = "备注长度不能超过100个字符")
|
||||
private String remarks;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<DictVo> children;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<?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.securitycontrol.system.mapper.DictMapper">
|
||||
|
||||
<resultMap id="MenuMap" type="com.securitycontrol.entity.system.vo.DictVo">
|
||||
<id property="dictId" column="dict_id" />
|
||||
<result property="dictCode" column="dict_code"/>
|
||||
<result property="pidCode" column="p_code"/>
|
||||
<result property="dictName" column="dict_name"/>
|
||||
<result property="dictValue" column="dict_sort"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="remarks" column="remarks"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询 -->
|
||||
<select id="getDictList" resultMap="MenuMap">
|
||||
select dict_id,dict_code,dict_name,dict_sort,p_code,create_time,remarks
|
||||
from sys_dict
|
||||
where del_flag=0
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
and(
|
||||
dict_name like concat('%',#{keyWord},'%')
|
||||
or dict_code =#{keyWord}
|
||||
)
|
||||
</if>
|
||||
order by dict_sort
|
||||
</select>
|
||||
<!--依据字典查询-->
|
||||
<select id="getNumByCode" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from sys_dict
|
||||
where del_flag=0
|
||||
<if test="dictCode!=null and dictCode!='' and dictCode!=0 ">
|
||||
and dict_code=#{dictCode}
|
||||
</if>
|
||||
<if test="dictName!=null and dictName!=''">
|
||||
and dict_name=#{dictName} and p_code=#{pidCode}
|
||||
</if>
|
||||
<if test="dictId!=null and dictId!=''">
|
||||
and dict_id!=#{dictId}
|
||||
</if>
|
||||
</select>
|
||||
<!--子节点数量-->
|
||||
<select id="getChildNum" resultType="java.lang.Integer">
|
||||
select count(sd1.dict_id)
|
||||
from sys_dict sd1
|
||||
left join sys_dict sd2 on sd1.p_code=sd2.dict_code
|
||||
where sd1.del_flag=0 and sd2.dict_id=#{dictId}
|
||||
</select>
|
||||
<select id="getDetails" resultMap="MenuMap">
|
||||
select dict_id,dict_code,dict_name,dict_sort,p_code,create_time,remarks
|
||||
from sys_dict
|
||||
where del_flag=0 and dict_id=#{id}
|
||||
</select>
|
||||
<!--新增字典-->
|
||||
<insert id="addDict">
|
||||
insert into sys_dict (dict_code, dict_name, dict_sort, create_time, del_flag, remarks,p_code) value (
|
||||
#{dictCode},#{dictName},#{dictValue},now(),0,#{remarks},#{pidCode}
|
||||
)
|
||||
</insert>
|
||||
<!--修改-->
|
||||
<update id="updateDict">
|
||||
update sys_dict
|
||||
set dict_code=#{dictCode},dict_name=#{dictName},dict_sort=#{dictValue},remarks=#{remarks}
|
||||
where dict_id=#{dictId};
|
||||
</update>
|
||||
<!--删除-->
|
||||
<delete id="delDict">
|
||||
update sys_dict
|
||||
set p_code=1
|
||||
where dict_id=#{dictId};
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue