日志备份功能

This commit is contained in:
lizhenhua 2024-07-29 19:20:13 +08:00
parent 58043280ee
commit 5f53206f33
5 changed files with 55 additions and 48 deletions

View File

@ -29,7 +29,7 @@ import com.bonus.system.service.ISysPostService;
/** /**
* 岗位信息操作处理 * 岗位信息操作处理
* *
* @author bonus * @author bonus
*/ */
@RestController @RestController
@ -138,7 +138,7 @@ public class SysPostController extends BaseController
}catch (Exception e){ }catch (Exception e){
log.error(e.toString(),e); log.error(e.toString(),e);
} }
return error("系统异常"); return error("人力资源已分配,不能删除");
} }
/** /**

View File

@ -92,4 +92,6 @@ public interface SysDictDataMapper
* @return 结果 * @return 结果
*/ */
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType); public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
int getdictDatasInfo(String dictType);
} }

View File

@ -20,7 +20,7 @@ import com.bonus.system.service.ISysDictTypeService;
/** /**
* 字典 业务层处理 * 字典 业务层处理
* *
* @author bonus * @author bonus
*/ */
@Service @Service
@ -43,7 +43,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* 根据条件分页查询字典类型 * 根据条件分页查询字典类型
* *
* @param dictType 字典类型信息 * @param dictType 字典类型信息
* @return 字典类型集合信息 * @return 字典类型集合信息
*/ */
@ -55,7 +55,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* 根据所有字典类型 * 根据所有字典类型
* *
* @return 字典类型集合信息 * @return 字典类型集合信息
*/ */
@Override @Override
@ -66,21 +66,22 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* 根据字典类型查询字典数据 * 根据字典类型查询字典数据
* *
* @param dictType 字典类型 * @param dictType 字典类型
* @return 字典数据集合信息 * @return 字典数据集合信息
*/ */
@Override @Override
public List<SysDictData> selectDictDataByType(String dictType) public List<SysDictData> selectDictDataByType(String dictType)
{ {
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType); List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
if (StringUtils.isNotEmpty(dictDatas)) /* if (StringUtils.isNotEmpty(dictDatas))
{ {
return dictDatas; return dictDatas;
} }*/
dictDatas = dictDataMapper.selectDictDataByType(dictType); int count =dictDataMapper.getdictDatasInfo(dictType);
if (StringUtils.isNotEmpty(dictDatas)) if (count>0)
{ {
dictDatas = dictDataMapper.selectDictDataByType(dictType);
DictUtils.setDictCache(dictType, dictDatas); DictUtils.setDictCache(dictType, dictDatas);
return dictDatas; return dictDatas;
} }
@ -89,7 +90,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* 根据字典类型ID查询信息 * 根据字典类型ID查询信息
* *
* @param dictId 字典类型ID * @param dictId 字典类型ID
* @return 字典类型 * @return 字典类型
*/ */
@ -101,7 +102,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* 根据字典类型查询信息 * 根据字典类型查询信息
* *
* @param dictType 字典类型 * @param dictType 字典类型
* @return 字典类型 * @return 字典类型
*/ */
@ -113,7 +114,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* 批量删除字典类型信息 * 批量删除字典类型信息
* *
* @param dictIds 需要删除的字典ID * @param dictIds 需要删除的字典ID
*/ */
@Override @Override
@ -167,7 +168,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* 新增保存字典类型信息 * 新增保存字典类型信息
* *
* @param dict 字典类型信息 * @param dict 字典类型信息
* @return 结果 * @return 结果
*/ */
@ -184,7 +185,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* 修改保存字典类型信息 * 修改保存字典类型信息
* *
* @param dict 字典类型信息 * @param dict 字典类型信息
* @return 结果 * @return 结果
*/ */
@ -205,7 +206,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/** /**
* 校验字典类型称是否唯一 * 校验字典类型称是否唯一
* *
* @param dict 字典类型 * @param dict 字典类型
* @return 结果 * @return 结果
*/ */

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.system.mapper.SysDictDataMapper"> <mapper namespace="com.bonus.system.mapper.SysDictDataMapper">
<resultMap type="SysDictData" id="SysDictDataResult"> <resultMap type="SysDictData" id="SysDictDataResult">
<id property="dictCode" column="dict_code" /> <id property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" /> <result property="dictSort" column="dict_sort" />
@ -19,9 +19,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
</resultMap> </resultMap>
<sql id="selectDictDataVo"> <sql id="selectDictDataVo">
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
from sys_dict_data from sys_dict_data
</sql> </sql>
@ -40,37 +40,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by dict_sort asc order by dict_sort asc
</select> </select>
<select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult"> <select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/> <include refid="selectDictDataVo"/>
where status = '0' and dict_type = #{dictType} order by dict_sort asc where status = '0' and dict_type = #{dictType} order by dict_sort asc
</select> </select>
<select id="selectDictLabel" resultType="String"> <select id="selectDictLabel" resultType="String">
select dict_label from sys_dict_data select dict_label from sys_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue} where dict_type = #{dictType} and dict_value = #{dictValue}
</select> </select>
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult"> <select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/> <include refid="selectDictDataVo"/>
where dict_code = #{dictCode} where dict_code = #{dictCode}
</select> </select>
<select id="countDictDataByType" resultType="Integer"> <select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where dict_type=#{dictType} select count(1) from sys_dict_data where dict_type=#{dictType}
</select> </select>
<select id="getdictDatasInfo" resultType="java.lang.Integer">
select count(1) from sys_dict_type where dict_type=#{dictType} and status = '0'
</select>
<delete id="deleteDictDataById" parameterType="Long"> <delete id="deleteDictDataById" parameterType="Long">
delete from sys_dict_data where dict_code = #{dictCode} delete from sys_dict_data where dict_code = #{dictCode}
</delete> </delete>
<delete id="deleteDictDataByIds" parameterType="Long"> <delete id="deleteDictDataByIds" parameterType="Long">
delete from sys_dict_data where dict_code in delete from sys_dict_data where dict_code in
<foreach collection="array" item="dictCode" open="(" separator="," close=")"> <foreach collection="array" item="dictCode" open="(" separator="," close=")">
#{dictCode} #{dictCode}
</foreach> </foreach>
</delete> </delete>
<update id="updateDictData" parameterType="SysDictData"> <update id="updateDictData" parameterType="SysDictData">
update sys_dict_data update sys_dict_data
<set> <set>
@ -88,11 +91,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set> </set>
where dict_code = #{dictCode} where dict_code = #{dictCode}
</update> </update>
<update id="updateDictDataType" parameterType="String"> <update id="updateDictDataType" parameterType="String">
update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType} update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
</update> </update>
<insert id="insertDictData" parameterType="SysDictData"> <insert id="insertDictData" parameterType="SysDictData">
insert into sys_dict_data( insert into sys_dict_data(
<if test="dictSort != null">dict_sort,</if> <if test="dictSort != null">dict_sort,</if>
@ -120,5 +123,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate() sysdate()
) )
</insert> </insert>
</mapper> </mapper>

