VipGroupCategoryMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. <mapper namespace="com.ym.mec.biz.dal.dao.VipGroupCategoryDao">
  5. <resultMap type="com.ym.mec.biz.dal.entity.VipGroupCategory"
  6. id="VipGroupCategory">
  7. <result column="id_" property="id" />
  8. <result column="name_" property="name" />
  9. <result column="del_flag_" property="delFlag" />
  10. <result column="create_time_" property="createTime" />
  11. <result column="update_time_" property="updateTime" />
  12. <result column="single_class_minutes_" property="singleClassMinutes" />
  13. <result column="student_num_" property="studentNum" />
  14. <result column="music_theory_" property="musicTheory" />
  15. <result column="online_classes_unit_price_" property="onlineClassesUnitPrice" />
  16. <result column="offline_classes_unit_price_" property="offlineClassesUnitPrice" />
  17. <result column="tenant_id_" property="tenantId"/>
  18. </resultMap>
  19. <!-- 根据主键查询一条记录 -->
  20. <select id="get" resultMap="VipGroupCategory">
  21. SELECT * FROM
  22. vip_group_category WHERE id_ = #{id}
  23. </select>
  24. <!-- 全查询 -->
  25. <select id="findAll" resultMap="VipGroupCategory">
  26. SELECT vgc.* FROM vip_group_category vgc
  27. WHERE vgc.del_flag_!= 1 and tenant_id_ = #{tenantId}
  28. ORDER BY id_
  29. </select>
  30. <select id="findAllByOrgan" resultMap="VipGroupCategory">
  31. SELECT vgc.*,vgdcup.online_classes_unit_price_,vgdcup.offline_classes_unit_price_ FROM vip_group_category vgc
  32. LEFT JOIN vip_group_default_classes_unit_price_ vgdcup ON vgc.id_=vgdcup.vip_group_category_id_ AND FIND_IN_SET(vgdcup.organ_id_,#{organId})
  33. WHERE vgc.del_flag_ != 1
  34. ORDER BY id_
  35. </select>
  36. <select id="findTeacherDefaultSalary" resultMap="VipGroupCategory">
  37. SELECT
  38. vgc.*,
  39. tdvgs.offline_classes_salary_ online_classes_unit_price_,
  40. tdvgs.offline_classes_salary_ offline_classes_unit_price_
  41. FROM
  42. vip_group_category vgc
  43. LEFT JOIN teacher_default_vip_group_salary tdvgs ON vgc.id_ = tdvgs.vip_group_category_id_ AND tdvgs.user_id_=#{userId}
  44. WHERE
  45. vgc.del_flag_ = 0
  46. ORDER BY
  47. id_
  48. </select>
  49. <!-- 向数据库增加一条记录 -->
  50. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.VipGroupCategory"
  51. useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  52. INSERT INTO vip_group_category
  53. (id_,name_,del_flag_,create_time_,update_time_,single_class_minutes_,student_num_,music_theory_,tenant_id_)
  54. VALUES(#{id},#{name},#{delFlag},#{createTime},NOW(),#{singleClassMinutes},#{studentNum},#{musicTheory},#{tenantId})
  55. </insert>
  56. <!-- 根据主键查询一条记录 -->
  57. <update id="update" parameterType="com.ym.mec.biz.dal.entity.VipGroupCategory">
  58. UPDATE vip_group_category
  59. <set>
  60. <if test="delFlag != null">
  61. del_flag_ = #{delFlag},
  62. </if>
  63. <if test="studentNum != null">
  64. student_num_ = #{studentNum},
  65. </if>
  66. <if test="id != null">
  67. id_ = #{id},
  68. </if>
  69. <if test="singleClassMinutes != null">
  70. single_class_minutes_ = #{singleClassMinutes},
  71. </if>
  72. <if test="name != null">
  73. name_ = #{name},
  74. </if>
  75. <if test="createTime != null">
  76. create_time_ = #{createTime},
  77. </if>
  78. <if test="musicTheory != null">
  79. music_theory_ = #{musicTheory},
  80. </if>
  81. update_time_ = NOW(),
  82. </set>
  83. WHERE id_ = #{id} and tenant_id_ = #{tenantId}
  84. </update>
  85. <!-- 根据主键删除一条记录 -->
  86. <delete id="delete">
  87. DELETE FROM vip_group_category WHERE id_ =
  88. #{id}
  89. </delete>
  90. <!-- 分页查询 -->
  91. <select id="queryPage" resultMap="VipGroupCategory"
  92. parameterType="map">
  93. SELECT * FROM vip_group_category where del_flag_ != 1 and tenant_id_ = #{tenantId} ORDER BY id_
  94. <include refid="global.limit" />
  95. </select>
  96. <!-- 查询当前表的总记录数 -->
  97. <select id="queryCount" resultType="int">
  98. SELECT COUNT(*) FROM vip_group_category where del_flag_ != 1 and tenant_id_ = #{tenantId}
  99. </select>
  100. <select id="findConditionCategorys" resultType="com.ym.mec.biz.dal.dto.ConditionDto">
  101. select id_ id,name_ `name` from vip_group_category where del_flag_ != 1
  102. </select>
  103. <select id="findByIds" resultType="com.ym.mec.biz.dal.entity.VipGroupCategory">
  104. SELECT * FROM vip_group_category WHERE del_flag_ = 0 AND id_ IN
  105. <foreach collection="categoryIds" open="(" close=")" item="id" separator=",">
  106. #{id}
  107. </foreach>
  108. </select>
  109. </mapper>