|
|
|
|
<?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.jingcheng.cms.mapper.ArticleMapper">
|
|
|
|
|
|
|
|
|
|
<insert id="addArticle" parameterType="com.jingcheng.cms.model.Article">
|
|
|
|
|
INSERT INTO article(`title`,`first_category_name`,`second_category_name`,`keyword`,`file_type`,`content`,`state`)
|
|
|
|
|
values (#{title},#{firstCategoryName},#{secondCategoryName},#{keyword},#{fileType},#{content},#{state})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="getArticleListByCondition" parameterType="com.jingcheng.cms.model.Article" resultType="com.jingcheng.cms.model.Article">
|
|
|
|
|
select `id`,`title`,`first_category_name`,`second_category_name`,`keyword`,`file_type`,`content`,`create_date_time`,
|
|
|
|
|
`update_date_time`,`state` FROM article
|
|
|
|
|
where
|
|
|
|
|
1 = 1
|
|
|
|
|
<if test="title != null and title != ''">
|
|
|
|
|
and title LIKE CONCAT('%',#{title},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="firstCategoryName != null and firstCategoryName != ''">
|
|
|
|
|
and (first_category_name LIKE CONCAT('%',#{firstCategoryName},'%') or second_category_name LIKE CONCAT('%',#{firstCategoryName},'%'))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="fileType != null ">
|
|
|
|
|
and file_type = #{fileType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="state != null ">
|
|
|
|
|
and state = #{state}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|