123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <?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.lylc.mapper.AssessMapper">
- <resultMap id="AssessDtoMap" type="com.zhyc.xps.lylc.dto.AssessDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" />
- <result column="story_id" property="storyId" jdbcType="BIGINT" />
- <result column="target_id" property="targetId" jdbcType="BIGINT" />
- <result column="target_title" property="targetTitle" jdbcType="VARCHAR" />
- <result column="target_code" property="targetCode" jdbcType="VARCHAR" />
- <result column="item_id" property="itemId" jdbcType="BIGINT" />
- <result column="item_title" property="itemTitle" jdbcType="VARCHAR" />
- <result column="item_code" property="itemCode" jdbcType="VARCHAR" />
- <result column="point_id" property="pointId" jdbcType="BIGINT" />
- <result column="point_content" property="pointContent" jdbcType="VARCHAR" />
- <result column="point_code" property="pointCode" jdbcType="VARCHAR" />
- <result column="point_score" property="pointScore" jdbcType="FLOAT" />
- <result column="record_id" property="recordId" jdbcType="BIGINT" />
- <result column="year" property="year" jdbcType="BIGINT" />
- <result column="month" property="month" jdbcType="BIGINT" />
- <result column="hos_score" property="hosScore" jdbcType="FLOAT" />
- <result column="nhc_score" property="nhcScore" jdbcType="FLOAT" />
- <result column="is_assessed" property="isAssessed" jdbcType="BIGINT" />
- <result column="assess_time" property="assessTime" jdbcType="DATE" />
- <result column="remark" property="remark" jdbcType="VARCHAR" />
- <result column="sort_no" property="sortNo" jdbcType="BIGINT" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="AssessDto_Cols">
- A.story_id,
- B.story_title,
- A.target_id,
- C.target_title,
- A.item_id,
- D.item_title,
- D.item_code,
- A.point_id,
- A.point_code,
- A.point_content,
- A.point_score,
- A.score_criterion,
- E.record_id,
- E.year,
- E.month,
- IFNULL(E.hos_score, 0) AS hos_score,
- IFNULL(CASE WHEN E.hos_score >= 0 THEN 1 ELSE 0 END, 0) AS is_assessed,
- E.assess_time
- </sql>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="AssessDtoMap" >
- SELECT
- <include refid="AssessDto_Cols"/>
- FROM assess_story_target_item_point AS A
- LEFT JOIN assess_story AS B ON (A.story_id = B.story_id)
- LEFT JOIN assess_story_target AS C ON (A.story_id = C.story_id AND A.target_id = C.target_id)
- LEFT JOIN assess_story_target_item AS D ON (A.story_id = D.story_id AND A.target_id = D.target_id AND A.item_id = D.item_id)
- LEFT JOIN (
- SELECT
- M.oc_id,
- M.story_id,
- M.target_id,
- M.item_id,
- M.point_id,
- M.year,
- M.month,
- M.record_id,
- M.hos_score,
- R.assess_time
- FROM hos_assess_month_record AS M
- LEFT JOIN hos_assess_record AS R ON (M.oc_id = R.oc_id
- AND M.story_id = R.story_id
- AND M.target_id = R.target_id
- AND M.item_id = R.item_id
- AND M.point_id = R.point_id
- AND M.record_id = R.record_id)
- WHERE M.oc_id = #{ocId ,jdbcType=BIGINT}
- AND M.year = #{year ,jdbcType=BIGINT}
- AND M.month = #{month ,jdbcType=BIGINT}
- AND M.story_id = #{storyId ,jdbcType=BIGINT}
- GROUP BY M.oc_id, M.story_id, M.target_id, M.item_id, M.point_id
- ) AS E ON (A.story_id= E.story_id AND A.target_id = E.target_id AND A.item_id= E.item_id AND A.point_id=E.point_id)
- WHERE A.deleted_flag = 0
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- <if test="targetId != null">
- AND A.target_id = #{targetId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND A.item_id = #{itemId ,jdbcType=BIGINT}
- </if>
- ORDER BY A.story_id, A.target_id, A.item_id, D.sort_no
- </select>
- <!--列表查询-->
- <select id="getById" resultMap="AssessDtoMap" >
- SELECT
- <include refid="AssessDto_Cols"/>
- FROM assess_story_target_item_point AS A
- LEFT JOIN assess_story AS B ON (A.story_id = B.story_id)
- LEFT JOIN assess_story_target AS C ON (A.story_id = C.story_id AND A.target_id = C.target_id)
- LEFT JOIN assess_story_target_item AS D ON (A.story_id = D.story_id AND A.target_id = D.target_id AND A.item_id = D.item_id)
- LEFT JOIN (
- SELECT
- M.oc_id,
- M.story_id,
- M.target_id,
- M.item_id,
- M.point_id,
- M.year AS year,
- M.month AS month,
- M.record_id,
- M.hos_score,
- R.assess_time
- FROM hos_assess_month_record AS M
- LEFT JOIN hos_assess_record AS R ON (M.oc_id = R.oc_id
- AND M.story_id = R.story_id
- AND M.target_id = R.target_id
- AND M.item_id = R.item_id
- AND M.point_id = R.point_id
- AND M.record_id = R.record_id)
- WHERE M.oc_id = #{ocId ,jdbcType=BIGINT}
- AND M.year = #{year ,jdbcType=BIGINT}
- AND M.month = #{month ,jdbcType=BIGINT}
- GROUP BY M.oc_id, M.story_id, M.target_id, M.item_id, M.point_id
- ) AS E ON (A.story_id= E.story_id AND A.target_id = E.target_id AND A.item_id= E.item_id AND A.point_id=E.point_id)
- WHERE A.deleted_flag = 0
- <if test="storyId != null">
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- <if test="targetId != null">
- AND A.target_id = #{targetId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND A.item_id = #{itemId ,jdbcType=BIGINT}
- </if>
- <if test="pointId != null">
- AND A.point_id = #{pointId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--列表查询-->
- <select id="getImprovingByList" parameterType="java.util.Map" resultMap="AssessDtoMap" >
- SELECT
- A.story_id,
- A.target_id,
- B.target_title,
- A.item_id,
- C.item_title,
- C.item_code,
- A.point_id,
- D.point_code,
- D.point_content,
- D.score_criterion,
- A.record_id,
- A.year,
- A.month,
- D.point_score,
- A.hos_score
- FROM hos_assess_month_record AS A
- LEFT JOIN assess_story_target AS B on (A.story_id=B.story_id AND A.target_id=B.target_id)
- LEFT join assess_story_target_item AS C on (A.story_id=C.story_id AND A.target_id=C.target_id AND A.item_id=C.item_id)
- LEFT join assess_story_target_item_point AS D on (A.story_id=D.story_id AND A.target_id=D.target_id AND A.item_id=D.item_id AND A.point_id= D.point_id)
- WHERE A.deleted_flag = 0
- <if test="year != null">
- AND A.year = #{year ,jdbcType=BIGINT}
- </if>
- <if test="month != null">
- AND A.month = #{month ,jdbcType=BIGINT}
- </if>
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="storyId != null">
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- <if test="targetId != null">
- AND A.target_id = #{targetId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND A.item_id = #{itemId ,jdbcType=BIGINT}
- </if>
- AND D.point_score * 0.60 > A.hos_score
- ORDER BY A.story_id, A.target_id, A.item_id, A.hos_score DESC
- </select>
- </mapper>
|