RuoYi-Cloud/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/ChannelMapper.xml

104 lines
5.1 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.ruoyi.system.mapper.ChannelMapper">
<resultMap type="com.ruoyi.system.domain.Channel" id="ChannelResult">
<result property="id" column="id" />
<result property="channelName" column="channel_name" />
<result property="channelSign" column="channel_sign" />
<result property="score" column="score" />
<result property="htmlName" column="html_name" />
<result property="htmlLocation" column="html_location" />
<result property="ips" column="ips" />
<result property="period" column="period" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectChannelVo">
select id, channel_name, channel_sign, score, html_name, html_location, ips, period, create_time, update_time, remark from channel
</sql>
<sql id="selectChannelIdName">
select id, channel_name, channel_sign from channel
</sql>
<select id="selectChannelList" parameterType="com.ruoyi.system.domain.Channel" resultMap="ChannelResult">
<include refid="selectChannelVo"/>
<where>
<if test="channelName != null and channelName != ''"> and channel_name like concat('%', #{channelName}, '%')</if>
<if test="channelSign != null and channelSign != ''"> and channel_sign = #{channelSign}</if>
<if test="score != null "> and score = #{score}</if>
<if test="htmlName != null and htmlName != ''"> and html_name like concat('%', #{htmlName}, '%')</if>
<if test="htmlLocation != null and htmlLocation != ''"> and html_location = #{htmlLocation}</if>
<if test="ips != null and ips != ''"> and ips = #{ips}</if>
<if test="period != null and period != ''"> and period = #{period}</if>
</where>
</select>
<select id="selectChannelById" parameterType="java.lang.Long" resultMap="ChannelResult">
<include refid="selectChannelVo"/>
where id = #{id}
</select>
<insert id="insertChannel" parameterType="com.ruoyi.system.domain.Channel" useGeneratedKeys="true" keyProperty="id">
insert into channel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="channelName != null">channel_name,</if>
<if test="channelSign != null">channel_sign,</if>
<if test="score != null">score,</if>
<if test="htmlName != null">html_name,</if>
<if test="htmlLocation != null">html_location,</if>
<if test="ips != null">ips,</if>
<if test="period != null">period,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="channelName != null">#{channelName},</if>
<if test="channelSign != null">#{channelSign},</if>
<if test="score != null">#{score},</if>
<if test="htmlName != null">#{htmlName},</if>
<if test="htmlLocation != null">#{htmlLocation},</if>
<if test="ips != null">#{ips},</if>
<if test="period != null">#{period},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateChannel" parameterType="com.ruoyi.system.domain.Channel">
update channel
<trim prefix="SET" suffixOverrides=",">
<if test="channelName != null">channel_name = #{channelName},</if>
<if test="channelSign != null">channel_sign = #{channelSign},</if>
<if test="score != null">score = #{score},</if>
<if test="htmlName != null">html_name = #{htmlName},</if>
<if test="htmlLocation != null">html_location = #{htmlLocation},</if>
<if test="ips != null">ips = #{ips},</if>
<if test="period != null">period = #{period},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteChannelById" parameterType="java.lang.Long">
delete from channel where id = #{id}
</delete>
<delete id="deleteChannelByIds" parameterType="java.lang.String">
delete from channel where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="findAllChannelList" resultMap="ChannelResult">
<include refid="selectChannelIdName"/>
</select>
</mapper>