| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?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.keao.edu.user.dao.ExamSongDao">
-
- <resultMap type="com.keao.edu.user.entity.ExamSong" id="ExamSong">
- <result column="id_" property="id" />
- <result column="song_name_" property="songName" />
- <result column="song_author_" property="songAuthor" />
- <result column="subject_list_" property="subjectList" />
- <result column="subject_names_" property="subjectNames" />
- <result column="level_list_" property="levelList" />
- <result column="type_" property="type" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler"/>
- <result column="file_url_list_" property="fileUrlList" />
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- <result column="tenant_id_" property="tenantId" />
- </resultMap>
-
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="ExamSong" >
- SELECT * FROM exam_song WHERE id_ = #{id}
- </select>
-
- <!-- 全查询 -->
- <select id="findAll" resultMap="ExamSong">
- SELECT * FROM exam_song WHERE tenant_id_ = #{tenantId} ORDER BY id_
- </select>
-
- <!-- 向数据库增加一条记录 -->
- <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_,tenant_id_)
- VALUES(#{id},#{songName},#{songAuthor},#{subjectList},#{levelList},#{type, typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{fileUrlList},NOW(),NOW(),#{tenantId})
- </insert>
-
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.keao.edu.user.entity.ExamSong">
- UPDATE exam_song
- <set>
- <if test="levelList != null">
- level_list_ = #{levelList},
- </if>
- <if test="subjectList != null">
- subject_list_ = #{subjectList},
- </if>
- <if test="fileUrlList != null">
- file_url_list_ = #{fileUrlList},
- </if>
- <if test="songAuthor != null">
- song_author_ = #{songAuthor},
- </if>
- <if test="type != null">
- type_ = #{type, typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="songName != null">
- song_name_ = #{songName},
- </if>
- <if test="delFlag != null">
- del_flag_ = #{delFlag}
- </if>
- <if test="tenantId">
- tenant_id_ = #{tenantId},
- </if>
- update_time_ = NOW()
- </set> WHERE id_ = #{id}
- </update>
-
- <!-- 根据主键删除一条记录 -->
- <update id="delete" >
- UPDATE exam_song SET del_flag_=1 WHERE id_ = #{id}
- </update>
- <sql id="queryCondition">
- <where>
- es.del_flag_=0 AND es.tenant_id_ = #{tenantId}
- <if test="subjectList!=null">
- AND FIND_IN_SET(#{subjectList}, es.subject_list_)
- </if>
- <if test="search!=null">
- AND (es.id_=#{search} OR es.song_name_ LIKE CONCAT('%', #{search}, '%'))
- </if>
- </where>
- </sql>
-
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="ExamSong" parameterType="map">
- SELECT es.*,GROUP_CONCAT(s.name_) subject_names_ FROM exam_song es
- LEFT JOIN subject s ON FIND_IN_SET(s.id_, es.subject_list_)
- <include refid="queryCondition"/>
- GROUP BY es.id_
- ORDER BY id_
- <include refid="global.limit"/>
- </select>
-
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*) FROM exam_song es
- <include refid="queryCondition"/>
- </select>
- <select id="getExamSongs" resultMap="ExamSong">
- SELECT * FROM exam_song WHERE FIND_IN_SET(id_,#{ids})
- </select>
- <select id="getWithSubject" resultMap="ExamSong">
- SELECT * FROM exam_song WHERE FIND_IN_SET(#{subjectId}, subject_list_)
- </select>
- <select id="getWithLevelAndType" resultMap="ExamSong">
- SELECT * FROM exam_song
- WHERE tenant_id_=#{tenantId}
- AND level_list_=#{level}
- AND type_=#{songType, typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
- </select>
- <select id="countSongPage" resultType="java.lang.Integer">
- </select>
- <select id="querySongPage" resultMap="ExamSong">
- </select>
- <select id="getWithIds" resultMap="ExamSong">
- SELECT * FROM exam_song WHERE id_ IN
- <foreach collection="ids" item="id" separator="," open="(" close=")">
- #{id}
- </foreach>
- </select>
- </mapper>
|