CloudCoachPaymentProgramMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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.CloudCoachPaymentProgramDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.CloudCoachPaymentProgram" id="CloudCoachPaymentProgram">
  9. <result column="id_" property="id" />
  10. <result column="name_" property="name" />
  11. <result column="remark_" property="remark" />
  12. <result column="member_num_" property="memberNum" />
  13. <result column="user_num_" property="userNum" />
  14. <result column="payment_user_num_" property="paymentUserNum" />
  15. <result column="period_" property="period" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  16. <result column="member_rank_setting_id_" property="memberRankSettingId" />
  17. <result column="actual_amount_" property="actualAmount" />
  18. <result column="original_amount_" property="originalAmount" />
  19. <result column="operator_" property="operator" />
  20. <result column="operator_name_" property="operatorName" />
  21. <result column="create_time_" property="createTime" />
  22. <result column="update_time_" property="updateTime" />
  23. <result column="tenant_id_" property="tenantId" />
  24. <result column="audit_" property="audit" />
  25. <result column="audit_name_" property="auditName" />
  26. <result column="audit_time_" property="auditTime" />
  27. <result column="organ_id_" property="organId" />
  28. <result column="organ_name_" property="organName" />
  29. <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  30. </resultMap>
  31. <!-- 根据主键查询一条记录 -->
  32. <select id="get" resultMap="CloudCoachPaymentProgram" >
  33. SELECT * FROM cloud_coach_payment_program WHERE id_ = #{id}
  34. </select>
  35. <!-- 全查询 -->
  36. <select id="findAll" resultMap="CloudCoachPaymentProgram">
  37. SELECT * FROM cloud_coach_payment_program ORDER BY id_
  38. </select>
  39. <!-- 向数据库增加一条记录 -->
  40. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CloudCoachPaymentProgram" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  41. INSERT INTO cloud_coach_payment_program (name_,remark_,member_num_,user_num_,
  42. payment_user_num_,period_,member_rank_setting_id_,actual_amount_,original_amount_,
  43. operator_,create_time_,update_time_,tenant_id_,memo_,status_,organ_id_)
  44. VALUES(#{name},#{remark},#{memberNum},#{userNum},#{paymentUserNum},#{period,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  45. #{memberRankSettingId},#{actualAmount},#{originalAmount},#{operator},
  46. NOW(),NOW(),#{tenantId},#{memo},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{organId})
  47. </insert>
  48. <!-- 根据主键查询一条记录 -->
  49. <update id="update" parameterType="com.ym.mec.biz.dal.entity.CloudCoachPaymentProgram">
  50. UPDATE cloud_coach_payment_program <set>
  51. <if test="status != null">
  52. status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  53. </if>
  54. <if test="memo != null">
  55. memo_ = #{memo},
  56. </if>
  57. <if test="organId != null">
  58. organ_id_ = #{organId},
  59. </if>
  60. <if test="audit != null">
  61. audit_ = #{audit},
  62. </if>
  63. <if test="auditTime != null">
  64. audit_time_ = #{auditTime},
  65. </if>
  66. <if test="operator != null">
  67. operator_ = #{operator},
  68. </if>
  69. <if test="memberNum != null">
  70. member_num_ = #{memberNum},
  71. </if>
  72. <if test="tenantId != null">
  73. tenant_id_ = #{tenantId},
  74. </if>
  75. <if test="paymentUserNum != null">
  76. payment_user_num_ = #{paymentUserNum},
  77. </if>
  78. <if test="originalAmount != null">
  79. original_amount_ = #{originalAmount},
  80. </if>
  81. <if test="name != null">
  82. name_ = #{name},
  83. </if>
  84. <if test="remark != null">
  85. remark_ = #{remark},
  86. </if>
  87. <if test="period != null">
  88. period_ = #{period,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  89. </if>
  90. <if test="userNum != null">
  91. user_num_ = #{userNum},
  92. </if>
  93. <if test="updateTime != null">
  94. update_time_ = #{updateTime},
  95. </if>
  96. <if test="memberRankSettingId != null">
  97. member_rank_setting_id_ = #{memberRankSettingId},
  98. </if>
  99. <if test="actualAmount != null">
  100. actual_amount_ = #{actualAmount},
  101. </if>
  102. </set> WHERE id_ = #{id}
  103. </update>
  104. <!-- 根据主键删除一条记录 -->
  105. <delete id="delete" >
  106. DELETE FROM cloud_coach_payment_program WHERE id_ = #{id}
  107. </delete>
  108. <sql id="queryPageSql">
  109. <where>
  110. <if test="organId != null and organId != ''">
  111. AND FIND_IN_SET(ccpp.organ_id_,#{organId})
  112. </if>
  113. <if test="tenantId != null">
  114. AND ccpp.tenant_id_ = #{tenantId}
  115. </if>
  116. <if test="period != null and period != ''">
  117. AND ccpp.period_ = #{period}
  118. </if>
  119. <if test="status != null and status != ''">
  120. AND ccpp.status_ = #{status}
  121. </if>
  122. <if test="startTime != null and startTime != ''">
  123. AND DATE_FORMAT(ccpp.create_time_,"%Y-%m-%d") >= #{startTime}
  124. </if>
  125. <if test="endTime != null and endTime != ''">
  126. AND DATE_FORMAT(ccpp.create_time_,"%Y-%m-%d") &lt;= #{endTime}
  127. </if>
  128. </where>
  129. </sql>
  130. <!-- 分页查询 -->
  131. <select id="queryPage" resultMap="CloudCoachPaymentProgram" parameterType="map">
  132. SELECT ccpp.*,su.real_name_ operator_name_,su1.real_name_ audit_name_,o.name_ organ_name_
  133. FROM cloud_coach_payment_program ccpp
  134. LEFT JOIN organization o ON o.id_ = ccpp.organ_id_
  135. LEFT JOIN sys_user su ON su.id_ = ccpp.operator_
  136. LEFT JOIN sys_user su1 ON su1.id_ = ccpp.audit_
  137. <include refid="queryPageSql"/>
  138. ORDER BY ccpp.id_ DESC
  139. <include refid="global.limit"/>
  140. </select>
  141. <!-- 查询当前表的总记录数 -->
  142. <select id="queryCount" resultType="int">
  143. SELECT COUNT(DISTINCT ccpp.id_) FROM cloud_coach_payment_program ccpp
  144. LEFT JOIN organization o ON o.id_ = ccpp.organ_id_
  145. <include refid="queryPageSql"/>
  146. </select>
  147. <select id="getLock" resultMap="CloudCoachPaymentProgram">
  148. SELECT * FROM cloud_coach_payment_program WHERE id_ = #{id} FOR UPDATE
  149. </select>
  150. </mapper>