<?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.project.tr.article.mapper.ArticleMapper">
|
|
<resultMap type="Article" id="ArticleResult">
|
<result property="articleId" column="article_id" />
|
<result property="createBy" column="create_by" />
|
<result property="createTime" column="create_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateTime" column="update_time" />
|
<result property="remark" column="remark" />
|
<result property="articleTitle" column="article_title" />
|
<result property="articleContent" column="article_content" />
|
<result property="companyId" column="company_id" />
|
<result property="articleType" column="article_type" />
|
</resultMap>
|
|
<sql id="selectArticleVo">
|
select article_id, create_by, create_time, update_by, update_time, remark, article_title, article_content, company_id, article_type from tr_article
|
</sql>
|
|
<select id="selectArticleList" parameterType="Article" resultMap="ArticleResult">
|
<include refid="selectArticleVo"/>
|
<where>
|
<if test="articleId != null "> and article_id = #{articleId}</if>
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%',#{createBy},'%')</if>
|
<if test="beginCreateTime != null "> and create_time >= #{beginCreateTime}</if>
|
<if test="endCreateTime != null "> and create_time <= #{endCreateTime}</if>
|
<if test="articleTitle != null and articleTitle != ''"> and article_title like concat('%',#{articleTitle},'%')</if>
|
<if test="articleContent != null and articleContent != ''"> and article_content = #{articleContent}</if>
|
<if test="companyId != null "> and company_id = #{companyId}</if>
|
<if test="articleType != null "> and article_type = #{articleType}</if>
|
</where>
|
</select>
|
|
<select id="selectArticleById" parameterType="Long" resultMap="ArticleResult">
|
<include refid="selectArticleVo"/>
|
where article_id = #{articleId}
|
</select>
|
|
<insert id="insertArticle" parameterType="Article" useGeneratedKeys="true" keyProperty="articleId">
|
insert into tr_article
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createTime != null ">create_time,</if>
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
<if test="updateTime != null ">update_time,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
<if test="articleTitle != null and articleTitle != ''">article_title,</if>
|
<if test="articleContent != null and articleContent != ''">article_content,</if>
|
<if test="companyId != null ">company_id,</if>
|
<if test="articleType != null ">article_type,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createTime != null ">#{createTime},</if>
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
<if test="updateTime != null ">#{updateTime},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="articleTitle != null and articleTitle != ''">#{articleTitle},</if>
|
<if test="articleContent != null and articleContent != ''">#{articleContent},</if>
|
<if test="companyId != null ">#{companyId},</if>
|
<if test="articleType != null ">#{articleType},</if>
|
</trim>
|
</insert>
|
|
<update id="updateArticle" parameterType="Article">
|
update tr_article
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
<if test="articleTitle != null and articleTitle != ''">article_title = #{articleTitle},</if>
|
<if test="articleContent != null and articleContent != ''">article_content = #{articleContent},</if>
|
<if test="companyId != null ">company_id = #{companyId},</if>
|
<if test="articleType != null ">article_type = #{articleType},</if>
|
</trim>
|
where article_id = #{articleId}
|
</update>
|
|
<delete id="deleteArticleById" parameterType="Long">
|
delete from tr_article where article_id = #{articleId}
|
</delete>
|
|
<delete id="deleteArticleByIds" parameterType="String">
|
delete from tr_article where article_id in
|
<foreach item="articleId" collection="array" open="(" separator="," close=")">
|
#{articleId}
|
</foreach>
|
</delete>
|
|
</mapper>
|