ReportSectionTemplateMapper.xml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.dayou.mapper.ReportSectionTemplateMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.dayou.entity.ReportSectionTemplate">
  6. <result column="id" property="id" />
  7. <result column="deleted" property="deleted" />
  8. <result column="created" property="created" />
  9. <result column="modified" property="modified" />
  10. <result column="headline_id" property="headlineId" />
  11. <result column="section" property="section" />
  12. <result column="name" property="name" />
  13. <result column="user_id" property="userId" />
  14. <result column="headline_ids" property="headlineIds" />
  15. </resultMap>
  16. <!-- 通用查询结果列 -->
  17. <sql id="Base_Column_List">
  18. id,
  19. deleted,
  20. created,
  21. modified,
  22. headline_id, section, name, user_id,headline_ids
  23. </sql>
  24. <select id="getPage" parameterType="com.dayou.vo.HeadlineSectionVO" resultType="com.dayou.vo.HeadlineSectionVO">
  25. SELECT
  26. rs.id,
  27. rs.name,
  28. concat( rh.headline_num, ' ', rh.headline ) AS reportHeadline,
  29. xrh.headline as reportType,
  30. rs.section,
  31. u.name as userName,
  32. rs.created
  33. FROM
  34. report_headline rh left join report_section_template rs on rh.id = rs.headline_id
  35. left join report_headline xrh on xrh.id = rh.root_id
  36. left join user u on u.id = rs.user_id
  37. WHERE
  38. rh.deleted = 0 and rs.deleted = 0
  39. <if test="section!=null and section.headlineId!=null">
  40. and rs.headline_Id = #{section.headlineId}
  41. </if>
  42. <if test="section!=null and section.name!=null and section.name!= ''">
  43. and rs.name like concat('%',#{section.name},'%')
  44. </if>
  45. order by rs.id desc
  46. </select>
  47. </mapper>