View File

@ -16,12 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
</resultMap> </resultMap>
<sql id="selectPostVo"> <sql id="selectPostVo">
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from sys_post from sys_post
</sql> </sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult"> <select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
<where> <where>
@ -35,17 +35,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND post_name like concat('%', #{postName}, '%') AND post_name like concat('%', #{postName}, '%')
</if> </if>
</where> </where>
order by post_sort
</select> </select>
<select id="selectPostAll" resultMap="SysPostResult"> <select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
</select> </select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult"> <select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
where post_id = #{postId} where post_id = #{postId}
</select> </select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Long"> <select id="selectPostListByUserId" parameterType="Long" resultType="Long">
select p.post_id select p.post_id
from sys_post p from sys_post p
@ -53,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user u on u.user_id = up.user_id left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult"> <select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code select p.post_id, p.post_name, p.post_code
from sys_post p from sys_post p
@ -61,17 +62,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user u on u.user_id = up.user_id left join sys_user u on u.user_id = up.user_id
where u.user_name = #{userName} where u.user_name = #{userName}
</select> </select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult"> <select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
where post_name=#{postName} limit 1 where post_name=#{postName} limit 1
</select> </select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult"> <select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
where post_code=#{postCode} limit 1 where post_code=#{postCode} limit 1
</select> </select>
<update id="updatePost" parameterType="SysPost"> <update id="updatePost" parameterType="SysPost">
update sys_post update sys_post
<set> <set>
@ -85,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set> </set>
where post_id = #{postId} where post_id = #{postId}
</update> </update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId"> <insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post( insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if> <if test="postId != null and postId != 0">post_id,</if>
@ -107,16 +108,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate() sysdate()
) )
</insert> </insert>
<delete id="deletePostById" parameterType="Long"> <delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId} delete from sys_post where post_id = #{postId}
</delete> </delete>
<delete id="deletePostByIds" parameterType="Long"> <delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")"> <foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId} #{postId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>