75 lines
2.9 KiB
XML
75 lines
2.9 KiB
XML
<?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.bonus.imgTool.system.dao.SysWhiteDao">
|
|
<insert id="addOrUpdateWhite">
|
|
<if test="type == 1">
|
|
INSERT INTO sys_white(ip,access_type,start_time,end_time,create_time)
|
|
VALUES (
|
|
#{ip},#{accessType},#{startTime},#{endTime},#{createTime}
|
|
)
|
|
</if>
|
|
<if test="type == 2">
|
|
UPDATE sys_white SET ip = #{ip},access_type = #{accessType},start_time = #{startTime},end_time = #{endTime},
|
|
create_time = #{createTime} WHERE id = #{id}
|
|
</if>
|
|
</insert>
|
|
<!--删除白名单-->
|
|
<update id="delWhite">
|
|
UPDATE sys_white SET del_flag = '1' WHERE id = #{id}
|
|
</update>
|
|
<update id="updatePwdRule">
|
|
UPDATE sys_password_config SET pwd_strength = #{pwdStrength},min_length = #{minLength},max_length = #{maxLength}
|
|
WHERE id = #{id}
|
|
</update>
|
|
<!--查询白名单列表-->
|
|
<select id="getAllWhite" resultType="com.bonus.imgTool.system.vo.SysWhiteVo">
|
|
select ip,access_type accessType,start_time startTime,end_time endTime
|
|
from sys_white
|
|
WHERE del_flag=0
|
|
<if test="ip!=null and ip!='' ">
|
|
and ip=#{ip}
|
|
</if>
|
|
</select>
|
|
<!--白名单列表-->
|
|
<select id="getWhiteList" resultType="com.bonus.imgTool.system.vo.SysWhiteVo">
|
|
SELECT id,
|
|
ip,
|
|
CASE access_type WHEN '1' THEN '永久' WHEN '2' THEN '固定时间段' WHEN '3' THEN '指定时间' END AS accessType,
|
|
start_time AS startTime,
|
|
end_time AS endTime
|
|
FROM sys_white
|
|
WHERE del_flag = '0'
|
|
<if test="ip!=null and ip!=''">
|
|
AND INSTR(ip,#{ip}) > 0
|
|
</if>
|
|
<if test="accessType!=null and accessType!=''">
|
|
AND INSTR(access_type,#{accessType}) > 0
|
|
</if>
|
|
ORDER BY create_time DESC
|
|
</select>
|
|
<!--查询白名单详情-->
|
|
<select id="queryWhiteById" resultType="com.bonus.imgTool.system.vo.SysWhiteVo">
|
|
SELECT id,
|
|
ip,
|
|
access_type AS accessType,
|
|
start_time AS startTime,
|
|
end_time AS endTime
|
|
FROM sys_white
|
|
WHERE id = #{id} AND del_flag = '0'
|
|
</select>
|
|
<!--判断字段是否重复-->
|
|
<select id="isRepeat" resultType="java.lang.Integer">
|
|
SELECT COUNT(*)
|
|
FROM sys_white
|
|
WHERE ip = #{value} AND del_flag = '0'
|
|
</select>
|
|
<!--查询密码校验规则-->
|
|
<select id="queryPwdRule" resultType="com.bonus.imgTool.system.vo.PwdRuleVo">
|
|
SELECT id,
|
|
pwd_strength AS pwdStrength,
|
|
min_length AS minLength,
|
|
max_length AS maxLength
|
|
FROM sys_password_config LIMIT 1
|
|
</select>
|
|
</mapper> |