116 lines
6.8 KiB
XML
116 lines
6.8 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.bonus.canteen.core.health.mapper.HealthPopularArticleMapper">
|
||
|
|
<resultMap type="com.bonus.canteen.core.health.domain.HealthPopularArticle" id="HealthPopularArticleResult">
|
||
|
|
<result property="articleId" column="article_id" />
|
||
|
|
<result property="articleTitle" column="article_title" />
|
||
|
|
<result property="coverPhoto" column="cover_photo" />
|
||
|
|
<result property="articleType" column="article_type" />
|
||
|
|
<result property="articleContent" column="article_content" />
|
||
|
|
<result property="articleUrl" column="article_url" />
|
||
|
|
<result property="ifVisible" column="if_visible" />
|
||
|
|
<result property="hits" column="hits" />
|
||
|
|
<result property="ifPushed" column="if_pushed" />
|
||
|
|
<result property="pushTime" column="push_time" />
|
||
|
|
<result property="summary" column="summary" />
|
||
|
|
<result property="createBy" column="create_by" />
|
||
|
|
<result property="createTime" column="create_time" />
|
||
|
|
<result property="updateBy" column="update_by" />
|
||
|
|
<result property="updateTime" column="update_time" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectHealthPopularArticleVo">
|
||
|
|
select article_id, article_title, cover_photo, article_type, article_content, article_url, if_visible, hits, if_pushed, push_time, summary, create_by, create_time, update_by, update_time from health_popular_article
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectHealthPopularArticleList" parameterType="com.bonus.canteen.core.health.domain.HealthPopularArticle" resultMap="HealthPopularArticleResult">
|
||
|
|
<include refid="selectHealthPopularArticleVo"/>
|
||
|
|
<where>
|
||
|
|
<if test="articleTitle != null and articleTitle != ''"> and article_title = #{articleTitle}</if>
|
||
|
|
<if test="coverPhoto != null and coverPhoto != ''"> and cover_photo = #{coverPhoto}</if>
|
||
|
|
<if test="articleType != null "> and article_type = #{articleType}</if>
|
||
|
|
<if test="articleContent != null and articleContent != ''"> and article_content = #{articleContent}</if>
|
||
|
|
<if test="articleUrl != null and articleUrl != ''"> and article_url = #{articleUrl}</if>
|
||
|
|
<if test="ifVisible != null "> and if_visible = #{ifVisible}</if>
|
||
|
|
<if test="hits != null "> and hits = #{hits}</if>
|
||
|
|
<if test="ifPushed != null "> and if_pushed = #{ifPushed}</if>
|
||
|
|
<if test="pushTime != null "> and push_time = #{pushTime}</if>
|
||
|
|
<if test="summary != null and summary != ''"> and summary = #{summary}</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectHealthPopularArticleByArticleId" parameterType="Long" resultMap="HealthPopularArticleResult">
|
||
|
|
<include refid="selectHealthPopularArticleVo"/>
|
||
|
|
where article_id = #{articleId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertHealthPopularArticle" parameterType="com.bonus.canteen.core.health.domain.HealthPopularArticle" useGeneratedKeys="true" keyProperty="articleId">
|
||
|
|
insert into health_popular_article
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="articleTitle != null and articleTitle != ''">article_title,</if>
|
||
|
|
<if test="coverPhoto != null">cover_photo,</if>
|
||
|
|
<if test="articleType != null">article_type,</if>
|
||
|
|
<if test="articleContent != null">article_content,</if>
|
||
|
|
<if test="articleUrl != null">article_url,</if>
|
||
|
|
<if test="ifVisible != null">if_visible,</if>
|
||
|
|
<if test="hits != null">hits,</if>
|
||
|
|
<if test="ifPushed != null">if_pushed,</if>
|
||
|
|
<if test="pushTime != null">push_time,</if>
|
||
|
|
<if test="summary != null">summary,</if>
|
||
|
|
<if test="createBy != null">create_by,</if>
|
||
|
|
<if test="createTime != null">create_time,</if>
|
||
|
|
<if test="updateBy != null">update_by,</if>
|
||
|
|
<if test="updateTime != null">update_time,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="articleTitle != null and articleTitle != ''">#{articleTitle},</if>
|
||
|
|
<if test="coverPhoto != null">#{coverPhoto},</if>
|
||
|
|
<if test="articleType != null">#{articleType},</if>
|
||
|
|
<if test="articleContent != null">#{articleContent},</if>
|
||
|
|
<if test="articleUrl != null">#{articleUrl},</if>
|
||
|
|
<if test="ifVisible != null">#{ifVisible},</if>
|
||
|
|
<if test="hits != null">#{hits},</if>
|
||
|
|
<if test="ifPushed != null">#{ifPushed},</if>
|
||
|
|
<if test="pushTime != null">#{pushTime},</if>
|
||
|
|
<if test="summary != null">#{summary},</if>
|
||
|
|
<if test="createBy != null">#{createBy},</if>
|
||
|
|
<if test="createTime != null">#{createTime},</if>
|
||
|
|
<if test="updateBy != null">#{updateBy},</if>
|
||
|
|
<if test="updateTime != null">#{updateTime},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateHealthPopularArticle" parameterType="com.bonus.canteen.core.health.domain.HealthPopularArticle">
|
||
|
|
update health_popular_article
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="articleTitle != null and articleTitle != ''">article_title = #{articleTitle},</if>
|
||
|
|
<if test="coverPhoto != null">cover_photo = #{coverPhoto},</if>
|
||
|
|
<if test="articleType != null">article_type = #{articleType},</if>
|
||
|
|
<if test="articleContent != null">article_content = #{articleContent},</if>
|
||
|
|
<if test="articleUrl != null">article_url = #{articleUrl},</if>
|
||
|
|
<if test="ifVisible != null">if_visible = #{ifVisible},</if>
|
||
|
|
<if test="hits != null">hits = #{hits},</if>
|
||
|
|
<if test="ifPushed != null">if_pushed = #{ifPushed},</if>
|
||
|
|
<if test="pushTime != null">push_time = #{pushTime},</if>
|
||
|
|
<if test="summary != null">summary = #{summary},</if>
|
||
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||
|
|
</trim>
|
||
|
|
where article_id = #{articleId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteHealthPopularArticleByArticleId" parameterType="Long">
|
||
|
|
delete from health_popular_article where article_id = #{articleId}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteHealthPopularArticleByArticleIds" parameterType="String">
|
||
|
|
delete from health_popular_article where article_id in
|
||
|
|
<foreach item="articleId" collection="array" open="(" separator="," close=")">
|
||
|
|
#{articleId}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
</mapper>
|