|
|
@@ -3,128 +3,161 @@
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.xunmei.core.safetyindex.mapper.CoreSafeMonthScoreMapper">
|
|
|
-
|
|
|
<resultMap type="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore" id="CoreSafeMonthScoreResult">
|
|
|
- <result property="id" column="id"/>
|
|
|
- <result property="levelId" column="level_id"/>
|
|
|
- <result property="orgId" column="org_id"/>
|
|
|
- <result property="dataYear" column="data_year"/>
|
|
|
- <result property="dataMonth" column="data_month"/>
|
|
|
- <result property="orgScore" column="org_score"/>
|
|
|
- <result property="releaseStatus" column="release_status"/>
|
|
|
- <result property="orgPath" column="org_path"/>
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="levelId" column="level_id"/>
|
|
|
+ <result property="orgId" column="org_id"/>
|
|
|
+ <result property="dataYear" column="data_year"/>
|
|
|
+ <result property="dataMonth" column="data_month"/>
|
|
|
+ <result property="orgScore" column="org_score"/>
|
|
|
+ <result property="releaseStatus" column="release_status"/>
|
|
|
+ <result property="orgPath" column="org_path"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectCoreSafeMonthScoreVo">
|
|
|
- select id, level_id, org_id, data_year, data_month, org_score, release_status, org_path
|
|
|
+ select id,
|
|
|
+ level_id,
|
|
|
+ org_id,
|
|
|
+ data_year,
|
|
|
+ data_month,
|
|
|
+ org_score,
|
|
|
+ release_status,
|
|
|
+ org_path
|
|
|
from core_safe_month_score
|
|
|
</sql>
|
|
|
|
|
|
- <select id="selectCoreSafeMonthScoreList" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore"
|
|
|
+ <select id="selectCoreSafeMonthScoreList"
|
|
|
+ parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore"
|
|
|
resultMap="CoreSafeMonthScoreResult">
|
|
|
<include refid="selectCoreSafeMonthScoreVo"/>
|
|
|
<where>
|
|
|
- <if test="levelId != null ">
|
|
|
- and level_id = #{levelId}
|
|
|
- </if>
|
|
|
- <if test="orgId != null ">
|
|
|
- and org_id = #{orgId}
|
|
|
- </if>
|
|
|
- <if test="dataYear != null ">
|
|
|
- and data_year = #{dataYear}
|
|
|
- </if>
|
|
|
- <if test="dataMonth != null ">
|
|
|
- and data_month = #{dataMonth}
|
|
|
- </if>
|
|
|
- <if test="orgScore != null ">
|
|
|
- and org_score = #{orgScore}
|
|
|
- </if>
|
|
|
- <if test="releaseStatus != null ">
|
|
|
- and release_status = #{releaseStatus}
|
|
|
- </if>
|
|
|
- <if test="orgPath != null and orgPath != ''">
|
|
|
- and org_path = #{orgPath}
|
|
|
- </if>
|
|
|
+ <if test="levelId != null ">
|
|
|
+ and level_id = #{levelId}
|
|
|
+ </if>
|
|
|
+ <if test="orgId != null ">
|
|
|
+ and org_id = #{orgId}
|
|
|
+ </if>
|
|
|
+ <if test="dataYear != null ">
|
|
|
+ and data_year = #{dataYear}
|
|
|
+ </if>
|
|
|
+ <if test="dataMonth != null ">
|
|
|
+ and data_month = #{dataMonth}
|
|
|
+ </if>
|
|
|
+ <if test="orgScore != null ">
|
|
|
+ and org_score = #{orgScore}
|
|
|
+ </if>
|
|
|
+ <if test="releaseStatus != null ">
|
|
|
+ and release_status = #{releaseStatus}
|
|
|
+ </if>
|
|
|
+ <if test="orgPath != null and orgPath != ''">
|
|
|
+ and org_path = #{orgPath}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectCoreSafeMonthScoreById" parameterType="Long"
|
|
|
resultMap="CoreSafeMonthScoreResult">
|
|
|
- <include refid="selectCoreSafeMonthScoreVo"/>
|
|
|
- where id = #{id}
|
|
|
+ <include refid="selectCoreSafeMonthScoreVo"/>
|
|
|
+ where id = #{id}
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertCoreSafeMonthScore" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore">
|
|
|
+ <insert id="insertCoreSafeMonthScore"
|
|
|
+ parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore">
|
|
|
insert into core_safe_month_score
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">id,
|
|
|
- </if>
|
|
|
- <if test="levelId != null">level_id,
|
|
|
- </if>
|
|
|
- <if test="orgId != null">org_id,
|
|
|
- </if>
|
|
|
- <if test="dataYear != null">data_year,
|
|
|
- </if>
|
|
|
- <if test="dataMonth != null">data_month,
|
|
|
- </if>
|
|
|
- <if test="orgScore != null">org_score,
|
|
|
- </if>
|
|
|
- <if test="releaseStatus != null">release_status,
|
|
|
- </if>
|
|
|
- <if test="orgPath != null">org_path,
|
|
|
- </if>
|
|
|
+ <if test="id != null">
|
|
|
+ id,
|
|
|
+ </if>
|
|
|
+ <if test="levelId != null">
|
|
|
+ level_id,
|
|
|
+ </if>
|
|
|
+ <if test="orgId != null">
|
|
|
+ org_id,
|
|
|
+ </if>
|
|
|
+ <if test="dataYear != null">
|
|
|
+ data_year,
|
|
|
+ </if>
|
|
|
+ <if test="dataMonth != null">
|
|
|
+ data_month,
|
|
|
+ </if>
|
|
|
+ <if test="orgScore != null">
|
|
|
+ org_score,
|
|
|
+ </if>
|
|
|
+ <if test="releaseStatus != null">
|
|
|
+ release_status,
|
|
|
+ </if>
|
|
|
+ <if test="orgPath != null">
|
|
|
+ org_path,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">#{id},
|
|
|
- </if>
|
|
|
- <if test="levelId != null">#{levelId},
|
|
|
- </if>
|
|
|
- <if test="orgId != null">#{orgId},
|
|
|
- </if>
|
|
|
- <if test="dataYear != null">#{dataYear},
|
|
|
- </if>
|
|
|
- <if test="dataMonth != null">#{dataMonth},
|
|
|
- </if>
|
|
|
- <if test="orgScore != null">#{orgScore},
|
|
|
- </if>
|
|
|
- <if test="releaseStatus != null">#{releaseStatus},
|
|
|
- </if>
|
|
|
- <if test="orgPath != null">#{orgPath},
|
|
|
- </if>
|
|
|
+ <if test="id != null">
|
|
|
+ #{id},
|
|
|
+ </if>
|
|
|
+ <if test="levelId != null">
|
|
|
+ #{levelId},
|
|
|
+ </if>
|
|
|
+ <if test="orgId != null">
|
|
|
+ #{orgId},
|
|
|
+ </if>
|
|
|
+ <if test="dataYear != null">
|
|
|
+ #{dataYear},
|
|
|
+ </if>
|
|
|
+ <if test="dataMonth != null">
|
|
|
+ #{dataMonth},
|
|
|
+ </if>
|
|
|
+ <if test="orgScore != null">
|
|
|
+ #{orgScore},
|
|
|
+ </if>
|
|
|
+ <if test="releaseStatus != null">
|
|
|
+ #{releaseStatus},
|
|
|
+ </if>
|
|
|
+ <if test="orgPath != null">
|
|
|
+ #{orgPath},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
- <update id="updateCoreSafeMonthScore" parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore">
|
|
|
+ <update id="updateCoreSafeMonthScore"
|
|
|
+ parameterType="com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore">
|
|
|
update core_safe_month_score
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="levelId != null">level_id =
|
|
|
- #{levelId},
|
|
|
- </if>
|
|
|
- <if test="orgId != null">org_id =
|
|
|
- #{orgId},
|
|
|
- </if>
|
|
|
- <if test="dataYear != null">data_year =
|
|
|
- #{dataYear},
|
|
|
- </if>
|
|
|
- <if test="dataMonth != null">data_month =
|
|
|
- #{dataMonth},
|
|
|
- </if>
|
|
|
- <if test="orgScore != null">org_score =
|
|
|
- #{orgScore},
|
|
|
- </if>
|
|
|
- <if test="releaseStatus != null">release_status =
|
|
|
- #{releaseStatus},
|
|
|
- </if>
|
|
|
- <if test="orgPath != null">org_path =
|
|
|
- #{orgPath},
|
|
|
- </if>
|
|
|
+ <if test="levelId != null">
|
|
|
+ level_id =
|
|
|
+ #{levelId},
|
|
|
+ </if>
|
|
|
+ <if test="orgId != null">
|
|
|
+ org_id =
|
|
|
+ #{orgId},
|
|
|
+ </if>
|
|
|
+ <if test="dataYear != null">
|
|
|
+ data_year =
|
|
|
+ #{dataYear},
|
|
|
+ </if>
|
|
|
+ <if test="dataMonth != null">
|
|
|
+ data_month =
|
|
|
+ #{dataMonth},
|
|
|
+ </if>
|
|
|
+ <if test="orgScore != null">
|
|
|
+ org_score =
|
|
|
+ #{orgScore},
|
|
|
+ </if>
|
|
|
+ <if test="releaseStatus != null">
|
|
|
+ release_status =
|
|
|
+ #{releaseStatus},
|
|
|
+ </if>
|
|
|
+ <if test="orgPath != null">
|
|
|
+ org_path =
|
|
|
+ #{orgPath},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteCoreSafeMonthScoreById" parameterType="Long">
|
|
|
delete
|
|
|
- from core_safe_month_score where id = #{id}
|
|
|
+ from core_safe_month_score
|
|
|
+ where id = #{id}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteCoreSafeMonthScoreByIds" parameterType="String">
|
|
|
@@ -133,4 +166,39 @@
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
+ <resultMap id="CoreSafeMonthScorePageVo"
|
|
|
+ type="com.xunmei.common.core.domain.safetyindex.vo.CoreSafeMonthScorePageVo">
|
|
|
+ <result column="org_id" property="orgId"/>
|
|
|
+ <result column="org_name" property="orgName"/>
|
|
|
+ <result column="data_month" property="dataMonth"/>
|
|
|
+ <result column="data_year" property="dataYear"/>
|
|
|
+ <result column="level_70_80" property="level_70_80"/>
|
|
|
+ <result column="level_80_90" property="level_80_90"/>
|
|
|
+ <result column="level_gt90" property="level_gt90"/>
|
|
|
+ <result column="level_lt70" property="level_lt70"/>
|
|
|
+ </resultMap>
|
|
|
+ <select id="selectPageData" resultMap="CoreSafeMonthScorePageVo">
|
|
|
+ SELECT q.org_id,
|
|
|
+ q.org_name,
|
|
|
+ q.data_year,
|
|
|
+ q.data_month,
|
|
|
+ max(if(q.level_id=1,q.size,0)) level_gt90,
|
|
|
+ max(if(q.level_id=2,q.size,0)) level_80_90,
|
|
|
+ max(if(q.level_id=3,q.size,0)) level_70_80,
|
|
|
+ max(if(q.level_id=4,q.size,0)) level_lt70
|
|
|
+ FROM (select m.org_id, m.org_name, m.level_id, m.data_year, m.data_month, count(1) size
|
|
|
+ from (select a.id org_id, a.`name` org_name, t.level_id, t.data_year, t.data_month
|
|
|
+ from (select id, name, path from sys_org where parent_id = #{request.orgId,jdbcType=BIGINT}) a
|
|
|
+ , (SELECT a.*, b.path from core_safe_month_score a, sys_org b where a.org_id = b.id and b.deleted = 0
|
|
|
+ <if test="request.date != null">
|
|
|
+ and a.data_year = #{request.dataYear,javaType=int}
|
|
|
+ and a.data_month = #{request.dataMonth,javaType=int}
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ where t.path LIKE CONCAT(a.path, '%')
|
|
|
+ ) m
|
|
|
+ GROUP BY m.org_id, m.org_name, m.level_id, m.data_year, m.data_month) q
|
|
|
+ WHERE q.data_year is not null
|
|
|
+ GROUP BY q.org_id, q.org_name, q.data_year, q.data_month
|
|
|
+ </select>
|
|
|
</mapper>
|