TemplateCategoryMapper.xml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.document.mapper.TemplateCategoryMapper">
  6. <!-- 结果映射 -->
  7. <resultMap type="TemplateCategory" id="TemplateCategoryResult">
  8. <id property="id" column="id" />
  9. <result property="name" column="name" />
  10. <result property="intro" column="intro" />
  11. <result property="parent_id" column="parent_id" />
  12. <result property="create_time" column="create_time" />
  13. <result property="status" column="status" />
  14. </resultMap>
  15. <!-- 查询顶级分类列表 -->
  16. <select id="selectTopCategoryList" resultMap="TemplateCategoryResult">
  17. select * from dc_template_category
  18. <where>
  19. parent_id = '0'
  20. and status != 4
  21. <if test="name != null and name != ''">
  22. AND name like concat('%', #{name}, '%')
  23. </if>
  24. <if test="status != null">
  25. AND status = #{status}
  26. </if>
  27. </where>
  28. order by id desc
  29. </select>
  30. <!-- 查询子分类列表 -->
  31. <select id="selectChildCategoryList" resultMap="TemplateCategoryResult">
  32. select * from dc_template_category
  33. where parent_id = #{parent_id}
  34. and status != 4
  35. order by id desc
  36. </select>
  37. <!-- 查询子分类数量 -->
  38. <select id="selectChildCount" resultType="int">
  39. select count(*) from dc_template_category
  40. where parent_id = #{category_id}
  41. and status != 4
  42. </select>
  43. </mapper>