CommentTemplateMapper.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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.ssj.service.mapper.CommentTemplateMapper">
  4. <select id="findByHomeworkPictureId" resultType="com.ssj.service.conch.parents.v1.dto.CommentTemplateDTO">
  5. select scon_comment_template.module, scon_comment_template.comment
  6. from scon_composition_comment,
  7. scon_comment_template
  8. where scon_composition_comment.comment_template_id = scon_comment_template.id
  9. and scon_composition_comment.homework_picture_id = #{homeworkPictureId}
  10. order by scon_comment_template.sort
  11. </select>
  12. <select id="countModuleAndLevelById" resultType="java.util.HashMap">
  13. select module, count(distinct scon_comment_template.`rank`) levelCount
  14. from scon_comment_template
  15. where id in
  16. <foreach collection="list" open="(" item="id" separator="," close=")">
  17. #{id}
  18. </foreach>
  19. group by module
  20. </select>
  21. <!--查询模板内容-->
  22. <select id="findCommentByIds" resultType="com.ssj.bean.sys.template.CommentTemplate">
  23. select * from scon_comment_template where id in
  24. <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
  25. #{id}
  26. </foreach>
  27. order by sort
  28. </select>
  29. <!--查询作文评语类型维度-->
  30. <select id="findCommentTypeAndModuleByGrade" resultType="com.ssj.bean.sys.template.CommentTemplate">
  31. select type, module from scon_comment_template where grade regexp #{grade}
  32. group by type, module
  33. order by sort
  34. </select>
  35. <!--查询作文评语类型维度详情, module数据有问题,好像有换行符-->
  36. <select id="findCommentDetailByTypeAndModule" resultType="com.ssj.bean.sys.template.CommentTemplate">
  37. select ct.id, ct.rank, ct.comment, if(cc.id is null, 0, 1) type from scon_comment_template ct
  38. left join scon_composition_comment cc
  39. on ct.id=cc.comment_template_id and cc.homework_picture_id=#{homeworkPictureId}
  40. where ct.grade regexp #{grade} and type=#{type}
  41. and ct.module regexp #{module} order by ct.sort
  42. </select>
  43. <select id="countSelectedCompositionComment" resultType="java.lang.Integer">
  44. select count(distinct selected.comment_template_id)
  45. from (select * from scon_composition_comment where homework_picture_id = #{homeworkPictureId}) selected
  46. join scon_comment_template
  47. on selected.comment_template_id = scon_comment_template.id and scon_comment_template.module = #{compositionCommentModule}
  48. </select>
  49. </mapper>