|
@@ -12,7 +12,7 @@
|
|
<result column="song_author_" property="songAuthor" />
|
|
<result column="song_author_" property="songAuthor" />
|
|
<result column="subject_list_" property="subjectList" />
|
|
<result column="subject_list_" property="subjectList" />
|
|
<result column="level_list_" property="levelList" />
|
|
<result column="level_list_" property="levelList" />
|
|
- <result column="type_" property="type" />
|
|
|
|
|
|
+ <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
|
|
<result column="file_url_list_" property="fileUrlList" />
|
|
<result column="file_url_list_" property="fileUrlList" />
|
|
<result column="create_time_" property="createTime" />
|
|
<result column="create_time_" property="createTime" />
|
|
<result column="update_time_" property="updateTime" />
|
|
<result column="update_time_" property="updateTime" />
|
|
@@ -31,7 +31,7 @@
|
|
<!-- 向数据库增加一条记录 -->
|
|
<!-- 向数据库增加一条记录 -->
|
|
<insert id="insert" parameterType="com.keao.edu.user.entity.ExamSong" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
<insert id="insert" parameterType="com.keao.edu.user.entity.ExamSong" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
INSERT INTO exam_song (id_,song_name_,song_author_,subject_list_,level_list_,type_,file_url_list_,create_time_,update_time_)
|
|
INSERT INTO exam_song (id_,song_name_,song_author_,subject_list_,level_list_,type_,file_url_list_,create_time_,update_time_)
|
|
- VALUES(#{id},#{songName},#{songAuthor},#{subjectList},#{levelList},#{type},#{fileUrlList},NOW(),NOW())
|
|
|
|
|
|
+ VALUES(#{id},#{songName},#{songAuthor},#{subjectList},#{levelList},#{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{fileUrlList},NOW(),NOW())
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -54,11 +54,14 @@
|
|
song_author_ = #{songAuthor},
|
|
song_author_ = #{songAuthor},
|
|
</if>
|
|
</if>
|
|
<if test="type != null">
|
|
<if test="type != null">
|
|
- type_ = #{type},
|
|
|
|
|
|
+ type_ = #{type, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
</if>
|
|
</if>
|
|
<if test="songName != null">
|
|
<if test="songName != null">
|
|
song_name_ = #{songName},
|
|
song_name_ = #{songName},
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="delFlag != null">
|
|
|
|
+ del_flag_ = #{delFlag}
|
|
|
|
+ </if>
|
|
<if test="createTime != null">
|
|
<if test="createTime != null">
|
|
create_time_ = #{createTime},
|
|
create_time_ = #{createTime},
|
|
</if>
|
|
</if>
|
|
@@ -70,14 +73,30 @@
|
|
<delete id="delete" >
|
|
<delete id="delete" >
|
|
DELETE FROM exam_song WHERE id_ = #{id}
|
|
DELETE FROM exam_song WHERE id_ = #{id}
|
|
</delete>
|
|
</delete>
|
|
|
|
+
|
|
|
|
+ <sql id="queryCondition">
|
|
|
|
+ <where>
|
|
|
|
+ del_flag_=0
|
|
|
|
+ <if test="subjectList!=null">
|
|
|
|
+ AND FIND_IN_SET(#{subjectList}, subject_list_)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="search!=null">
|
|
|
|
+ AND (id_=#{search} OR song_name_ LIKE CONCAT('%', #{search}, '%'))
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </sql>
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
<!-- 分页查询 -->
|
|
<select id="queryPage" resultMap="ExamSong" parameterType="map">
|
|
<select id="queryPage" resultMap="ExamSong" parameterType="map">
|
|
- SELECT * FROM exam_song ORDER BY id_ <include refid="global.limit"/>
|
|
|
|
|
|
+ SELECT * FROM exam_song
|
|
|
|
+ <include refid="queryCondition"/>
|
|
|
|
+ ORDER BY id_
|
|
|
|
+ <include refid="global.limit"/>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
<!-- 查询当前表的总记录数 -->
|
|
<select id="queryCount" resultType="int">
|
|
<select id="queryCount" resultType="int">
|
|
|
|
+ <include refid="queryCondition"/>
|
|
SELECT COUNT(*) FROM exam_song
|
|
SELECT COUNT(*) FROM exam_song
|
|
</select>
|
|
</select>
|
|
</mapper>
|
|
</mapper>
|