123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?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.ssj.service.mapper.CommentTemplateMapper">
- <select id="findByHomeworkPictureId" resultType="com.ssj.service.conch.parents.v1.dto.CommentTemplateDTO">
- select scon_comment_template.module, scon_comment_template.comment
- from scon_composition_comment,
- scon_comment_template
- where scon_composition_comment.comment_template_id = scon_comment_template.id
- and scon_composition_comment.homework_picture_id = #{homeworkPictureId}
- order by scon_comment_template.sort
- </select>
- <select id="countModuleAndLevelById" resultType="java.util.HashMap">
- select module, count(distinct scon_comment_template.`rank`) levelCount
- from scon_comment_template
- where id in
- <foreach collection="list" open="(" item="id" separator="," close=")">
- #{id}
- </foreach>
- group by module
- </select>
- <!--查询模板内容-->
- <select id="findCommentByIds" resultType="com.ssj.bean.sys.template.CommentTemplate">
- select * from scon_comment_template where id in
- <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- order by sort
- </select>
- <!--查询作文评语类型维度-->
- <select id="findCommentTypeAndModuleByGrade" resultType="com.ssj.bean.sys.template.CommentTemplate">
- select type, module from scon_comment_template where grade regexp #{grade}
- group by type, module
- order by sort
- </select>
- <!--查询作文评语类型维度详情, module数据有问题,好像有换行符-->
- <select id="findCommentDetailByTypeAndModule" resultType="com.ssj.bean.sys.template.CommentTemplate">
- select ct.id, ct.rank, ct.comment, if(cc.id is null, 0, 1) type from scon_comment_template ct
- left join scon_composition_comment cc
- on ct.id=cc.comment_template_id and cc.homework_picture_id=#{homeworkPictureId}
- where ct.grade regexp #{grade} and type=#{type}
- and ct.module regexp #{module} order by ct.sort
- </select>
- <select id="countSelectedCompositionComment" resultType="java.lang.Integer">
- select count(distinct selected.comment_template_id)
- from (select * from scon_composition_comment where homework_picture_id = #{homeworkPictureId}) selected
- join scon_comment_template
- on selected.comment_template_id = scon_comment_template.id and scon_comment_template.module = #{compositionCommentModule}
- </select>
- </mapper>
|