123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <?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.AssessMonthRecordMapper">
- <resultMap id="AssessDtoMap" type="com.zhyc.xps.lylc.dto.AssessMonthRecordDto">
- <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="year" property="year" jdbcType="BIGINT" />
- <result column="record_id" property="recordId" jdbcType="BIGINT" />
- <result column="month" property="month" jdbcType="BIGINT" />
- <result column="hos_score" property="hosScore" jdbcType="DOUBLE" />
- <result column="nhc_score" property="nhcScore" jdbcType="DOUBLE" />
- <result column="remark" property="remark" jdbcType="VARCHAR" />
- </resultMap>
- <!--基于ID查询-->
- <select id="getById" resultMap="AssessDtoMap">
- SELECT
- A.oc_id,
- A.story_id,
- A.target_id,
- B.target_title,
- B.target_code,
- A.item_id,
- C.item_title,
- C.item_code,
- A.point_id,
- D.point_content,
- D.point_code,
- A.record_id,
- A.year,
- A.month,
- A.hos_score,
- A.nhc_score,
- E.remark
- 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)
- LEFT join hos_assess_record AS E ON (A.oc_id = E.oc_id AND A.record_id = E.record_id)
- WHERE A.deleted_flag = 0
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- AND A.target_id = #{targetId ,jdbcType=BIGINT}
- AND A.item_id = #{itemId ,jdbcType=BIGINT}
- AND A.point_id = #{pointId ,jdbcType=BIGINT}
- AND A.year = #{year, jdbcType=BIGINT}
- AND A.month = #{month, jdbcType=BIGINT}
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="AssessDtoMap" >
- SELECT
- A.oc_id,
- A.story_id,
- A.target_id,
- B.target_title,
- B.target_code,
- A.item_id,
- C.item_title,
- C.item_code,
- A.point_id,
- D.point_code,
- D.point_content,
- A.record_id,
- A.year,
- A.month,
- A.hos_score,
- A.nhc_score,
- E.remark
- 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)
- LEFT join hos_assess_record AS E ON (A.oc_id = E.oc_id AND A.record_id = E.record_id)
- WHERE A.deleted_flag = 0
- <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>
- <if test="pointId != null">
- AND A.point_id = #{pointId ,jdbcType=BIGINT}
- </if>
- <if test="year != null">
- AND A.year = #{year ,jdbcType=BIGINT}
- </if>
- <if test="month != null">
- AND A.month = #{month ,jdbcType=BIGINT}
- </if>
- ORDER BY A.story_id, A.target_id, A.item_id, D.sort_no
- </select>
- <insert id="create" parameterType="com.zhyc.xps.lylc.entity.Assess">
- INSERT INTO hos_assess_month_record
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="storyId != null">
- story_id,
- </if>
- <if test="targetId != null">
- target_id,
- </if>
- <if test="itemId != null">
- item_id,
- </if>
- <if test="pointId != null">
- point_id,
- </if>
- <if test="recordId != null">
- record_id,
- </if>
- <if test="year != null">
- year,
- </if>
- <if test="month != null">
- month,
- </if>
- <if test="nhcScore != null">
- nhc_score,
- </if>
- <if test="hosScore != null">
- hos_score,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId,jdbcType=BIGINT},
- </if>
- <if test="storyId != null">
- #{storyId ,jdbcType=BIGINT},
- </if>
- <if test="targetId != null">
- #{targetId ,jdbcType=BIGINT},
- </if>
- <if test="itemId != null">
- #{itemId ,jdbcType=BIGINT},
- </if>
- <if test="pointId != null">
- #{pointId ,jdbcType=BIGINT},
- </if>
- <if test="recordId != null">
- #{recordId ,jdbcType=BIGINT},
- </if>
- <if test="year != null">
- #{year ,jdbcType=BIGINT},
- </if>
- <if test="month != null">
- #{month ,jdbcType=BIGINT},
- </if>
- <if test="nhcScore != null">
- #{nhcScore ,jdbcType=DOUBLE},
- </if>
- <if test="hosScore != null">
- #{hosScore ,jdbcType=DOUBLE},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.lylc.entity.Assess">
- UPDATE hos_assess_month_record
- <trim suffixOverrides=",">
- <set>
- <if test="recordId != null">
- record_id = #{recordId ,jdbcType=BIGINT},
- </if>
- <if test="nhcScore != null">
- nhc_score = #{nhcScore ,jdbcType=DOUBLE},
- </if>
- <if test="hosScore != null">
- hos_score = #{hosScore ,jdbcType=DOUBLE},
- </if>
- <if test="updatedBy != null ">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE oc_id = #{ocId ,jdbcType=BIGINT}
- AND story_id = #{storyId, jdbcType=BIGINT}
- AND target_id = #{targetId, jdbcType=BIGINT}
- AND item_id = #{itemId, jdbcType=BIGINT}
- AND point_id = #{pointId, jdbcType=BIGINT}
- AND year = #{year, jdbcType=BIGINT}
- AND month = #{month, jdbcType=BIGINT}
- </update>
- <!--删除-->
- <update id="delete" parameterType="java.util.Map">
- UPDATE hos_assess_month_record
- <trim suffixOverrides=",">
- <set>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag,jdbcType=BIGINT},
- </if>
- <if test="deletedTime != null">
- deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
- </if>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE oc_id = #{ocId ,jdbcType=BIGINT}
- <if test="storyId != null">
- AND story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- <if test="targetId != null">
- AND target_id = #{targetId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND item_id = #{itemId ,jdbcType=BIGINT},
- </if>
- <if test="pointId != null">
- AND point_id = #{pointId ,jdbcType=BIGINT}
- </if>
- <if test="recordId != null">
- AND record_id = #{recordId ,jdbcType=BIGINT}
- </if>
- </update>
- </mapper>
|