|  | @@ -1,198 +0,0 @@
 | 
	
		
			
				|  |  | -<?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.SysExamSongAccompanimentDao">
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	<resultMap type="com.ym.mec.biz.dal.entity.SysExamSongAccompaniment" id="SysExamSongAccompaniment">
 | 
	
		
			
				|  |  | -		<result column="id_" property="id" />
 | 
	
		
			
				|  |  | -		<result column="exam_song_id_" property="examSongId" />
 | 
	
		
			
				|  |  | -		<result column="subject_id_" property="subjectId" />
 | 
	
		
			
				|  |  | -		<result column="subject_name_" property="subjectName" />
 | 
	
		
			
				|  |  | -		<result column="mp3_url_" property="mp3Url" />
 | 
	
		
			
				|  |  | -		<result column="xml_url_" property="xmlUrl" />
 | 
	
		
			
				|  |  | -		<result column="name_" property="examSongName" />
 | 
	
		
			
				|  |  | -		<result column="type_" property="type" />
 | 
	
		
			
				|  |  | -		<result column="url_" property="url" />
 | 
	
		
			
				|  |  | -		<result column="del_flag_" property="delFlag" />
 | 
	
		
			
				|  |  | -		<result column="speed_" property="speed" />
 | 
	
		
			
				|  |  | -		<result column="create_time_" property="createTime" />
 | 
	
		
			
				|  |  | -		<result column="update_time_" property="updateTime" />
 | 
	
		
			
				|  |  | -	</resultMap>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	<!-- 根据主键查询一条记录 -->
 | 
	
		
			
				|  |  | -	<select id="get" resultMap="SysExamSongAccompaniment" >
 | 
	
		
			
				|  |  | -		SELECT sesa.*,ses.name_,ses.type_,ses.url_
 | 
	
		
			
				|  |  | -		FROM sys_exam_song_accompaniment sesa
 | 
	
		
			
				|  |  | -		LEFT JOIN sys_exam_song ses ON ses.id_ = sesa.exam_song_id_
 | 
	
		
			
				|  |  | -		WHERE sesa.id_ = #{id}
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	<!-- 全查询 -->
 | 
	
		
			
				|  |  | -	<select id="findAll" resultMap="SysExamSongAccompaniment">
 | 
	
		
			
				|  |  | -		SELECT * FROM sys_exam_song_accompaniment ORDER BY id_
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	<!-- 向数据库增加一条记录 -->
 | 
	
		
			
				|  |  | -	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysExamSongAccompaniment" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 | 
	
		
			
				|  |  | -		INSERT INTO sys_exam_song_accompaniment (exam_song_id_,subject_id_,mp3_url_,xml_url_,speed_,create_time_,update_time_)
 | 
	
		
			
				|  |  | -		VALUES(#{examSongId},#{subjectId},#{mp3Url},#{xmlUrl},#{speed},NOW(),NOW())
 | 
	
		
			
				|  |  | -	</insert>
 | 
	
		
			
				|  |  | -	<insert id="batchInsert">
 | 
	
		
			
				|  |  | -		INSERT INTO sys_exam_song_accompaniment (exam_song_id_,subject_id_,mp3_url_,xml_url_,speed_,create_time_,update_time_)
 | 
	
		
			
				|  |  | -		VALUES
 | 
	
		
			
				|  |  | -		<foreach collection="sysExamSongAccompaniments" item="item"  separator=",">
 | 
	
		
			
				|  |  | -			(#{sysExamSongId},#{item.subjectId},#{item.mp3Url},#{item.xmlUrl},#{item.speed},NOW(),NOW())
 | 
	
		
			
				|  |  | -		</foreach>
 | 
	
		
			
				|  |  | -	</insert>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	<!-- 根据主键查询一条记录 -->
 | 
	
		
			
				|  |  | -	<update id="update" parameterType="com.ym.mec.biz.dal.entity.SysExamSongAccompaniment">
 | 
	
		
			
				|  |  | -		UPDATE sys_exam_song_accompaniment <set>
 | 
	
		
			
				|  |  | -		<if test="subjectId != null">
 | 
	
		
			
				|  |  | -		subject_id_ = #{subjectId},
 | 
	
		
			
				|  |  | -		</if>
 | 
	
		
			
				|  |  | -		<if test="speed != null">
 | 
	
		
			
				|  |  | -			speed_ = #{speed},
 | 
	
		
			
				|  |  | -		</if>
 | 
	
		
			
				|  |  | -		<if test="xmlUrl != null">
 | 
	
		
			
				|  |  | -		xml_url_ = #{xmlUrl},
 | 
	
		
			
				|  |  | -		</if>
 | 
	
		
			
				|  |  | -		<if test="examSongId != null">
 | 
	
		
			
				|  |  | -		exam_song_id_ = #{examSongId},
 | 
	
		
			
				|  |  | -		</if>
 | 
	
		
			
				|  |  | -		<if test="mp3Url != null">
 | 
	
		
			
				|  |  | -		mp3_url_ = #{mp3Url},
 | 
	
		
			
				|  |  | -		</if>
 | 
	
		
			
				|  |  | -		update_time_ = NOW()
 | 
	
		
			
				|  |  | -	</set> WHERE id_ = #{id}
 | 
	
		
			
				|  |  | -	</update>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	<!-- 根据主键删除一条记录 -->
 | 
	
		
			
				|  |  | -	<update id="delete" >
 | 
	
		
			
				|  |  | -		UPDATE sys_exam_song_accompaniment SET del_flag_ = 1,update_time_ = NOW() WHERE id_ = #{id}
 | 
	
		
			
				|  |  | -	</update>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	<!-- 根据主键删除一条记录 -->
 | 
	
		
			
				|  |  | -	<update id="deleteBySongId" >
 | 
	
		
			
				|  |  | -		UPDATE sys_exam_song_accompaniment SET del_flag_ = 1,update_time_ = NOW() WHERE exam_song_id_ = #{examSongId}
 | 
	
		
			
				|  |  | -	</update>
 | 
	
		
			
				|  |  | -	<update id="batchUpdate">
 | 
	
		
			
				|  |  | -		<foreach collection="sysExamSongAccompaniment" item="item" separator=";">
 | 
	
		
			
				|  |  | -			UPDATE sys_exam_song_accompaniment
 | 
	
		
			
				|  |  | -			<set>
 | 
	
		
			
				|  |  | -			<if test="item.speed != null">
 | 
	
		
			
				|  |  | -				speed_ = #{item.speed},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="item.subjectId != null">
 | 
	
		
			
				|  |  | -				subject_id_ = #{item.subjectId},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="item.xmlUrl != null">
 | 
	
		
			
				|  |  | -				xml_url_ = #{item.xmlUrl},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="item.examSongId != null">
 | 
	
		
			
				|  |  | -				exam_song_id_ = #{item.examSongId},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="item.mp3Url != null">
 | 
	
		
			
				|  |  | -				mp3_url_ = #{item.mp3Url},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			update_time_ = NOW()
 | 
	
		
			
				|  |  | -		</set> WHERE id_ = #{item.id}
 | 
	
		
			
				|  |  | -		</foreach>
 | 
	
		
			
				|  |  | -	</update>
 | 
	
		
			
				|  |  | -    <update id="batchDel">
 | 
	
		
			
				|  |  | -		UPDATE sys_exam_song_accompaniment SET del_flag_ = 1,update_time_ = NOW() WHERE id_ IN
 | 
	
		
			
				|  |  | -		<foreach collection="delExamSongAccompanimentIds" item="item" open="(" close=")" separator=",">
 | 
	
		
			
				|  |  | -			#{item}
 | 
	
		
			
				|  |  | -		</foreach>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	</update>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    <!-- 分页查询 -->
 | 
	
		
			
				|  |  | -	<select id="queryPage" resultMap="SysExamSongAccompaniment" parameterType="map">
 | 
	
		
			
				|  |  | -		SELECT sesa.*,s.name_ subject_name_
 | 
	
		
			
				|  |  | -		FROM sys_exam_song_accompaniment sesa
 | 
	
		
			
				|  |  | -		LEFT JOIN `subject` s ON s.id_ = sesa.subject_id_
 | 
	
		
			
				|  |  | -		<where>
 | 
	
		
			
				|  |  | -			sesa.del_flag_ = 0
 | 
	
		
			
				|  |  | -			<if test="subjectId != null">
 | 
	
		
			
				|  |  | -				AND sesa.subject_id_ = #{subjectId}
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="sysExamSongId != null">
 | 
	
		
			
				|  |  | -				AND sesa.exam_song_id_ = #{sysExamSongId}
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -		</where>
 | 
	
		
			
				|  |  | -		ORDER BY sesa.id_ DESC
 | 
	
		
			
				|  |  | -		<include refid="global.limit"/>
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	<!-- 查询当前表的总记录数 -->
 | 
	
		
			
				|  |  | -	<select id="queryCount" resultType="int">
 | 
	
		
			
				|  |  | -		SELECT COUNT(*) FROM sys_exam_song_accompaniment
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	<select id="findSubjectByExamId" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | -		SELECT subject_id_ FROM sys_exam_song_accompaniment
 | 
	
		
			
				|  |  | -		<where>
 | 
	
		
			
				|  |  | -				del_flag_ = 0
 | 
	
		
			
				|  |  | -			<if test="sysExamSongId != null">
 | 
	
		
			
				|  |  | -				AND exam_song_id_ = #{sysExamSongId}
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="examSongAccIds != null and examSongAccIds.size > 0">
 | 
	
		
			
				|  |  | -				AND id_ NOT IN
 | 
	
		
			
				|  |  | -				<foreach collection="examSongAccIds" open="(" close=")" item="item" separator=",">
 | 
	
		
			
				|  |  | -					#{item}
 | 
	
		
			
				|  |  | -				</foreach>
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -		</where>
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  | -	<select id="queryAccPage" resultMap="SysExamSongAccompaniment">
 | 
	
		
			
				|  |  | -		SELECT sesa.*,ses.name_,ses.type_,ses.url_,s.name_ subject_name_
 | 
	
		
			
				|  |  | -		FROM sys_exam_song_accompaniment sesa
 | 
	
		
			
				|  |  | -		LEFT JOIN sys_exam_song ses ON ses.id_ = sesa.exam_song_id_
 | 
	
		
			
				|  |  | -		LEFT JOIN subject s ON s.id_ = sesa.subject_id_
 | 
	
		
			
				|  |  | -		<include refid="queryPageSql"/>
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  | -	<select id="findAccCount" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | -		SELECT COUNT(DISTINCT sesa.id_) FROM sys_exam_song_accompaniment sesa
 | 
	
		
			
				|  |  | -		LEFT JOIN sys_exam_song ses ON ses.id_ = sesa.exam_song_id_
 | 
	
		
			
				|  |  | -		<include refid="queryPageSql"/>
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  | -	<sql id="queryPageSql">
 | 
	
		
			
				|  |  | -		<where>
 | 
	
		
			
				|  |  | -			sesa.del_flag_ = 0
 | 
	
		
			
				|  |  | -			<if test="search != null and search != ''">
 | 
	
		
			
				|  |  | -				AND (sesa.id_ = #{search} OR ses.name_ LIKE CONCAT('%',#{search},'%'))
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="sysExamSongId != null">
 | 
	
		
			
				|  |  | -				AND sesa.exam_song_id_ = #{sysExamSongId}
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="subjectId != null">
 | 
	
		
			
				|  |  | -				AND sesa.subject_id_ = #{subjectId}
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="type != null and type == 'COMMON'">
 | 
	
		
			
				|  |  | -				AND ses.type_ = #{type}
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="type != null and type == 'ALL'">
 | 
	
		
			
				|  |  | -				<if test="createUserId != null">
 | 
	
		
			
				|  |  | -					AND (ses.type_ = 'COMMON' OR (ses.create_user_id_ = #{createUserId} AND ses.type_ = 'PERSON'))
 | 
	
		
			
				|  |  | -				</if>
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="type != null and type == 'PERSON'">
 | 
	
		
			
				|  |  | -				<if test="createUserId != null">
 | 
	
		
			
				|  |  | -					AND ses.type_ = #{type} AND ses.create_user_id_ = #{createUserId}
 | 
	
		
			
				|  |  | -				</if>
 | 
	
		
			
				|  |  | -				<if test="createUserId == null">
 | 
	
		
			
				|  |  | -					AND ses.type_ = #{type}
 | 
	
		
			
				|  |  | -				</if>
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="type == null or type == ''">
 | 
	
		
			
				|  |  | -				<if test="createUserId != null">
 | 
	
		
			
				|  |  | -					AND ses.create_user_id_ = #{createUserId}
 | 
	
		
			
				|  |  | -				</if>
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -		</where>
 | 
	
		
			
				|  |  | -	</sql>
 | 
	
		
			
				|  |  | -</mapper>
 |