89 lines
3.6 KiB
XML
89 lines
3.6 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.AdvImgMapper">
|
|
|
|
<resultMap type="AdvImg" id="AdvImgResult">
|
|
<result property="id" column="id" />
|
|
<result property="title" column="title" />
|
|
<result property="type" column="type" />
|
|
<result property="image" column="image" />
|
|
<result property="link" column="link" />
|
|
<result property="sort" column="sort" />
|
|
<result property="status" column="status" />
|
|
<result property="createdAt" column="created_at" />
|
|
<result property="updatedAt" column="updated_at" />
|
|
</resultMap>
|
|
|
|
<sql id="selectAdvImgVo">
|
|
select id, title, type, image, link, sort, status, created_at, updated_at from adv_img
|
|
</sql>
|
|
|
|
<select id="selectAdvImgList" parameterType="AdvImg" resultMap="AdvImgResult">
|
|
<include refid="selectAdvImgVo"/>
|
|
<where>
|
|
<if test="title != null and title != ''"> and title like concat('%',#{title},'%')</if>
|
|
<if test="type != null "> and type = #{type}</if>
|
|
<if test="image != null and image != ''"> and image = #{image}</if>
|
|
<if test="link != null and link != ''"> and link = #{link}</if>
|
|
<if test="sort != null "> and sort = #{sort}</if>
|
|
<if test="status != null "> and status = #{status}</if>
|
|
</where>
|
|
order by id desc
|
|
</select>
|
|
|
|
<select id="selectAdvImgById" parameterType="Long" resultMap="AdvImgResult">
|
|
<include refid="selectAdvImgVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertAdvImg" parameterType="AdvImg" useGeneratedKeys="true" keyProperty="id">
|
|
insert into adv_img
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="title != null and title != ''">title,</if>
|
|
<if test="type != null">type,</if>
|
|
<if test="image != null">image,</if>
|
|
<if test="link != null">link,</if>
|
|
<if test="sort != null">sort,</if>
|
|
<if test="status != null">status,</if>
|
|
created_at,
|
|
updated_at
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="title != null and title != ''">#{title},</if>
|
|
<if test="type != null">#{type},</if>
|
|
<if test="image != null">#{image},</if>
|
|
<if test="link != null">#{link},</if>
|
|
<if test="sort != null">#{sort},</if>
|
|
<if test="status != null">#{status},</if>
|
|
NOW(),
|
|
NOW()
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateAdvImg" parameterType="AdvImg">
|
|
update adv_img
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="title != null and title != ''">title = #{title},</if>
|
|
<if test="type != null">type = #{type},</if>
|
|
<if test="image != null">image = #{image},</if>
|
|
<if test="link != null">link = #{link},</if>
|
|
<if test="sort != null">sort = #{sort},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
updated_at=NOW()
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteAdvImgById" parameterType="Long">
|
|
delete from adv_img where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteAdvImgByIds" parameterType="String">
|
|
delete from adv_img where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |