|
@@ -17,13 +17,13 @@
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <select id="getOne" parameterType="java.lang.Long" resultMap="BaseResultMap" >
|
|
|
|
|
|
|
+ <select id="getOne" parameterType="java.lang.Long" resultType="com.xintong.visualinspection.bean.UserStatistic" >
|
|
|
SELECT *
|
|
SELECT *
|
|
|
FROM check_statistics
|
|
FROM check_statistics
|
|
|
WHERE id = #{id}
|
|
WHERE id = #{id}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="getByUser" parameterType="com.xintong.visualinspection.bean.UserStatistic" resultMap="BaseResultMap" >
|
|
|
|
|
|
|
+ <select id="getByUser" parameterType="com.xintong.visualinspection.bean.UserStatistic" resultType="com.xintong.visualinspection.bean.UserStatistic" >
|
|
|
SELECT *
|
|
SELECT *
|
|
|
FROM check_statistics
|
|
FROM check_statistics
|
|
|
WHERE user_id = #{user_id} and period_id = #{period_id}
|
|
WHERE user_id = #{user_id} and period_id = #{period_id}
|
|
@@ -63,27 +63,47 @@
|
|
|
SET
|
|
SET
|
|
|
<if test="user_score != null">user_score = #{user_score},</if>
|
|
<if test="user_score != null">user_score = #{user_score},</if>
|
|
|
<if test="user_check_num != null">user_check_num = #{user_check_num},</if>
|
|
<if test="user_check_num != null">user_check_num = #{user_check_num},</if>
|
|
|
- <if test="user_ranking_c != null">user_ranking_c = #{user_ranking_c},</if>
|
|
|
|
|
- <if test="user_ranking_d != null">user_ranking_d = #{user_ranking_d},</if>
|
|
|
|
|
- <if test="user_ranking_s != null">user_ranking_s = #{user_ranking_s},</if>
|
|
|
|
|
|
|
+ <if test="user_total_score != null">user_total_score = #{user_total_score},</if>
|
|
|
|
|
+ <if test="user_other_a_check_score != null">user_other_a_check_score = #{user_other_a_check_score},</if>
|
|
|
|
|
+ <if test="user_other_a_check_num != null">user_other_a_check_num = #{user_other_a_check_num},</if>
|
|
|
|
|
+ <if test="user_other_s_check_score != null">user_other_s_check_score = #{user_other_s_check_score},</if>
|
|
|
|
|
+ <if test="user_other_s_check_num != null">user_other_s_check_num = #{user_other_s_check_num},</if>
|
|
|
|
|
+ <if test="user_other_t_check_score != null">user_other_t_check_score = #{user_other_t_check_score},</if>
|
|
|
|
|
+ <if test="user_other_t_check_num != null">user_other_t_check_num = #{user_other_t_check_num},</if>
|
|
|
|
|
+ <if test="user_other_x_check_score != null">user_other_x_check_score = #{user_other_x_check_score},</if>
|
|
|
|
|
+ <if test="user_other_x_check_num != null">user_other_x_check_num = #{user_other_x_check_num},</if>
|
|
|
<if test="dept_id != null">dept_id = #{dept_id}</if>
|
|
<if test="dept_id != null">dept_id = #{dept_id}</if>
|
|
|
WHERE
|
|
WHERE
|
|
|
user_id = #{user_id} and period_id = #{period_id}
|
|
user_id = #{user_id} and period_id = #{period_id}
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
+
|
|
|
<sql id="insertc">
|
|
<sql id="insertc">
|
|
|
INSERT INTO
|
|
INSERT INTO
|
|
|
check_statistics
|
|
check_statistics
|
|
|
- (user_id,period_id,user_score,user_check_num,user_ranking_c,user_ranking_d,user_ranking_s,dept_id)
|
|
|
|
|
|
|
+ (user_id,period_id,user_score,user_check_num,user_total_score,user_other_a_check_score,user_other_a_check_num,user_other_s_check_score,user_other_s_check_num,user_other_t_check_score,user_other_t_check_num,user_other_x_check_score,user_other_x_check_num,dept_id)
|
|
|
VALUES
|
|
VALUES
|
|
|
- (#{user_id}, #{period_id},#{user_score},#{user_check_num},#{user_ranking_c},#{user_ranking_d},#{user_ranking_s},#{dept_id})
|
|
|
|
|
|
|
+ (#{user_id}, #{period_id},#{user_score},#{user_check_num},#{user_total_score},#{user_other_a_check_score},#{user_other_a_check_num},#{user_other_s_check_score},#{user_other_s_check_num},#{user_other_t_check_score},#{user_other_t_check_num},#{user_other_x_check_score},#{user_other_x_check_num},#{dept_id})
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <select id="selectlimituser" parameterType="com.xintong.visualinspection.bean.UserStatistic" resultMap="BaseResultMap">
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <select id="selectlimituser" parameterType="com.xintong.visualinspection.bean.UserStatistic" resultType="com.xintong.visualinspection.bean.UserStatistic">
|
|
|
select c.* from (
|
|
select c.* from (
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="sctype != null && sctype != '' && sctype == 2 ">
|
|
|
|
|
+ <include refid="selectc"/>
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ <include refid="selectcwxfw"/>
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ ) c where c.user_id in ( select d.user_id from (select p.user_id,count(user_id) as count from ( <choose>
|
|
|
|
|
+ <when test="sctype != null && sctype != '' && sctype == 2 ">
|
|
|
<include refid="selectc"/>
|
|
<include refid="selectc"/>
|
|
|
- ) c where c.user_id in ( select d.user_id from (select p.user_id,count(user_id) as count from (<include refid="selectc"/>) p GROUP BY p.user_id ) d where d.count >=#{limitnumber} )
|
|
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ <include refid="selectcwxfw"/>
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>) p GROUP BY p.user_id ) d where d.count >=#{limitnumber} )
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -93,10 +113,32 @@
|
|
|
FROM
|
|
FROM
|
|
|
(
|
|
(
|
|
|
SELECT
|
|
SELECT
|
|
|
- a.*,
|
|
|
|
|
|
|
+ a.*
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ *
|
|
|
|
|
+ FROM
|
|
|
|
|
+ check_statistics
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ period_id >= #{startperiod_id}
|
|
|
|
|
+ AND period_id <= #{endperiod_id} AND user_check_num > 0
|
|
|
|
|
+ ) a
|
|
|
|
|
+ ) b
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ b.user_total_score >=#{limitscore} and b.user_total_score <= #{limitscore2} and b.user_check_num>=6
|
|
|
|
|
+ GROUP BY user_id ,period_id
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="selectcwxfw">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ b.*
|
|
|
|
|
+ FROM
|
|
|
(
|
|
(
|
|
|
- 1000- a.user_score / ( a.user_check_num * 1.00 )
|
|
|
|
|
- ) AS user_total_score
|
|
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.*,
|
|
|
|
|
+ (1000- a.user_score / ( a.user_check_num * 1.00 )) AS user_total_score1
|
|
|
FROM
|
|
FROM
|
|
|
(
|
|
(
|
|
|
SELECT
|
|
SELECT
|
|
@@ -109,7 +151,7 @@
|
|
|
) a
|
|
) a
|
|
|
) b
|
|
) b
|
|
|
WHERE
|
|
WHERE
|
|
|
- b.user_total_score >=#{limitscore} and b.user_total_score <= #{limitscore2}
|
|
|
|
|
|
|
+ b.user_total_score1 >=#{limitscore} and b.user_total_score1 <= #{limitscore2} and b.user_check_num>=6
|
|
|
GROUP BY user_id ,period_id
|
|
GROUP BY user_id ,period_id
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|