Files
fateverse/admin/admin-biz/src/main/resources/mapper/IpBackMapper.xml
2024-03-06 17:44:09 +08:00

89 lines
3.3 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="cn.fateverse.admin.mapper.IpBackMapper">
<sql id="selectIPBack">
select id,
ip_addr,
type,
mark,
create_by,
create_time,
update_by,
update_time
from sys_ip_back
</sql>
<select id="selectList" resultType="cn.fateverse.admin.entity.IpBack">
<include refid="selectIPBack"/>
<where>
<if test="ipAddr != null and ipAddr != ''">ip_addr like concat('%', #{ipAddr}, '%')</if>
<if test="type != null and type != ''">type = type</if>
<if test="startTime != null and endTime != null">
and create_time between #{startTime} and #{endTime}
</if>
</where>
</select>
<select id="selectById" resultType="cn.fateverse.admin.entity.IpBack">
<include refid="selectIPBack"/>
where id = #{id}
</select>
<select id="selectByIds" resultType="cn.fateverse.admin.entity.IpBack">
<include refid="selectIPBack"/>
where id in
<foreach collection="list" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</select>
<select id="selectListStartEnd" resultType="cn.fateverse.admin.entity.IpBack">
<include refid="selectIPBack"/>
limit #{start} , #{end}
</select>
<select id="selectByIdaddr" resultType="cn.fateverse.admin.entity.IpBack">
<include refid="selectIPBack"/>
where ip_addr = #{ipAddr}
</select>
<select id="selectIpv4Count" resultType="cn.fateverse.admin.entity.IpBack">
select count(*) from sys_ip_back where type = 'ipv4'
</select>
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
insert into sys_ip_back
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ipAddr != null and ipAddr != ''">ip_addr ,</if>
<if test="type != null and type != ''">type ,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ipAddr != null and ipAddr != ''">#{ipAddr},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="update">
update sys_ip_back
<set>
<if test="ipAddr != null and ipAddr != ''">ip_addr = #{ipAddr},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from sys_ip_back
where id in
<foreach collection="list" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</delete>
</mapper>