158 lines
7.7 KiB
XML
158 lines
7.7 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.CmsAlbumMapper">
|
|
|
|
<resultMap type="CmsAlbum" id="CmsAlbumResult">
|
|
<result property="albumId" column="album_id" />
|
|
<result property="albumName" column="album_name" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="deptId" column="dept_id" />
|
|
<result property="albumType" column="album_type" />
|
|
<result property="coverImage" column="cover_image" />
|
|
<result property="description" column="description" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="auditState" column="audit_state" />
|
|
<result property="code" column="code" />
|
|
<result property="width" column="width" />
|
|
<result property="height" column="height" />
|
|
<result property="hit" column="hit" />
|
|
<result property="upVote" column="up_vote" />
|
|
<result property="commentFlag" column="comment_flag" />
|
|
</resultMap>
|
|
|
|
<sql id="selectCmsAlbumVo">
|
|
select album_id, album_name, user_id, dept_id, album_type, cover_image, description, create_by, create_time, audit_state, code, width, height, hit, up_vote, comment_flag from cms_album
|
|
</sql>
|
|
|
|
<select id="selectCmsAlbumList" parameterType="CmsAlbum" resultMap="CmsAlbumResult">
|
|
<include refid="selectCmsAlbumVo"/>
|
|
<where>
|
|
<if test="albumName != null and albumName != ''"> and album_name like concat('%', #{albumName}, '%')</if>
|
|
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
|
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
|
|
<if test="albumType != null and albumType != ''"> and album_type = #{albumType}</if>
|
|
<if test="coverImage != null and coverImage != ''"> and cover_image = #{coverImage}</if>
|
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
|
<if test="auditState != null "> and audit_state = #{auditState}</if>
|
|
<if test="code != null and code != ''"> and code = #{code}</if>
|
|
<if test="width != null "> and width = #{width}</if>
|
|
<if test="height != null "> and height = #{height}</if>
|
|
<if test="hit != null "> and hit = #{hit}</if>
|
|
<if test="upVote != null "> and up_vote = #{upVote}</if>
|
|
<if test="commentFlag != null "> and comment_flag = #{commentFlag}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectCmsAlbumByAlbumId" parameterType="String" resultMap="CmsAlbumResult">
|
|
<include refid="selectCmsAlbumVo"/>
|
|
where album_id = #{albumId}
|
|
</select>
|
|
|
|
<insert id="insertCmsAlbum" parameterType="CmsAlbum">
|
|
insert into cms_album
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="albumId != null">album_id,</if>
|
|
<if test="albumName != null">album_name,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="deptId != null">dept_id,</if>
|
|
<if test="albumType != null">album_type,</if>
|
|
<if test="coverImage != null">cover_image,</if>
|
|
<if test="description != null">description,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="auditState != null">audit_state,</if>
|
|
<if test="code != null">code,</if>
|
|
<if test="width != null">width,</if>
|
|
<if test="height != null">height,</if>
|
|
<if test="hit != null">hit,</if>
|
|
<if test="upVote != null">up_vote,</if>
|
|
<if test="commentFlag != null">comment_flag,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="albumId != null">#{albumId},</if>
|
|
<if test="albumName != null">#{albumName},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="deptId != null">#{deptId},</if>
|
|
<if test="albumType != null">#{albumType},</if>
|
|
<if test="coverImage != null">#{coverImage},</if>
|
|
<if test="description != null">#{description},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="auditState != null">#{auditState},</if>
|
|
<if test="code != null">#{code},</if>
|
|
<if test="width != null">#{width},</if>
|
|
<if test="height != null">#{height},</if>
|
|
<if test="hit != null">#{hit},</if>
|
|
<if test="upVote != null">#{upVote},</if>
|
|
<if test="commentFlag != null">#{commentFlag},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateCmsAlbum" parameterType="CmsAlbum">
|
|
update cms_album
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="albumName != null">album_name = #{albumName},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
|
<if test="albumType != null">album_type = #{albumType},</if>
|
|
<if test="coverImage != null">cover_image = #{coverImage},</if>
|
|
<if test="description != null">description = #{description},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="auditState != null">audit_state = #{auditState},</if>
|
|
<if test="code != null">code = #{code},</if>
|
|
<if test="width != null">width = #{width},</if>
|
|
<if test="height != null">height = #{height},</if>
|
|
<if test="hit != null">hit = #{hit},</if>
|
|
<if test="upVote != null">up_vote = #{upVote},</if>
|
|
<if test="commentFlag != null">comment_flag = #{commentFlag},</if>
|
|
</trim>
|
|
where album_id = #{albumId}
|
|
</update>
|
|
|
|
<delete id="deleteCmsAlbumByAlbumId" parameterType="String">
|
|
delete from cms_album where album_id = #{albumId}
|
|
</delete>
|
|
|
|
<delete id="deleteCmsAlbumByAlbumIds" parameterType="String">
|
|
delete from cms_album where album_id in
|
|
<foreach item="albumId" collection="array" open="(" separator="," close=")">
|
|
#{albumId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<insert id="insertAlbumMaterialBatch" parameterType="CmsAlbumMaterial">
|
|
insert into cms_album_material (id,album_id,material_id,link,sort)
|
|
values
|
|
<foreach collection="list" item="item" separator="," >
|
|
(null,#{item.albumId},#{item.materialId},#{item.link},#{item.sort})
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
<resultMap type="CmsAlbumMaterial" id="AlbumMaterialResult">
|
|
<result property="id" column="id" />
|
|
<result property="link" column="link" />
|
|
<result property="sort" column="sort" />
|
|
<result property="materialId" column="material_id" />
|
|
<result property="albumId" column="album_id" />
|
|
</resultMap>
|
|
|
|
<select id="selectAlbumMaterialByIds" parameterType="String" resultMap="AlbumMaterialResult">
|
|
select * from cms_album_material where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
|
|
</select>
|
|
<delete id="deleteAlbumMaterialByIds" parameterType="String">
|
|
delete from cms_album_material where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|