|  | @@ -1,7 +1,7 @@
 | 
	
		
			
				|  |  |  <?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.StudentCompetitionDao">
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	<resultMap type="com.ym.mec.biz.dal.entity.StudentCompetition" id="StudentCompetition">
 | 
	
		
			
				|  |  |  		<result column="id_" property="id" />
 | 
	
		
			
				|  |  |  		<result column="user_id_" property="userId" />
 | 
	
	
		
			
				|  | @@ -21,17 +21,17 @@
 | 
	
		
			
				|  |  |  		<result column="create_time_" property="createTime" />
 | 
	
		
			
				|  |  |  		<result column="update_time_" property="updateTime" />
 | 
	
		
			
				|  |  |  	</resultMap>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	<!-- 根据主键查询一条记录 -->
 | 
	
		
			
				|  |  |  	<select id="get" resultMap="StudentCompetition" >
 | 
	
		
			
				|  |  |  		SELECT * FROM student_competition WHERE id_ = #{id}
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	<!-- 全查询 -->
 | 
	
		
			
				|  |  |  	<select id="findAll" resultMap="StudentCompetition">
 | 
	
		
			
				|  |  |  		SELECT * FROM student_competition ORDER BY id_
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	<!-- 向数据库增加一条记录 -->
 | 
	
		
			
				|  |  |  	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentCompetition" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 | 
	
		
			
				|  |  |  		<!--
 | 
	
	
		
			
				|  | @@ -42,7 +42,7 @@
 | 
	
		
			
				|  |  |  		INSERT INTO student_competition (id_,user_id_,username_,id_card_no_,age_,gender_,grade_,subject_,chapter_,picture_url_,video_url_,score_,prize_level_,is_show_,comment_,create_time_,update_time_)
 | 
	
		
			
				|  |  |  		VALUES(#{id},#{userId},#{username},#{idCardNo},#{age},#{gender},#{grade},#{subject},#{chapter},#{pictureUrl},#{videoUrl},#{score},#{prizeLevel},#{isShow},#{comment},NOW(),NOW())
 | 
	
		
			
				|  |  |  	</insert>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	<!-- 根据主键查询一条记录 -->
 | 
	
		
			
				|  |  |  	<update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentCompetition">
 | 
	
		
			
				|  |  |  		UPDATE student_competition <set>
 | 
	
	
		
			
				|  | @@ -91,20 +91,20 @@
 | 
	
		
			
				|  |  |  		<if test="grade != null">
 | 
	
		
			
				|  |  |  			grade_ = #{grade},
 | 
	
		
			
				|  |  |  		</if>
 | 
	
		
			
				|  |  | -			update_time_ = NOW()
 | 
	
		
			
				|  |  | +		update_time_ = NOW()
 | 
	
		
			
				|  |  |  	</set> WHERE id_ = #{id}
 | 
	
		
			
				|  |  |  	</update>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	<!-- 根据主键删除一条记录 -->
 | 
	
		
			
				|  |  |  	<delete id="delete" >
 | 
	
		
			
				|  |  |  		DELETE FROM student_competition WHERE id_ = #{id} 
 | 
	
		
			
				|  |  |  	</delete>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	<!-- 分页查询 -->
 | 
	
		
			
				|  |  |  	<select id="queryPage" resultMap="StudentCompetition" parameterType="map">
 | 
	
		
			
				|  |  |  		SELECT * FROM student_competition ORDER BY id_ <include refid="global.limit"/>
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	<!-- 查询当前表的总记录数 -->
 | 
	
		
			
				|  |  |  	<select id="queryCount" resultType="int">
 | 
	
		
			
				|  |  |  		SELECT COUNT(*) FROM student_competition
 | 
	
	
		
			
				|  | @@ -141,23 +141,23 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<select id="queryStudentCompetitions" resultMap="StudentCompetition">
 | 
	
		
			
				|  |  |  		SELECT
 | 
	
		
			
				|  |  | -			id_,
 | 
	
		
			
				|  |  | -			user_id_,
 | 
	
		
			
				|  |  | -			username_,
 | 
	
		
			
				|  |  | -			id_card_no_,
 | 
	
		
			
				|  |  | -			age_,
 | 
	
		
			
				|  |  | -			gender_,
 | 
	
		
			
				|  |  | -			grade_,
 | 
	
		
			
				|  |  | -			subject_,
 | 
	
		
			
				|  |  | -			chapter_,
 | 
	
		
			
				|  |  | -			picture_url_,
 | 
	
		
			
				|  |  | -			video_url_,
 | 
	
		
			
				|  |  | -			CASE WHEN score_ IS NULL THEN -1 ELSE score_ END score_,
 | 
	
		
			
				|  |  | -			CASE WHEN prize_level_ IS NULL THEN -1 ELSE prize_level_ END prize_level_,
 | 
	
		
			
				|  |  | -			is_show_,
 | 
	
		
			
				|  |  | -			comment_,
 | 
	
		
			
				|  |  | -			create_time_,
 | 
	
		
			
				|  |  | -			update_time_
 | 
	
		
			
				|  |  | +		id_,
 | 
	
		
			
				|  |  | +		user_id_,
 | 
	
		
			
				|  |  | +		username_,
 | 
	
		
			
				|  |  | +		id_card_no_,
 | 
	
		
			
				|  |  | +		age_,
 | 
	
		
			
				|  |  | +		gender_,
 | 
	
		
			
				|  |  | +		grade_,
 | 
	
		
			
				|  |  | +		subject_,
 | 
	
		
			
				|  |  | +		chapter_,
 | 
	
		
			
				|  |  | +		picture_url_,
 | 
	
		
			
				|  |  | +		video_url_,
 | 
	
		
			
				|  |  | +		CASE WHEN score_ IS NULL THEN -1 ELSE score_ END score_,
 | 
	
		
			
				|  |  | +		CASE WHEN prize_level_ IS NULL THEN -1 ELSE prize_level_ END prize_level_,
 | 
	
		
			
				|  |  | +		is_show_,
 | 
	
		
			
				|  |  | +		comment_,
 | 
	
		
			
				|  |  | +		create_time_,
 | 
	
		
			
				|  |  | +		update_time_
 | 
	
		
			
				|  |  |  		FROM student_competition
 | 
	
		
			
				|  |  |  		<include refid="queryStudentCondition"/>
 | 
	
		
			
				|  |  |  		ORDER BY id_ DESC
 | 
	
	
		
			
				|  | @@ -169,7 +169,8 @@
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<select id="getWinnerList" resultMap="StudentCompetition">
 | 
	
		
			
				|  |  | -		SELECT * FROM student_competition WHERE is_show_ = 1 AND prize_level_ > 0 ORDER BY prize_level_,score_ DESC
 | 
	
		
			
				|  |  | +		SELECT * FROM student_competition WHERE is_show_ = 1
 | 
	
		
			
				|  |  | +		ORDER BY ISNULL(prize_level_),prize_level_,ISNULL(score_),score_ DESC
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<select id="getCompetitionWithUser" resultMap="StudentCompetition">
 |