123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?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.zhyc.xps.hos.mapper.HosStatisMapper">
- <resultMap id="StoryMonthScoreCounterResultMap" type="com.zhyc.xps.hos.vo.StoryMonthScoreCounterVo">
- <result column="story_id" property="storyId" jdbcType="BIGINT" />
- <result column="year" property="year" jdbcType="BIGINT" />
- <result column="m1" property="m1" jdbcType="FLOAT" />
- <result column="m2" property="m2" jdbcType="FLOAT" />
- <result column="m3" property="m3" jdbcType="FLOAT" />
- <result column="m4" property="m4" jdbcType="FLOAT" />
- <result column="m5" property="m5" jdbcType="FLOAT" />
- <result column="m6" property="m6" jdbcType="FLOAT" />
- <result column="m7" property="m7" jdbcType="FLOAT" />
- <result column="m8" property="m8" jdbcType="FLOAT" />
- <result column="m9" property="m9" jdbcType="FLOAT" />
- <result column="m10" property="m10" jdbcType="FLOAT" />
- <result column="m11" property="m11" jdbcType="FLOAT" />
- <result column="m12" property="m12" jdbcType="FLOAT" />
- </resultMap>
- <select id="monthScoreCounterByList" resultMap="StoryMonthScoreCounterResultMap">
- SELECT
- R.story_id,
- R.year,
- SUM(CASE R.month WHEN 1 THEN R.hos_score else 0 end) AS m1,
- SUM(CASE R.month WHEN 2 THEN R.hos_score else 0 end) AS m2,
- SUM(CASE R.month WHEN 3 THEN R.hos_score else 0 end) AS m3,
- SUM(CASE R.month WHEN 4 THEN R.hos_score else 0 end) AS m4,
- SUM(CASE R.month WHEN 5 THEN R.hos_score else 0 end) AS m5,
- SUM(CASE R.month WHEN 6 THEN R.hos_score else 0 end) AS m6,
- SUM(CASE R.month WHEN 7 THEN R.hos_score else 0 end) AS m7,
- SUM(CASE R.month WHEN 8 THEN R.hos_score else 0 end) AS m8,
- SUM(CASE R.month WHEN 9 THEN R.hos_score else 0 end) AS m9,
- SUM(CASE R.month WHEN 10 THEN R.hos_score else 0 end) AS m10,
- SUM(CASE R.month WHEN 11 THEN R.hos_score else 0 end) AS m11,
- SUM(CASE R.month WHEN 12 THEN R.hos_score else 0 end) AS m12
- FROM hos_assess_month_record AS R
- WHERE R.deleted_flag = 0
- AND R.oc_id = #{ocId}
- AND R.year = #{year}
- Group By R.story_id, R.year
- </select>
- <select id="monthScoreCounterById" parameterType="java.util.Map" resultType="com.zhyc.xps.hos.vo.StoryMonthScoreCounterVo">
- SELECT
- R.story_id,
- R.year,
- SUM(CASE R.month WHEN 1 THEN R.hos_score else 0 end) AS m1,
- SUM(CASE R.month WHEN 2 THEN R.hos_score else 0 end) AS m2,
- SUM(CASE R.month WHEN 3 THEN R.hos_score else 0 end) AS m3,
- SUM(CASE R.month WHEN 4 THEN R.hos_score else 0 end) AS m4,
- SUM(CASE R.month WHEN 5 THEN R.hos_score else 0 end) AS m5,
- SUM(CASE R.month WHEN 6 THEN R.hos_score else 0 end) AS m6,
- SUM(CASE R.month WHEN 7 THEN R.hos_score else 0 end) AS m7,
- SUM(CASE R.month WHEN 8 THEN R.hos_score else 0 end) AS m8,
- SUM(CASE R.month WHEN 9 THEN R.hos_score else 0 end) AS m9,
- SUM(CASE R.month WHEN 10 THEN R.hos_score else 0 end) AS m10,
- SUM(CASE R.month WHEN 11 THEN R.hos_score else 0 end) AS m11,
- SUM(CASE R.month WHEN 12 THEN R.hos_score else 0 end) AS m12
- FROM hos_assess_month_record AS R
- WHERE R.deleted_flag = 0
- AND R.oc_id = #{ocId}
- AND R.year = #{year}
- AND R.story_id = #{storyId}
- Group By R.story_id, R.year
- </select>
- <resultMap id="StoryMonthScoreResultMap" type="com.zhyc.xps.hos.vo.StoryMonthScoreVo">
- <result column="story_id" property="storyId" jdbcType="BIGINT" />
- <result column="year" property="year" jdbcType="BIGINT" />
- <result column="month" property="month" jdbcType="BIGINT" />
- <result column="nhc_score" property="nhcScore" jdbcType="FLOAT" />
- <result column="hos_score" property="hosScore" jdbcType="FLOAT" />
- </resultMap>
- <select id="monthScoreByList" resultMap="StoryMonthScoreResultMap">
- SELECT
- R.story_id,
- R.year,
- R.month,
- ROUND(SUM(R.hos_score), 1) AS hos_score,
- ROUND(SUM(R.nhc_score), 1) AS nhc_score
- FROM hos_assess_month_record AS R
- WHERE R.deleted_flag = 0
- <if test="ocId != null">
- AND R.oc_id = #{ocId}
- </if>
- <if test="year != null">
- AND R.year = #{year}
- </if>
- <if test="month != null">
- AND R.month = #{month}
- </if>
- <if test="storyId != null">
- AND R.story_id = #{storyId}
- </if>
- GROUP BY R.story_id, R.year, R.month
- </select>
- <select id="monthScoreById" parameterType="java.util.Map" resultMap="StoryMonthScoreResultMap">
- SELECT
- R.story_id,
- R.year,
- R.month,
- ROUND(SUM(R.hos_score),1) AS hos_score,
- ROUND(SUM(R.nhc_score),1) AS nhc_score
- FROM hos_assess_month_record AS R
- WHERE R.deleted_flag = 0
- AND R.oc_id = #{ocId}
- AND R.year = #{year}
- AND R.month = #{month}
- AND R.story_id = #{storyId}
- GROUP BY R.story_id, R.year, R.month
- </select>
- </mapper>
|