|  | @@ -13,6 +13,7 @@
 | 
	
		
			
				|  |  |  		<result column="total_num_" property="totalNum" />
 | 
	
		
			
				|  |  |  		<result column="activate_num_" property="activateNum" />
 | 
	
		
			
				|  |  |  		<result column="percent_" property="percent" />
 | 
	
		
			
				|  |  | +		<result column="data_type_" property="dataType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  |  		<result column="create_time_" property="createTime" />
 | 
	
		
			
				|  |  |  		<result column="update_time_" property="updateTime" />
 | 
	
		
			
				|  |  |  	</resultMap>
 | 
	
	
		
			
				|  | @@ -34,8 +35,26 @@
 | 
	
		
			
				|  |  |  		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 | 
	
		
			
				|  |  |  		</selectKey>
 | 
	
		
			
				|  |  |  		-->
 | 
	
		
			
				|  |  | -		INSERT INTO index_base_month_data (id_,month_,organ_id_,total_num_,activate_num_,percent_,create_time_,update_time_)
 | 
	
		
			
				|  |  | -		VALUES(#{id},#{month},#{organId},#{totalNum},#{activateNum},#{percent},NOW(),NOW())
 | 
	
		
			
				|  |  | +		INSERT INTO index_base_month_data (month_,organ_id_,total_num_,activate_num_,percent_,data_type_,create_time_,update_time_)
 | 
	
		
			
				|  |  | +		VALUES(#{month},#{organId},#{totalNum},#{activateNum},#{percent},#{dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},NOW(),NOW())
 | 
	
		
			
				|  |  | +	</insert>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<insert id="batchInsertWithDataType" parameterType="com.ym.mec.biz.dal.entity.IndexBaseMonthData" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 | 
	
		
			
				|  |  | +		INSERT INTO index_base_month_data (month_,organ_id_,total_num_,activate_num_,percent_,data_type_,create_time_,update_time_)
 | 
	
		
			
				|  |  | +		VALUES
 | 
	
		
			
				|  |  | +		<foreach collection="datas" item="data" separator=",">
 | 
	
		
			
				|  |  | +			(#{data.month},#{data.organId},#{data.totalNum},#{data.activateNum},#{data.percent},
 | 
	
		
			
				|  |  | +			#{dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},NOW(),NOW())
 | 
	
		
			
				|  |  | +		</foreach>
 | 
	
		
			
				|  |  | +	</insert>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.IndexBaseMonthData" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 | 
	
		
			
				|  |  | +		INSERT INTO index_base_month_data (month_,organ_id_,total_num_,activate_num_,percent_,data_type_,create_time_,update_time_)
 | 
	
		
			
				|  |  | +		VALUES
 | 
	
		
			
				|  |  | +		<foreach collection="datas" item="data" separator=",">
 | 
	
		
			
				|  |  | +			(#{data.month},#{data.organId},#{data.totalNum},#{data.activateNum},#{data.percent},
 | 
	
		
			
				|  |  | +			#{data.dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},NOW(),NOW())
 | 
	
		
			
				|  |  | +		</foreach>
 | 
	
		
			
				|  |  |  	</insert>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<!-- 根据主键查询一条记录 -->
 | 
	
	
		
			
				|  | @@ -59,6 +78,9 @@
 | 
	
		
			
				|  |  |  		<if test="month != null">
 | 
	
		
			
				|  |  |  			month_ = #{month},
 | 
	
		
			
				|  |  |  		</if>
 | 
	
		
			
				|  |  | +		<if test="dataType != null">
 | 
	
		
			
				|  |  | +			data_type_ = #{dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | +		</if>
 | 
	
		
			
				|  |  |  		update_time_ = NOW()
 | 
	
		
			
				|  |  |  	</set> WHERE id_ = #{id}
 | 
	
		
			
				|  |  |  	</update>
 | 
	
	
		
			
				|  | @@ -68,6 +90,17 @@
 | 
	
		
			
				|  |  |  		DELETE FROM index_base_month_data WHERE id_ = #{id}
 | 
	
		
			
				|  |  |  	</delete>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +	<delete id="deleteWithMonthAndType">
 | 
	
		
			
				|  |  | +		DELETE FROM index_base_month_data
 | 
	
		
			
				|  |  | +		WHERE DATE_FORMAT(month_, '%Y-%m-%d') IN
 | 
	
		
			
				|  |  | +		<foreach collection="months" item="month" open="(" close=")" separator=",">
 | 
	
		
			
				|  |  | +			#{month}
 | 
	
		
			
				|  |  | +		</foreach>
 | 
	
		
			
				|  |  | +		<if test="dataType!=null">
 | 
	
		
			
				|  |  | +			AND data_type_=#{dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 | 
	
		
			
				|  |  | +		</if>
 | 
	
		
			
				|  |  | +	</delete>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	<!-- 分页查询 -->
 | 
	
		
			
				|  |  |  	<select id="queryPage" resultMap="IndexBaseMonthData" parameterType="map">
 | 
	
		
			
				|  |  |  		SELECT * FROM index_base_month_data ORDER BY id_ <include refid="global.limit"/>
 | 
	
	
		
			
				|  | @@ -77,4 +110,85 @@
 | 
	
		
			
				|  |  |  	<select id="queryCount" resultType="int">
 | 
	
		
			
				|  |  |  		SELECT COUNT(*) FROM index_base_month_data
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="getIndexBaseData" resultMap="IndexBaseMonthData">
 | 
	
		
			
				|  |  | +		SELECT *
 | 
	
		
			
				|  |  | +		FROM index_base_month_data
 | 
	
		
			
				|  |  | +		<where>
 | 
	
		
			
				|  |  | +			<if test="dataTypes!=null and dataTypes.size()>0">
 | 
	
		
			
				|  |  | +				AND data_type_ IN
 | 
	
		
			
				|  |  | +				<foreach collection="dataTypes" item="dataType" open="(" close=")" separator=",">
 | 
	
		
			
				|  |  | +					#{dataType}
 | 
	
		
			
				|  |  | +				</foreach>
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="organIds!=null and organIds.size()>0">
 | 
	
		
			
				|  |  | +				AND organ_id_ IN
 | 
	
		
			
				|  |  | +				<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
 | 
	
		
			
				|  |  | +					#{organId}
 | 
	
		
			
				|  |  | +				</foreach>
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="startMonth!=null and startMonth!=''">
 | 
	
		
			
				|  |  | +				AND DATE_FORMAT(month_, '%Y-%m')>=#{startMonth}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="endMonth!=null and endMonth!=''">
 | 
	
		
			
				|  |  | +				AND DATE_FORMAT(month_, '%Y-%m')<=#{endMonth}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +		</where>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<select id="getStudentSignUpData" resultMap="IndexBaseMonthData">
 | 
	
		
			
				|  |  | +		SELECT
 | 
	
		
			
				|  |  | +			organ_id_,
 | 
	
		
			
				|  |  | +			CONCAT(DATE_FORMAT( create_time_, '%Y-%m' ), '-01') month_,
 | 
	
		
			
				|  |  | +			COUNT( id_ ) total_num_,
 | 
	
		
			
				|  |  | +			COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END) activate_num_,
 | 
	
		
			
				|  |  | +			TRUNCATE(COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END)/COUNT( id_ )*100, 2) percent_
 | 
	
		
			
				|  |  | +		FROM sys_user
 | 
	
		
			
				|  |  | +		WHERE
 | 
	
		
			
				|  |  | +			del_flag_=0
 | 
	
		
			
				|  |  | +			AND user_type_ LIKE '%STUDENT%'
 | 
	
		
			
				|  |  | +			<if test="startMonth!=null and startMonth!=''">
 | 
	
		
			
				|  |  | +				AND DATE_FORMAT(create_time_, '%Y-%m')>=#{startMonth}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="endMonth!=null and endMonth!=''">
 | 
	
		
			
				|  |  | +				AND DATE_FORMAT(create_time_, '%Y-%m')<=#{endMonth}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +		GROUP BY organ_id_,month_
 | 
	
		
			
				|  |  | +		ORDER BY organ_id_,month_;
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<select id="getHomeworkDate" resultMap="IndexBaseMonthData">
 | 
	
		
			
				|  |  | +		SELECT
 | 
	
		
			
				|  |  | +			su.organ_id_,
 | 
	
		
			
				|  |  | +			CONCAT(DATE_FORMAT(sees.monday_, '%Y-%m'), '-01') month_,
 | 
	
		
			
				|  |  | +			<choose>
 | 
	
		
			
				|  |  | +				<when test="type == 'submit'">
 | 
	
		
			
				|  |  | +					SUM(sees.expect_exercises_num_) total_num_,
 | 
	
		
			
				|  |  | +					SUM(sees.exercises_reply_num_) activate_num_,
 | 
	
		
			
				|  |  | +					TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent_
 | 
	
		
			
				|  |  | +				</when>
 | 
	
		
			
				|  |  | +				<when test="type == 'comment'">
 | 
	
		
			
				|  |  | +					SUM(sees.expect_exercises_num_) total_num_,
 | 
	
		
			
				|  |  | +					SUM(sees.exercises_reply_num_) activate_num_,
 | 
	
		
			
				|  |  | +					TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent_
 | 
	
		
			
				|  |  | +				</when>
 | 
	
		
			
				|  |  | +				<otherwise>
 | 
	
		
			
				|  |  | +					SUM(sees.expect_exercises_num_) total_num_,
 | 
	
		
			
				|  |  | +					SUM(sees.actual_exercises_num_) activate_num_,
 | 
	
		
			
				|  |  | +					TRUNCATE(SUM(sees.actual_exercises_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent_
 | 
	
		
			
				|  |  | +				</otherwise>
 | 
	
		
			
				|  |  | +			</choose>
 | 
	
		
			
				|  |  | +		FROM student_extracurricular_exercises_situation_ sees
 | 
	
		
			
				|  |  | +		LEFT JOIN sys_user su ON sees.student_id_=su.id_
 | 
	
		
			
				|  |  | +		WHERE su.del_flag_=0
 | 
	
		
			
				|  |  | +			AND su.organ_id_ IS NOT NULL
 | 
	
		
			
				|  |  | +			<if test="startMonth!=null and startMonth!=''">
 | 
	
		
			
				|  |  | +				AND DATE_FORMAT(sees.monday_, '%Y-%m')>=#{startMonth}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="endMonth!=null and endMonth!=''">
 | 
	
		
			
				|  |  | +				AND DATE_FORMAT(sees.monday_, '%Y-%m')<=#{endMonth}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +		GROUP BY su.organ_id_,month_
 | 
	
		
			
				|  |  | +		ORDER BY su.organ_id_,month_
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  |  </mapper>
 |