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.

30 lines
1.3 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.bsd.cases.mapper.CaseContentMapper">
<select id="searchBak" resultType="com.bsd.cases.vo.CaseContentBakVo">
SELECT a.id,a.content_title,a.url,a.content,a.category_id,a.create_date_time,a.update_date_time,a.create_by,a.update_by,
a.state,a.`level2_id`,ccy.parent_id as `level1_id`
FROM (select cc.`id`,cc.`content_title`,cc.`url`,cc.`content`,cc.`category_id`,ccy.`name` as level3_name,
cc.`create_date_time`,cc.`update_date_time`,cc.`create_by`,cc.`update_by`,cc.`state`,ccy.parent_id as level2_id
FROM case_content cc
left join case_category ccy
on ccy.id = cc.category_id) a
left join case_category ccy
on a.level2_id = ccy.id
WHERE
1 = 1
<if test="level1Id != null">
AND ccy.parent_id = #{level1Id}
</if>
<if test="level2Id != null">
AND a.`level2_id` = #{level2Id}
</if>
<if test="level3Id != null">
and a.category_id = #{level3Id}
</if>
<if test="name != null and name != ''">
a.`content_title` LIKE CONCAT('%',#{name},'%')
</if>
</select>
</mapper>