huaguoshan-admin/ruoyi-system/target/classes/mapper/system/CmsAlbumMaterialMapper.xml

71 lines
3.0 KiB
XML
Raw Permalink Normal View History

2024-06-18 15:21:41 +08:00
<?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.CmsAlbumMaterialMapper">
<resultMap type="CmsAlbumMaterial" id="CmsAlbumMaterialResult">
<result property="id" column="id" />
<result property="albumId" column="album_id" />
<result property="materialId" column="material_id" />
<result property="link" column="link" />
<result property="sort" column="sort" />
</resultMap>
<sql id="selectCmsAlbumMaterialVo">
select id, album_id, material_id, link, sort from cms_album_material
</sql>
<select id="selectCmsAlbumMaterialList" parameterType="CmsAlbumMaterial" resultMap="CmsAlbumMaterialResult">
<include refid="selectCmsAlbumMaterialVo"/>
<where>
<if test="albumId != null and albumId != ''"> and album_id = #{albumId}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="link != null and link != ''"> and link = #{link}</if>
<if test="sort != null "> and sort = #{sort}</if>
</where>
</select>
<select id="selectCmsAlbumMaterialById" parameterType="Long" resultMap="CmsAlbumMaterialResult">
<include refid="selectCmsAlbumMaterialVo"/>
where id = #{id}
</select>
<insert id="insertCmsAlbumMaterial" parameterType="CmsAlbumMaterial" useGeneratedKeys="true" keyProperty="id">
insert into cms_album_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="albumId != null">album_id,</if>
<if test="materialId != null">material_id,</if>
<if test="link != null">link,</if>
<if test="sort != null">sort,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="albumId != null">#{albumId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="link != null">#{link},</if>
<if test="sort != null">#{sort},</if>
</trim>
</insert>
<update id="updateCmsAlbumMaterial" parameterType="CmsAlbumMaterial">
update cms_album_material
<trim prefix="SET" suffixOverrides=",">
<if test="albumId != null">album_id = #{albumId},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="link != null">link = #{link},</if>
<if test="sort != null">sort = #{sort},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCmsAlbumMaterialById" parameterType="Long">
delete from cms_album_material where id = #{id}
</delete>
<delete id="deleteCmsAlbumMaterialByIds" parameterType="String">
delete from cms_album_material where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>