1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?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.document.mapper.TemplateCategoryMapper">
- <!-- 结果映射 -->
- <resultMap type="TemplateCategory" id="TemplateCategoryResult">
- <id property="id" column="id" />
- <result property="name" column="name" />
- <result property="intro" column="intro" />
- <result property="parent_id" column="parent_id" />
- <result property="create_time" column="create_time" />
- <result property="status" column="status" />
- </resultMap>
- <!-- 查询顶级分类列表 -->
- <select id="selectTopCategoryList" resultMap="TemplateCategoryResult">
- select * from dc_template_category
- <where>
- parent_id = '0'
- and status != 4
- <if test="name != null and name != ''">
- AND name like concat('%', #{name}, '%')
- </if>
- <if test="status != null">
- AND status = #{status}
- </if>
- </where>
- order by id desc
- </select>
- <!-- 查询子分类列表 -->
- <select id="selectChildCategoryList" resultMap="TemplateCategoryResult">
- select * from dc_template_category
- where parent_id = #{parent_id}
- and status != 4
- order by id desc
- </select>
- <!-- 查询子分类数量 -->
- <select id="selectChildCount" resultType="int">
- select count(*) from dc_template_category
- where parent_id = #{category_id}
- and status != 4
- </select>
- </mapper>
|