182 lines
9.4 KiB
XML
182 lines
9.4 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.zhwl.cms.mapper.ZdyCmsPageMapper">
|
|
|
|
<resultMap type="ZdyCmsPage" id="ZdyCmsPageResult">
|
|
<result property="id" column="id" />
|
|
<result property="categoryId" column="category_id" />
|
|
<result property="type" column="type" />
|
|
<result property="title" column="title" />
|
|
<result property="keywords" column="keywords" />
|
|
<result property="description" column="description" />
|
|
<result property="flag" column="flag" />
|
|
<result property="image" column="image" />
|
|
<result property="content" column="content" />
|
|
<result property="icon" column="icon" />
|
|
<result property="views" column="views" />
|
|
<result property="likes" column="likes" />
|
|
<result property="dislikes" column="dislikes" />
|
|
<result property="comments" column="comments" />
|
|
<result property="diyname" column="diyname" />
|
|
<result property="showtpl" column="showtpl" />
|
|
<result property="createtime" column="createtime" />
|
|
<result property="updatetime" column="updatetime" />
|
|
<result property="weigh" column="weigh" />
|
|
<result property="status" column="status" />
|
|
</resultMap>
|
|
|
|
<sql id="selectZdyCmsPageVo">
|
|
select id, category_id, type, title, keywords, description, flag, image, content, icon, views, likes, dislikes, comments, diyname, showtpl, createtime, updatetime, weigh, status from zdy_cms_page
|
|
</sql>
|
|
|
|
<select id="selectZdyCmsPageList" parameterType="ZdyCmsPage" resultMap="ZdyCmsPageResult">
|
|
<include refid="selectZdyCmsPageVo"/>
|
|
<where>
|
|
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
|
<if test="title != null and title != ''"> and title = #{title}</if>
|
|
<if test="keywords != null and keywords != ''"> and keywords = #{keywords}</if>
|
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
|
<if test="flag != null and flag != ''"> and flag = #{flag}</if>
|
|
<if test="image != null and image != ''"> and image = #{image}</if>
|
|
<if test="content != null and content != ''"> and content = #{content}</if>
|
|
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
|
|
<if test="views != null "> and views = #{views}</if>
|
|
<if test="likes != null "> and likes = #{likes}</if>
|
|
<if test="dislikes != null "> and dislikes = #{dislikes}</if>
|
|
<if test="comments != null "> and comments = #{comments}</if>
|
|
<if test="diyname != null and diyname != ''"> and diyname like concat('%', #{diyname}, '%')</if>
|
|
<if test="showtpl != null and showtpl != ''"> and showtpl = #{showtpl}</if>
|
|
<if test="createtime != null "> and createtime = #{createtime}</if>
|
|
<if test="updatetime != null "> and updatetime = #{updatetime}</if>
|
|
<if test="weigh != null "> and weigh = #{weigh}</if>
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
</where>
|
|
order by weigh desc, id desc
|
|
</select>
|
|
|
|
<select id="selectZdyCmsPageById" parameterType="Integer" resultMap="ZdyCmsPageResult">
|
|
<include refid="selectZdyCmsPageVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertZdyCmsPage" parameterType="ZdyCmsPage" useGeneratedKeys="true" keyProperty="id">
|
|
insert into zdy_cms_page
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="categoryId != null">category_id,</if>
|
|
<if test="type != null and type != ''">type,</if>
|
|
<if test="title != null and title != ''">title,</if>
|
|
<if test="keywords != null and keywords != ''">keywords,</if>
|
|
<if test="description != null and description != ''">description,</if>
|
|
<if test="flag != null and flag != ''">flag,</if>
|
|
<if test="image != null and image != ''">image,</if>
|
|
<if test="content != null">content,</if>
|
|
<if test="icon != null and icon != ''">icon,</if>
|
|
<if test="views != null">views,</if>
|
|
<if test="likes != null">likes,</if>
|
|
<if test="dislikes != null">dislikes,</if>
|
|
<if test="comments != null">comments,</if>
|
|
<if test="diyname != null and diyname != ''">diyname,</if>
|
|
<if test="showtpl != null and showtpl != ''">showtpl,</if>
|
|
<if test="createtime != null">createtime,</if>
|
|
<if test="updatetime != null">updatetime,</if>
|
|
<if test="weigh != null">weigh,</if>
|
|
<if test="status != null and status != ''">status,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="categoryId != null">#{categoryId},</if>
|
|
<if test="type != null and type != ''">#{type},</if>
|
|
<if test="title != null and title != ''">#{title},</if>
|
|
<if test="keywords != null and keywords != ''">#{keywords},</if>
|
|
<if test="description != null and description != ''">#{description},</if>
|
|
<if test="flag != null and flag != ''">#{flag},</if>
|
|
<if test="image != null and image != ''">#{image},</if>
|
|
<if test="content != null">#{content},</if>
|
|
<if test="icon != null and icon != ''">#{icon},</if>
|
|
<if test="views != null">#{views},</if>
|
|
<if test="likes != null">#{likes},</if>
|
|
<if test="dislikes != null">#{dislikes},</if>
|
|
<if test="comments != null">#{comments},</if>
|
|
<if test="diyname != null and diyname != ''">#{diyname},</if>
|
|
<if test="showtpl != null and showtpl != ''">#{showtpl},</if>
|
|
<if test="createtime != null">#{createtime},</if>
|
|
<if test="updatetime != null">#{updatetime},</if>
|
|
<if test="weigh != null">#{weigh},</if>
|
|
<if test="status != null and status != ''">#{status},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateZdyCmsPage" parameterType="ZdyCmsPage">
|
|
update zdy_cms_page
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="categoryId != null">category_id = #{categoryId},</if>
|
|
<if test="type != null and type != ''">type = #{type},</if>
|
|
<if test="title != null and title != ''">title = #{title},</if>
|
|
<if test="keywords != null and keywords != ''">keywords = #{keywords},</if>
|
|
<if test="description != null and description != ''">description = #{description},</if>
|
|
<if test="flag != null and flag != ''">flag = #{flag},</if>
|
|
<if test="image != null and image != ''">image = #{image},</if>
|
|
<if test="content != null">content = #{content},</if>
|
|
<if test="icon != null and icon != ''">icon = #{icon},</if>
|
|
<if test="views != null">views = #{views},</if>
|
|
<if test="likes != null">likes = #{likes},</if>
|
|
<if test="dislikes != null">dislikes = #{dislikes},</if>
|
|
<if test="comments != null">comments = #{comments},</if>
|
|
<if test="diyname != null and diyname != ''">diyname = #{diyname},</if>
|
|
<if test="showtpl != null and showtpl != ''">showtpl = #{showtpl},</if>
|
|
<if test="createtime != null">createtime = #{createtime},</if>
|
|
<if test="updatetime != null">updatetime = #{updatetime},</if>
|
|
<if test="weigh != null">weigh = #{weigh},</if>
|
|
<if test="status != null and status != ''">status = #{status},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteZdyCmsPageById" parameterType="Integer">
|
|
delete from zdy_cms_page where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteZdyCmsPageByIds" parameterType="String">
|
|
delete from zdy_cms_page where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectDistinctType" resultMap="ZdyCmsPageResult">
|
|
select DISTINCT type from zdy_cms_page
|
|
</select>
|
|
|
|
<select id="selectZdyCmsPageByDiyname" parameterType="String" resultMap="ZdyCmsPageResult">
|
|
<include refid="selectZdyCmsPageVo"/>
|
|
<where>
|
|
diyname = #{diyname}
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectPageListByCustom" resultType="com.zhwl.vo.PageResultVo">
|
|
<include refid="selectZdyCmsPageVo"/>
|
|
<where>
|
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
|
|
|
<if test="flags != null and flags != ''"> and flag in
|
|
<foreach item="flag" collection="flags" open="(" separator="," close=")">
|
|
#{flag}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="conditionmap != null and conditionmap != ''"> and
|
|
<foreach collection="conditionmap.entrySet()" index="key" item="val" open="(" separator="and" close=")">
|
|
${key} = #{val}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
<if test="orderby != null and orderby != ''"> order by ${orderby} ${orderway}</if>
|
|
|
|
<if test="limit != null and limit != ''"> limit ${limit}</if>
|
|
|
|
</select>
|
|
</mapper>
|