MusicGroupPerformanceMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.ym.mec.biz.dal.dao.MusicGroupPerformanceDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.MusicGroupPerformance" id="MusicGroupPerformance">
  9. <result column="id_" property="id" />
  10. <result column="music_group_id_" property="musicGroupId" />
  11. <result column="name_" property="name" />
  12. <result column="music_score_name_" property="musicScoreName" />
  13. <result column="operator_" property="operator" />
  14. <result column="operator_name_" property="operatorName" />
  15. <result column="order_" property="order" />
  16. <result column="start_time_" property="startTime" />
  17. <result column="sub_day_" property="subDay" />
  18. <result column="music_group_name_" property="musicGroupName" />
  19. <result column="organ_name_" property="organName" />
  20. <result column="create_time_" property="createTime" />
  21. <result column="update_time_" property="updateTime" />
  22. </resultMap>
  23. <!-- 根据主键查询一条记录 -->
  24. <select id="get" resultMap="MusicGroupPerformance" >
  25. SELECT * FROM music_group_performance WHERE id_ = #{id}
  26. </select>
  27. <!-- 全查询 -->
  28. <select id="findAll" resultMap="MusicGroupPerformance">
  29. SELECT * FROM music_group_performance ORDER BY id_
  30. </select>
  31. <!-- 向数据库增加一条记录 -->
  32. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPerformance" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  33. INSERT INTO music_group_performance (music_group_id_,name_,music_score_name_,operator_,order_,start_time_,create_time_,update_time_)
  34. VALUES(#{musicGroupId},#{name},#{musicScoreName},#{operator},#{order},#{startTime},NOW(),NOW())
  35. </insert>
  36. <!-- 根据主键查询一条记录 -->
  37. <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPerformance">
  38. UPDATE music_group_performance <set>
  39. <if test="operator != null">
  40. operator_ = #{operator},
  41. </if>
  42. <if test="musicScoreName != null">
  43. music_score_name_ = #{musicScoreName},
  44. </if>
  45. <if test="musicGroupId != null">
  46. music_group_id_ = #{musicGroupId},
  47. </if>
  48. <if test="order != null">
  49. order_ = #{order},
  50. </if>
  51. <if test="name != null">
  52. name_ = #{name},
  53. </if>
  54. <if test="startTime != null">
  55. start_time_ = #{startTime},
  56. </if>
  57. update_time_ = NOW()
  58. </set> WHERE id_ = #{id}
  59. </update>
  60. <!-- 根据主键删除一条记录 -->
  61. <delete id="delete" >
  62. DELETE FROM music_group_performance WHERE id_ = #{id}
  63. </delete>
  64. <!-- 分页查询 -->
  65. <select id="queryPage" resultMap="MusicGroupPerformance" parameterType="map">
  66. SELECT mgp.*,su.real_name_ operator_name_ FROM music_group_performance mgp
  67. LEFT JOIN sys_user su ON su.id_ = mgp.operator_
  68. <where>
  69. <if test="musicGroupId != null and musicGroupId != ''">
  70. AND mgp.music_group_id_ = #{musicGroupId}
  71. </if>
  72. </where>
  73. ORDER BY mgp.order_ ASC,mgp.start_time_ ASC
  74. <include refid="global.limit"/>
  75. </select>
  76. <!-- 查询当前表的总记录数 -->
  77. <select id="queryCount" resultType="int">
  78. SELECT COUNT(mgp.id_) FROM music_group_performance mgp
  79. <where>
  80. <if test="musicGroupId != null and musicGroupId != ''">
  81. AND mgp.music_group_id_ = #{musicGroupId}
  82. </if>
  83. </where>
  84. </select>
  85. <select id="findNoStart" resultMap="MusicGroupPerformance">
  86. SELECT mgp.* FROM music_group_performance mgp
  87. LEFT JOIN music_group mg ON mg.id_ = mgp.music_group_id_
  88. WHERE DATEDIFF(DATE_FORMAT(start_time_, '%Y-%m-%d'),DATE_FORMAT(NOW(), '%Y-%m-%d')) >= 0
  89. <if test="educationUserId != null">
  90. AND mg.educational_teacher_id_ = #{educationUserId}
  91. </if>
  92. <if test="organIds != null and organIds != ''">
  93. AND FIND_IN_SET(mg.organ_id_,#{organIds})
  94. </if>
  95. </select>
  96. <select id="queryNoStart" resultMap="MusicGroupPerformance">
  97. SELECT mgp.*,mg.name_ music_group_name_,o.name_ organ_name_,DATEDIFF(DATE_FORMAT(mgp.start_time_, '%Y-%m-%d'),DATE_FORMAT(NOW(), '%Y-%m-%d')) sub_day_
  98. FROM music_group_performance mgp
  99. LEFT JOIN music_group mg ON mg.id_ = mgp.music_group_id_
  100. LEFT JOIN organization o ON o.id_ = mg.organ_id_
  101. WHERE DATEDIFF(DATE_FORMAT(mgp.start_time_, '%Y-%m-%d'),DATE_FORMAT(NOW(), '%Y-%m-%d')) >= 0
  102. <if test="educationUserId != null">
  103. AND mg.educational_teacher_id_ = #{educationUserId}
  104. </if>
  105. <if test="search != null and search != ''">
  106. AND (mg.id_ = #{search} OR mg.name_ LIKE CONCAT('%',#{search},'%'))
  107. </if>
  108. <if test="organId != null and organId != ''">
  109. AND FIND_IN_SET(mg.organ_id_,#{organId})
  110. </if>
  111. <include refid="global.limit"/>
  112. </select>
  113. <select id="countNoStart" resultType="java.lang.Integer">
  114. SELECT COUNT(mgp.id_) FROM music_group_performance mgp
  115. LEFT JOIN music_group mg ON mg.id_ = mgp.music_group_id_
  116. WHERE DATEDIFF(DATE_FORMAT(start_time_, '%Y-%m-%d'),DATE_FORMAT(NOW(), '%Y-%m-%d')) >= 0
  117. <if test="educationUserId != null">
  118. AND mg.educational_teacher_id_ = #{educationUserId}
  119. </if>
  120. <if test="search != null and search != ''">
  121. AND (mg.id_ = #{search} OR mg.name_ LIKE CONCAT('%',#{search},'%'))
  122. </if>
  123. <if test="organId != null and organId != ''">
  124. AND FIND_IN_SET(mg.organ_id_,#{organId})
  125. </if>
  126. </select>
  127. </mapper>