school_website/ruoyi-admin/target/classes/mapper/cms/CmsContentMapper.xml

137 lines
8.0 KiB
XML
Raw Normal View History

2024-07-22 11:21:29 +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.cms.mapper.CmsContentMapper">
<resultMap type="CmsContent" id="CmsContentResult">
<result property="id" column="id" />
<result property="categoryId" column="category_id" />
<result property="contentTitle" column="content_title" />
<result property="contentDetails" column="content_details" />
<result property="contentDescription" column="content_description" />
<result property="contentImg" column="content_img" />
<result property="contentAuthor" column="content_author" />
<result property="contentSource" column="content_source" />
<result property="isAccessory" column="is_accessory" />
<result property="accessoryUrl" column="accessory_url" />
<result property="contentType" column="content_type" />
<result property="contentCount" column="content_count" />
<result property="isDisable" column="is_disable" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectCmsContentVo">
select id, category_id, content_title, content_details, content_description, content_img, content_author, content_source, is_accessory, accessory_url, content_type, content_count, is_disable, remark, del_flag, create_time, create_by, update_time, update_by from cms_content
</sql>
<select id="selectCmsContentList" parameterType="CmsContent" resultMap="CmsContentResult">
<include refid="selectCmsContentVo"/>
<where>
<if test="categoryId != null "> and category_id = #{categoryId}</if>
<if test="contentTitle != null and contentTitle != ''"> and content_title = #{contentTitle}</if>
<if test="contentDetails != null and contentDetails != ''"> and content_details = #{contentDetails}</if>
<if test="contentDescription != null and contentDescription != ''"> and content_description = #{contentDescription}</if>
<if test="contentImg != null and contentImg != ''"> and content_img = #{contentImg}</if>
<if test="contentAuthor != null and contentAuthor != ''"> and content_author = #{contentAuthor}</if>
<if test="contentSource != null and contentSource != ''"> and content_source = #{contentSource}</if>
<if test="isAccessory != null "> and is_accessory = #{isAccessory}</if>
<if test="accessoryUrl != null and accessoryUrl != ''"> and accessory_url = #{accessoryUrl}</if>
<if test="contentType != null and contentType != ''"> and content_type = #{contentType}</if>
<if test="contentCount != null "> and content_count = #{contentCount}</if>
<if test="isDisable != null "> and is_disable = #{isDisable}</if>
</where>
</select>
<select id="selectCmsContentById" parameterType="Long" resultMap="CmsContentResult">
<include refid="selectCmsContentVo"/>
where id = #{id}
</select>
<insert id="insertCmsContent" parameterType="CmsContent">
insert into cms_content
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="categoryId != null">category_id,</if>
<if test="contentTitle != null and contentTitle != ''">content_title,</if>
<if test="contentDetails != null">content_details,</if>
<if test="contentDescription != null">content_description,</if>
<if test="contentImg != null">content_img,</if>
<if test="contentAuthor != null">content_author,</if>
<if test="contentSource != null">content_source,</if>
<if test="isAccessory != null">is_accessory,</if>
<if test="accessoryUrl != null">accessory_url,</if>
<if test="contentType != null and contentType != ''">content_type,</if>
<if test="contentCount != null">content_count,</if>
<if test="isDisable != null">is_disable,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="categoryId != null">#{categoryId},</if>
<if test="contentTitle != null and contentTitle != ''">#{contentTitle},</if>
<if test="contentDetails != null">#{contentDetails},</if>
<if test="contentDescription != null">#{contentDescription},</if>
<if test="contentImg != null">#{contentImg},</if>
<if test="contentAuthor != null">#{contentAuthor},</if>
<if test="contentSource != null">#{contentSource},</if>
<if test="isAccessory != null">#{isAccessory},</if>
<if test="accessoryUrl != null">#{accessoryUrl},</if>
<if test="contentType != null and contentType != ''">#{contentType},</if>
<if test="contentCount != null">#{contentCount},</if>
<if test="isDisable != null">#{isDisable},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateCmsContent" parameterType="CmsContent">
update cms_content
<trim prefix="SET" suffixOverrides=",">
<if test="categoryId != null">category_id = #{categoryId},</if>
<if test="contentTitle != null and contentTitle != ''">content_title = #{contentTitle},</if>
<if test="contentDetails != null">content_details = #{contentDetails},</if>
<if test="contentDescription != null">content_description = #{contentDescription},</if>
<if test="contentImg != null">content_img = #{contentImg},</if>
<if test="contentAuthor != null">content_author = #{contentAuthor},</if>
<if test="contentSource != null">content_source = #{contentSource},</if>
<if test="isAccessory != null">is_accessory = #{isAccessory},</if>
<if test="accessoryUrl != null">accessory_url = #{accessoryUrl},</if>
<if test="contentType != null and contentType != ''">content_type = #{contentType},</if>
<if test="contentCount != null">content_count = #{contentCount},</if>
<if test="isDisable != null">is_disable = #{isDisable},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCmsContentById" parameterType="Long">
delete from cms_content where id = #{id}
</delete>
<delete id="deleteCmsContentByIds" parameterType="String">
delete from cms_content where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>