You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
<?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" 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 #{title}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="categoryName != null and categoryName != ''">
|
|
|
|
|
and (first_category_name like #{categoryName} or second_category_name like #{categoryName})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="fileType != null ">
|
|
|
|
|
and file_type = #{fileType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="state != null ">
|
|
|
|
|
and state = #{state}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|