日志备份功能

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
*/
@RestController
@ -138,7 +138,7 @@ public class SysPostController extends BaseController
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
return error("人力资源已分配,不能删除");
}
/**

View File

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

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.system.mapper.SysDictDataMapper">
<resultMap type="SysDictData" id="SysDictDataResult">
<id property="dictCode" column="dict_code" />
<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="updateTime" column="update_time" />
</resultMap>
<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
</sql>
@ -40,37 +40,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by dict_sort asc
</select>
<select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where status = '0' and dict_type = #{dictType} order by dict_sort asc
</select>
<select id="selectDictLabel" resultType="String">
select dict_label from sys_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue}
</select>
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where dict_code = #{dictCode}
</select>
<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 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 from sys_dict_data where dict_code = #{dictCode}
</delete>
<delete id="deleteDictDataByIds" parameterType="Long">
delete from sys_dict_data where dict_code in
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
#{dictCode}
</foreach>
</foreach>
</delete>
<update id="updateDictData" parameterType="SysDictData">
update sys_dict_data
<set>
@ -88,11 +91,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set>
where dict_code = #{dictCode}
</update>
<update id="updateDictDataType" parameterType="String">
update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
</update>
<insert id="insertDictData" parameterType="SysDictData">
insert into sys_dict_data(
<if test="dictSort != null">dict_sort,</if>
@ -120,5 +123,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate()
)
</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="remark" column="remark" />
</resultMap>
<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
</sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/>
<where>
@ -35,17 +35,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
order by post_sort
</select>
<select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
select p.post_id
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
where u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
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
where u.user_name = #{userName}
</select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
</select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
</select>
<update id="updatePost" parameterType="SysPost">
update sys_post
<set>
@ -85,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set>
where post_id = #{postId}
</update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if>
@ -107,16 +108,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate()
)
</insert>
<delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId}
</delete>
<delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</foreach>
</delete>
</mapper>
</mapper>