| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690 | <?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.ym.mec.biz.dal.dao.IndexBaseMonthDataDao">	<resultMap type="com.ym.mec.biz.dal.entity.IndexBaseMonthData" id="IndexBaseMonthData">		<result column="id_" property="id" />		<result column="month_" property="month" />		<result column="organ_id_" property="organId" />		<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>	<!-- 根据主键查询一条记录 -->	<select id="get" resultMap="IndexBaseMonthData" >		SELECT * FROM index_base_month_data WHERE id_ = #{id}	</select>	<!-- 全查询 -->	<select id="findAll" resultMap="IndexBaseMonthData">		SELECT * FROM index_base_month_data ORDER BY id_	</select>	<!-- 向数据库增加一条记录 -->	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.IndexBaseMonthData" useGeneratedKeys="true" keyColumn="id" keyProperty="id">		<!--		<selectKey resultClass="int" keyProperty="id" > 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 		</selectKey>		-->		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>	<!-- 根据主键查询一条记录 -->	<update id="update" parameterType="com.ym.mec.biz.dal.entity.IndexBaseMonthData">		UPDATE index_base_month_data <set>		<if test="organId != null">			organ_id_ = #{organId},		</if>		<if test="id != null">			id_ = #{id},		</if>		<if test="activateNum != null">			activate_num_ = #{activateNum},		</if>		<if test="totalNum != null">			total_num_ = #{totalNum},		</if>		<if test="percent != null">			percent_ = #{percent},		</if>		<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>	<!-- 根据主键删除一条记录 -->	<delete id="delete" >		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"/>	</select>	<!-- 查询当前表的总记录数 -->	<select id="queryCount" resultType="int">		SELECT COUNT(*) FROM index_base_month_data	</select>    <select id="getIndexBaseData" resultMap="IndexBaseMonthData">		SELECT			month_,data_type_,SUM(total_num_) total_num_,SUM(activate_num_) activate_num_,SUM(percent_) percent_		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 month_>=#{startMonth}			</if>			<if test="endMonth!=null and endMonth!=''">				AND month_<=#{endMonth}			</if>		</where>		GROUP BY month_,data_type_	</select>	<select id="getStudentSignUpData" resultMap="IndexBaseMonthData">		SELECT			organ_id_,			#{dayStr} 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			((				 SELECT DISTINCT					 sr.user_id_				 FROM					 student_registration sr						 LEFT JOIN music_group mg ON sr.music_group_id_ = mg.id_				 WHERE					 mg.status_ IN ( 'PREPARE', 'PROGRESS' )				   AND sr.music_group_status_ = 'NORMAL'				   AND DATE_FORMAT(sr.create_time_, '%Y-%m-%d')<=#{dayStr}			 ) UNION			(			 SELECT DISTINCT				 cssp.user_id_			 FROM				 course_schedule_student_payment cssp					 LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_			 WHERE				 cs.del_flag_ = 0			   AND ( cs.is_lock_ = 0 OR cs.is_lock_ IS NULL )			   AND ( cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_ )			   AND cs.organ_id_ IS NOT NULL			   AND DATE_FORMAT(cssp.create_time_, '%Y-%m-%d')<=#{dayStr}			)) u			LEFT JOIN sys_user su ON u.user_id_ = su.id_		WHERE			del_flag_=0		  	AND organ_id_ IS NOT NULL			AND user_type_ LIKE '%STUDENT%'		GROUP BY organ_id_		ORDER BY organ_id_;	</select>	<select id="getHomeworkData" resultMap="IndexBaseMonthData">		SELECT			su.organ_id_,			#{dayStr} month_,			<choose>				<when test="type == 'submit'">					SUM(sees.actual_exercises_num_) total_num_,					SUM(sees.exercises_reply_num_) activate_num_,					TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.actual_exercises_num_)*100, 2) percent_				</when>				<when test="type == 'comment'">					SUM(sees.exercises_reply_num_) total_num_,					SUM(sees.exercises_message_num_) activate_num_,					TRUNCATE(SUM(sees.exercises_message_num_)/SUM(sees.exercises_reply_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			AND (DATE_FORMAT(sees.monday_, '%Y-%m')=DATE_FORMAT(#{dayStr}, '%Y-%m')			        OR DATE_FORMAT(sees.sunday_, '%Y-%m')=DATE_FORMAT(#{dayStr}, '%Y-%m'))		GROUP BY su.organ_id_		ORDER BY su.organ_id_	</select>	<select id="getSchoolData" resultMap="IndexBaseMonthData">		SELECT			mg.organ_id_,			#{dayStr} month_,			COUNT( DISTINCT mg.cooperation_organ_id_ ) total_num_,			COUNT( DISTINCT mg.cooperation_organ_id_ ) activate_num_,			COUNT( DISTINCT mg.cooperation_organ_id_ ) percent_		FROM			music_group mg		WHERE			mg.del_flag_ = 0			AND mg.organ_id_ IS NOT NULL			AND mg.status_ = 'PROGRESS'			AND DATE_FORMAT(mg.create_time_, '%Y-%m-%d')<=#{dayStr}		GROUP BY			mg.organ_id_		ORDER BY			mg.organ_id_;	</select>	<select id="getMusicData" resultMap="IndexBaseMonthData">		SELECT			organ_id_,			#{dayStr} month_,			COUNT( id_ ) total_num_,			COUNT( id_ ) activate_num_,			COUNT( id_ ) percent_		FROM			music_group		WHERE			del_flag_ = 0			AND status_ = 'PROGRESS'			AND organ_id_ IS NOT NULL			<if test="dayStr!=null and dayStr!=''">				AND DATE_FORMAT(create_time_, '%Y-%m-%d') <= #{dayStr}			</if>		GROUP BY			organ_id_		ORDER BY			organ_id_;	</select>	<select id="getMusicStudentData" resultMap="IndexBaseMonthData">		SELECT			mg.organ_id_,			#{dayStr} month_,			COUNT( DISTINCT sr.user_id_ ) total_num_,			COUNT( DISTINCT sr.user_id_ ) activate_num_,			COUNT( DISTINCT sr.user_id_ ) percent_		FROM student_registration sr			LEFT JOIN music_group mg ON sr.music_group_id_=mg.id_		WHERE			mg.del_flag_ = 0		  	AND mg.organ_id_ IS NOT NULL			AND mg.status_ = 'PROGRESS'			<if test="type==null">				AND sr.music_group_status_='NORMAL'			</if>			<if test="type!=null and type=='QUIT'">				AND sr.music_group_status_='QUIT'				AND DATE_FORMAT(sr.create_time_, '%Y-%m') >= CONCAT(DATE_FORMAT(NOW(), '%Y'), '-01')			</if>			<if test="type!=null and type=='ADD'">				AND sr.music_group_status_='NORMAL'				AND DATE_FORMAT(sr.create_time_, '%Y-%m') >= CONCAT(DATE_FORMAT(NOW(), '%Y'), '-01')			</if>			<if test="dayStr!=null and dayStr!=''">				AND DATE_FORMAT(sr.create_time_, '%Y-%m-%d') <= #{dayStr}			</if>		GROUP BY			mg.organ_id_		ORDER BY			mg.organ_id_;	</select>	<select id="getTeacherData" resultMap="IndexBaseMonthData">		SELECT			t.organ_id_,			#{dayStr} month_,			COUNT( t.id_ ) total_num_,			COUNT( t.id_ ) activate_num_,			COUNT( t.id_ ) percent_		FROM			teacher t			LEFT JOIN sys_user su ON su.id_ = t.id_		WHERE			su.del_flag_ = 0		  	<if test="isDemission==null">				AND su.lock_flag_ = 0			</if>		  	<if test="isDemission!=null">				AND (su.lock_flag_ = 1 OR t.demission_date_<NOW())			</if>			AND t.organ_id_ IS NOT NULL			<if test="jobNature!=null">				AND t.job_nature_ = #{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}			</if>			<if test="dayStr!=null and dayStr!=''">				AND DATE_FORMAT(t.create_time_, '%Y-%m-%d') <= #{dayStr}			</if>		GROUP BY			t.organ_id_		ORDER BY			t.organ_id_;	</select>	<select id="getGroupCourseData" resultMap="IndexBaseMonthData">		SELECT			m.organ_id_,			#{dayStr} month_,			COUNT( m.id_ ) total_num_,			COUNT( m.id_ ) activate_num_,			COUNT( m.id_ ) percent_		FROM			course_schedule m		WHERE			m.del_flag_ = 0			AND (m.is_lock_ = 0 OR m.is_lock_ IS NULL)		  	AND m.status_ = 'OVER'			AND (m.new_course_id_ IS NULL OR m.new_course_id_=m.id_)			AND m.organ_id_ IS NOT NULL			<if test="groupType!=null">				AND m.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}			</if>			<if test="dayStr!=null and dayStr!=''">				AND DATE_FORMAT(m.class_date_, '%Y-%m-%d') = #{dayStr}			</if>		GROUP BY			m.organ_id_		ORDER BY			m.organ_id_;	</select>	<select id="getOtherStudentData" resultMap="IndexBaseMonthData">		SELECT			su.organ_id_,			#{dayStr} month_,			COUNT( DISTINCT s.user_id_ ) total_num_,			COUNT( DISTINCT s.user_id_ ) activate_num_,			COUNT( DISTINCT s.user_id_ ) percent_		FROM		    sys_user su			LEFT JOIN course_schedule_student_payment s ON su.id_=s.user_id_			LEFT JOIN course_schedule m ON s.course_schedule_id_=m.id_		WHERE			m.del_flag_ = 0			AND (m.is_lock_ = 0 OR m.is_lock_ IS NULL)			AND su.organ_id_ IS NOT NULL			AND m.group_type_ IN ('VIP', 'PRACTICE')			AND m.status_ = 'NOT_START'			<if test="dayStr!=null and dayStr!=''">				AND (DATE_FORMAT(s.create_time_, '%Y-%m-%d') <= #{dayStr} OR YEAR(m.create_time_)=3000)			</if>		GROUP BY			su.organ_id_		ORDER BY			su.organ_id_;	</select>	<select id="getStudentConversionData" resultMap="IndexBaseMonthData">		SELECT			cs.organ_id_,			#{dayStr} month_,			COUNT( DISTINCT m.user_id_ ) total_num_,			COUNT( DISTINCT m.user_id_ ) activate_num_,			COUNT( DISTINCT m.user_id_ ) percent_		FROM			course_schedule_student_payment m			LEFT JOIN course_schedule cs ON m.course_schedule_id_=cs.id_			LEFT JOIN practice_group pg ON m.music_group_id_=pg.id_ AND m.group_type_='PRACTICE'		WHERE			(cs.del_flag_ IS NULL OR cs.del_flag_=0)			AND cs.organ_id_ IS NOT NULL			AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)			AND m.group_type_ IN ('VIP', 'PRACTICE')			AND (pg.id_ IS NULL OR pg.type_='CHARGE')			AND m.user_id_ IN			<foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">				#{studentId}			</foreach>			AND DATE_FORMAT(m.create_time_, '%Y-%m-%d')<=#{dayStr}		GROUP BY			cs.organ_id_		ORDER BY			cs.organ_id_;	</select>	<select id="getMusicGroupPreRegistrationStudentData" resultMap="IndexBaseMonthData">		SELECT			mg.organ_id_,			#{dayStr} month_,			COUNT( DISTINCT spr.user_id_ ) total_num_,			COUNT( DISTINCT spr.user_id_ ) activate_num_,			COUNT( DISTINCT spr.user_id_ ) percent_		FROM			student_pre_registration spr			LEFT JOIN music_group mg ON spr.music_group_id_ = mg.id_		WHERE			mg.del_flag_ = 0			AND mg.organ_id_ IS NOT NULL		  	AND mg.status_ = 'PROGRESS'			AND DATE_FORMAT( spr.create_time_, '%Y-%m-%d' ) <= #{dayStr}		GROUP BY			mg.organ_id_		ORDER BY			mg.organ_id_;	</select>	<select id="getMusicGroupStudentFromPreData" resultMap="IndexBaseMonthData">		SELECT			mg.organ_id_,			#{dayStr} month_,			COUNT( DISTINCT sr.user_id_ ) total_num_,			COUNT( DISTINCT sr.user_id_ ) activate_num_,			COUNT( DISTINCT sr.user_id_ ) percent_		FROM			student_registration sr			LEFT JOIN student_pre_registration spr ON sr.user_id_ = spr.user_id_ AND sr.music_group_id_ = spr.music_group_id_			LEFT JOIN music_group mg ON spr.music_group_id_ = mg.id_		WHERE			mg.del_flag_ = 0			AND mg.organ_id_ IS NOT NULL			AND mg.status_ = 'PROGRESS'			<if test="paymentStatus==null">				AND sr.music_group_status_ IN ('APPLY', 'NORMAL')			</if>		  	<if test="paymentStatus!=null">				AND sr.music_group_status_ IN ('NORMAL')				AND sr.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}			</if>			AND DATE_FORMAT( sr.create_time_, '%Y-%m-%d' ) <= #{dayStr}		GROUP BY			mg.organ_id_		ORDER BY			mg.organ_id_;	</select>	<select id="getMusicGroupStudentIdFromPre" resultType="int">		SELECT			sr.user_id_		FROM			student_registration sr			LEFT JOIN student_pre_registration spr ON sr.user_id_ = spr.user_id_ AND sr.music_group_id_ = spr.music_group_id_			LEFT JOIN music_group mg ON spr.music_group_id_ = mg.id_		WHERE			mg.del_flag_ = 0			AND mg.organ_id_ IS NOT NULL			AND mg.status_ = 'PROGRESS'			<if test="paymentStatus==null">				AND sr.music_group_status_ IN ('APPLY', 'NORMAL')			</if>			<if test="paymentStatus!=null">				AND sr.music_group_status_ IN ('NORMAL')				AND sr.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}			</if>			AND DATE_FORMAT( sr.create_time_, '%Y-%m-%d' ) <= #{dayStr}	</select>	<select id="countLessThenThreeClassGroupNum" resultType="int">		SELECT COUNT(t.id_) FROM (		SELECT cg.id_ FROM		class_group cg		LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_		LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_		WHERE		cg.type_ IN ('HIGH', 'HIGH_ONLINE')		AND mg.status_ = 'PROGRESS' AND cg.del_flag_ = 0		<if test="organIds!=null and organIds.size()>0">			AND mg.organ_id_ IN			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">				#{organId}			</foreach>		</if>		GROUP BY cg.id_		HAVING		COUNT(CASE WHEN cgsm.status_ = 'NORMAL' THEN 1 ELSE NULL END) < 3		) t	</select>    <select id="getLessThenThreeMusicGroup" resultType="java.lang.String">		SELECT cg.music_group_id_ FROM		class_group cg		LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_		LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_		WHERE		cg.type_ IN ('HIGH_ONLINE')		AND mg.status_ = 'PROGRESS' AND cg.del_flag_ = 0		<if test="organIds!=null and organIds.size()>0">			AND mg.organ_id_ IN			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">				#{organId}			</foreach>		</if>		GROUP BY cg.id_		HAVING		COUNT(CASE WHEN cgsm.status_ = 'NORMAL' THEN 1 ELSE NULL END) < 3	</select>	<select id="countNoPaymentStudentNum" resultType="int">		SELECT			COUNT(DISTINCT mgpc.music_group_id_,mgpcd.user_id_)		FROM		music_group_payment_calender_detail mgpcd		LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_		LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_		WHERE		mg.status_ = 'PROGRESS'		AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= DATE_FORMAT(mgpc.payment_valid_start_date_,'%Y-%m-%d')		AND mgpcd.payment_status_ = 'NON_PAYMENT' AND mgpcd.expect_amount_ > 0		<if test="organIds!=null and organIds.size()>0">			AND mg.organ_id_ IN			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">				#{organId}			</foreach>		</if>	</select>	<select id="getNoPaymentMusicGroup" resultType="java.lang.String">		SELECT			DISTINCT mg.id_		FROM			music_group_payment_calender_detail mgpcd			LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_			LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_		WHERE			mg.status_ = 'PROGRESS'			AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= DATE_FORMAT(mgpc.payment_valid_start_date_,'%Y-%m-%d')			AND mgpcd.payment_status_ = 'NON_PAYMENT'			<if test="organIds!=null and organIds.size()>0">				AND mg.organ_id_ IN				<foreach collection="organIds" item="organId" open="(" close=")" separator=",">					#{organId}				</foreach>			</if>	</select>	<select id="queryApplyForQuitGroupNum" resultType="java.lang.Long">		SELECT mgq.id_ FROM music_group_quit mgq			LEFT JOIN music_group mg ON mgq.music_group_id_=mg.id_		WHERE mg.status_='PROGRESS'		  AND mgq.status_='PROCESSING'		<if test="organIds!=null and organIds.size() > 0">			AND mg.organ_id_ IN			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">				#{organId}			</foreach>		</if>	</select>	<select id="queryStudentAttendanceInfo" resultType="int">		SELECT			COUNT(DISTINCT cssp.id_)		FROM			course_schedule_student_payment cssp			LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_			LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cssp.course_schedule_id_ AND sa.user_id_ = cssp.user_id_			LEFT JOIN student_visit sv ON cssp.id_ = sv.object_id_		WHERE				cs.status_ = 'OVER' AND sv.id_ IS NULL AND cs.del_flag_ = 0 AND cs.class_date_ >= #{startTime} AND cs.class_date_ <= DATE_FORMAT(NOW(),'%Y-%m-%d')				AND cssp.group_type_ IN ('MUSIC','PRACTICE','VIP')			<if test="type!=null and type=='LEAVE'">				AND sa.status_ = 'LEAVE'			</if>			<if test="type!=null and type=='TRUANT'">				AND (sa.status_ = 'TRUANT' OR sa.id_ IS NULL) AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)			</if>			<if test="organIds!=null and organIds.size()>0">				AND cs.organ_id_ IN				<foreach collection="organIds" item="organId" open="(" close=")" separator=",">					#{organId}				</foreach>			</if>	</select>    <select id="getAttendanceError" resultType="int">		SELECT COUNT(DISTINCT c.id_) FROM (SELECT cs.id_ FROM course_schedule cs		LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_		LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_		WHERE ta.teacher_id_ = cs.actual_teacher_id_		AND cs.status_ = 'OVER' AND cs.del_flag_ = 0 AND cs.class_date_ >= #{startTime}		AND (ta.sign_in_status_ != 1 OR ta.sign_out_status_ != 1 OR sa.status_ != 'NORMAL') AND ta.dispose_content_ IS NULL		AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)		GROUP BY cs.id_) c		<if test="organIds != null and organIds != ''">			AND FIND_IN_SET(cs.organ_id_,#{organIds})		</if>	</select>	<select id="getNoAttendance" resultType="int">		SELECT COUNT(DISTINCT cs.id_) FROM course_schedule cs		LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_		WHERE ta.teacher_id_ = cs.actual_teacher_id_		AND cs.status_ = 'OVER' AND cs.del_flag_ = 0 AND cs.class_date_ >= #{startTime}		AND ta.sign_in_time_ IS NULL AND ta.sign_out_time_ IS NULL AND ta.dispose_content_ IS NULL		AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)		<if test="organIds != null and organIds != ''">			AND FIND_IN_SET(cs.organ_id_,#{organIds})		</if>	</select>	<select id="queryTeacherLeave" resultType="int">		SELECT COUNT(DISTINCT tlr.id_) FROM teacher_leave_record tlr		LEFT JOIN teacher t ON t.id_ = tlr.user_id_		WHERE tlr.status_ = 'ING' AND DATE_FORMAT( tlr.create_time_, '%Y-%m-%d' ) >= #{startTime}		<if test="organIdsStr != null and organIdsStr != ''">			AND FIND_IN_SET(t.organ_id_,#{organIdsStr})		</if>	</select>	<select id="queryLowTeacherSalary" resultType="int">		SELECT COUNT(DISTINCT tcs.user_id_) FROM teacher_course_statistics tcs		LEFT JOIN teacher t ON t.id_ = tcs.user_id_		LEFT JOIN sys_user su ON su.id_ = tcs.user_id_		WHERE su.lock_flag_ = 0 AND su.del_flag_ = 0 AND t.job_nature_ = 'FULL_TIME' AND t.demission_date_ IS NULL		AND DATE_FORMAT(tcs.month_,'%Y-%m') = #{monthStr} AND tcs.low_salary = 1		<if test="organIdsStr != null and organIdsStr != ''">			AND FIND_IN_SET(tcs.organ_id_,#{organIdsStr})		</if>	</select>	<select id="queryInspectionItem" resultType="int">		SELECT COUNT(DISTINCT ii.id_) FROM inspection_item ii		LEFT JOIN inspection i ON ii.inspection_id_ = i.id_		WHERE ii.times_ > planned_times_ AND ii.item_ = 'INSPECT' AND ii.memo_ =''		AND DATE_FORMAT(i.month_,'%Y-%m-%d') >= #{startTime}		<if test="organIdsStr != null and organIdsStr != ''">			AND FIND_IN_SET(ii.organ_id_,#{organIdsStr})		</if>	</select>	<select id="queryInspectionItemPlan" resultType="int">		SELECT COUNT(DISTINCT iip.id_) FROM inspection_item_plan iip		WHERE iip.status_ = 0 AND iip.memo_ = '' AND DATE_FORMAT(iip.plan_start_,'%Y-%m-%d') < DATE_FORMAT(NOW(),'%Y-%m-%d')		AND DATE_FORMAT(iip.plan_start_,'%Y-%m-%d') >= #{startTime}		<if test="organIdsStr != null and organIdsStr != ''">			AND FIND_IN_SET(iip.organ_id_,#{organIdsStr})		</if>	</select>	<select id="queryStudentVisit" resultType="int">		SELECT COUNT(DISTINCT ii.id_) FROM inspection_item ii		LEFT JOIN inspection i ON ii.inspection_id_ = i.id_		WHERE ii.item_ = 'VISIT' AND ii.memo_ =''		AND ii.times_ > (SELECT COUNT(DISTINCT sv.id_) FROM student_visit sv		WHERE sv.teacher_id_ = ii.user_id_ AND DATE_FORMAT(ii.create_time_,'%Y-%m') = DATE_FORMAT(sv.visit_time_,'%Y-%m'))		AND DATE_FORMAT(i.month_,'%Y-%m-%d') >= #{startTime}		<if test="organIdsStr != null and organIdsStr != ''">			AND FIND_IN_SET(ii.organ_id_,#{organIdsStr})		</if>	</select>    <select id="queryErrInspection" resultType="int">		SELECT			COUNT(id_)		FROM			inspection_item_plan		WHERE			conclusion_status_ = 1 AND memo_=''		<if test="organIds!=null and organIds.size()>0">			AND organ_id_ IN			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">				#{organId}			</foreach>		</if>	</select>	<select id="getFinancePayData"  resultMap="IndexBaseMonthData">		SELECT SUM(fe.amount_) total_num_,SUM(fe.amount_) activate_num_,SUM(fe.amount_) percent_,fe.organ_id_,#{dayStr} month_ FROM financial_expenditure fe		WHERE DATE_FORMAT(fe.create_time_,'%Y-%m-%d') = #{dayStr}		AND del_flag_ = 0 GROUP BY fe.organ_id_	</select>	<select id="getFinanceBalanceData" resultMap="IndexBaseMonthData">		SELECT spo.organ_id_,SUM(spo.balance_payment_amount_) total_num_,			   SUM(spo.balance_payment_amount_) activate_num_,			   SUM(spo.balance_payment_amount_) percent_,#{dayStr} month_		FROM student_payment_order spo		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') = #{dayStr}		GROUP BY spo.organ_id_	</select>	<select id="getFinanceActualData" resultMap="IndexBaseMonthData">		SELECT spo.organ_id_,SUM(spo.actual_amount_) total_num_,			   SUM(spo.actual_amount_) activate_num_,			   SUM(spo.actual_amount_) percent_,#{dayStr} month_		FROM student_payment_order spo		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') = #{dayStr}		GROUP BY spo.organ_id_	</select></mapper>
 |