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.

28 lines
1.3 KiB
XML

5 years ago
<?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">
5 years ago
INSERT INTO article(`title`,`first_category_name`,`second_category_name`,`keyword`,`file_type`,`content`,`state`)
values (#{title},#{firstCategoryName},#{secondCategoryName},#{keyword},#{fileType},#{content},#{state})
5 years ago
</insert>
5 years ago
5 years ago
<select id="getArticleListByCondition" resultType="com.jingcheng.cms.model.Article">
5 years ago
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 != ''">
5 years ago
and title like #{title}
5 years ago
</if>
5 years ago
<if test="categoryName != null and categoryName != ''">
and (first_category_name like #{categoryName} or second_category_name like #{categoryName})
5 years ago
</if>
<if test="fileType != null ">
and file_type = #{fileType}
</if>
<if test="state != null ">
and state = #{state}
</if>
</select>
5 years ago
</mapper>