提取分支--添加项目安全相关认证与拦截

This commit is contained in:
梁琦涛
2023-04-06 10:58:19 +08:00
parent 06356aab40
commit 591f68b998
25 changed files with 1438 additions and 156 deletions
@@ -0,0 +1,87 @@
package com.jero.modules.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.jero.common.aspect.annotation.Dict;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @Author zhangweijian
* @since 2018-12-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysDictItemCore implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 字典id
*/
private String dictId;
/**
* 字典编码
*/
@TableField(exist = false)
private String dictCode;
/**
* 字典项文本
*/
@Excel(name = "字典项文本", width = 20)
private String itemText;
/**
* 字典项值
*/
@Excel(name = "字典项值", width = 30)
private String itemValue;
/**
* 描述
*/
@Excel(name = "描述", width = 40)
private String description;
/**
* 排序
*/
@Excel(name = "排序", width = 15,type=4)
private Integer sortOrder;
/**
* 状态(1启用 0不启用)
*/
@Dict(dicCode = "dict_item_status")
private Integer status;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
}
@@ -17,4 +17,14 @@ import java.util.List;
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
@Select("SELECT * FROM sys_dict_item WHERE DICT_ID = #{mainId} order by sort_order asc, item_value asc")
public List<SysDictItem> selectItemsByMainId(String mainId);
// /**
// * 获取字典所有数据
// * @author LQT
// * @Date 2022/5/13 14:22
// * @param
// * @return java.util.List<com.jero.system.dict.entity.SysDictItem>
// */
// List<SysDictItem> getDictItemAll();
}
@@ -2,4 +2,9 @@
<!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.SysDictItemMapper">
<!-- <select id="getDictItemAll" resultType="com.jero.modules.system.entity.SysDictItem">-->
<!-- SELECT tsdi.*,tsd.dict_code FROM sys_dict_item tsdi-->
<!-- LEFT JOIN sys_dict tsd ON tsdi.dict_id = tsd.id-->
<!-- WHERE status = 1-->
<!-- </select>-->
</mapper>
@@ -36,7 +36,7 @@
<!-- 通过字典code获取字典数据 -->
<select id="queryDictTextByKey" parameterType="String" resultType="String">
select s.item_text from sys_dict_item s
select s.item_text from sys_dict_item s
where s.dict_id = (select id from sys_dict where dict_code = #{code})
and s.item_value = #{key}
</select>
@@ -66,7 +66,7 @@
<select id="queryTableDictItemsByCode" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
select ${text} as "text",${code} as "value" from ${table}
</select>
<!--通过查询指定table的 text code 获取字典(指定查询条件)-->
<select id="queryTableDictItemsByCodeAndFilter" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
select ${text} as "text",${code} as "value" from ${table}
@@ -74,7 +74,7 @@
where ${filterSql}
</if>
</select>
<!--通过查询指定table的 text code key 获取字典值-->
<select id="queryTableDictTextByKey" parameterType="String" resultType="String">
select ${text} as "text" from ${table} where ${code}= #{key}
@@ -88,7 +88,7 @@
</foreach>
)
</select>
<!--通过查询指定table的 text code key 获取字典值,包含value-->
<select id="queryTableDictByKeys" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
select ${text} as "text", ${code} as "value" from ${table} where ${code} in
@@ -100,28 +100,34 @@
<!-- 重复校验 sql语句 -->
<select id="duplicateCheckCountSql" resultType="Long" parameterType="com.jero.modules.system.model.DuplicateCheckVo">
SELECT COUNT(*) FROM ${tableName} WHERE ${fieldName} = #{fieldVal} and id &lt;&gt; #{dataId}
<if test="tableName == 'sys_user' or tableName == 'sys_depart'">
and del_flag = 0
</if>
</select>
<!-- 重复校验 sql语句 -->
<select id="duplicateCheckCountSqlNoDataId" resultType="Long" parameterType="com.jero.modules.system.model.DuplicateCheckVo">
SELECT COUNT(*) FROM ${tableName} WHERE ${fieldName} = #{fieldVal}
<if test="tableName == 'sys_user' or tableName == 'sys_depart'">
and del_flag = 0
</if>
</select>
<!-- 查询部门信息 作为字典数据 -->
<select id="queryAllDepartBackDictModel" resultType="com.jero.common.system.vo.DictModel">
select id as "value",depart_name as "text" from sys_depart where del_flag = '0'
</select>
<!-- 查询用户信息 作为字典数据 -->
<select id="queryAllUserBackDictModel" resultType="com.jero.common.system.vo.DictModel">
select username as "value",realname as "text" from sys_user where del_flag = '0'
</select>
<!--通过查询指定table的 text code 获取字典数据,且支持关键字查询 -->
<select id="queryTableDictItems" parameterType="String" resultType="com.jero.common.system.vo.DictModel">
select ${text} as "text",${code} as "value" from ${table} where ${text} like #{keyword}
</select>
<!-- 根据表名、显示字段名、存储字段名、父ID查询树 -->
<select id="queryTreeList" parameterType="Object" resultType="com.jero.modules.system.model.TreeSelectModel">
select ${text} as "title",
@@ -15,4 +15,13 @@ import java.util.List;
*/
public interface ISysDictItemService extends IService<SysDictItem> {
public List<SysDictItem> selectItemsByMainId(String mainId);
/**
* 获取字典所有数据
* @author LQT
* @Date 2022/5/13 14:22
* @param
* @return java.util.List<com.jero.system.dict.entity.SysDictItem>
*/
List<SysDictItem> getDictItemAll();
}
@@ -19,6 +19,7 @@ import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.*;
import com.jero.common.system.vo.SysDictItemCore;
import com.jero.common.util.SysAnnmentTypeEnum;
import com.jero.common.util.YouBianCodeUtil;
import com.jero.common.util.oConvertUtils;
@@ -40,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.CollectionUtils;
import org.springframework.util.PathMatcher;
import javax.annotation.Resource;
@@ -94,6 +96,11 @@ public class SysBaseApiImpl implements ISysBaseAPI {
@Autowired
private ISysPermissionDataRuleService sysPermissionDataRuleService;
@Resource
private ISysDictService dictService;
@Resource
private ISysDictItemService sysDictItemService;
@Autowired
ISysCategoryService sysCategoryService;
private static final String ERROR_MSG = "消息模板不存在,模板编码:";
@@ -1151,4 +1158,19 @@ public class SysBaseApiImpl implements ISysBaseAPI {
return sysDictService.queryTableDictTextByKeys(table, text, code, Arrays.asList(keys.split(",")));
}
@Override
public List<SysDictItemCore> getDictItemAll() {
List<SysDictItem> listSysDictItem = sysDictItemService.getDictItemAll();
List<SysDictItemCore> listSysDictItemCore = new ArrayList<>();
if(!CollectionUtils.isEmpty(listSysDictItem)){
listSysDictItemCore = JSONObject.parseArray(JSON.toJSONString(listSysDictItem),SysDictItemCore.class);
}
return listSysDictItemCore;
}
@Override
public String queryTableDictTextByKey(String table, String text, String code, String key) {
return dictService.queryTableDictTextByKey(table,text,code,key);
}
}
@@ -27,4 +27,10 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
public List<SysDictItem> selectItemsByMainId(String mainId) {
return sysDictItemMapper.selectItemsByMainId(mainId);
}
@Override
public List<SysDictItem> getDictItemAll() {
// return sysDictItemMapper.getDictItemAll();
return null;
}
}