TenantAssetsInfoMapper.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. <mapper namespace="com.ym.mec.biz.dal.dao.TenantAssetsInfoDao">
  4. <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.TenantAssetsInfo">
  5. <id column="id_" jdbcType="INTEGER" property="id"/>
  6. <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
  7. <result column="balance_" jdbcType="VARCHAR" property="balance"/>
  8. <result column="frozen_amount_" jdbcType="VARCHAR" property="frozenAmount"/>
  9. <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
  10. <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
  11. </resultMap>
  12. <sql id="Base_Column_List">
  13. id_
  14. , tenant_id_, balance_, frozen_amount_, created_time_, updated_time_
  15. </sql>
  16. <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
  17. parameterType="com.ym.mec.biz.dal.entity.TenantAssetsInfo">
  18. insert into tenant_assets_info(tenant_id_, balance_, frozen_amount_, created_time_, updated_time_)
  19. values
  20. <foreach collection="entities" item="entity" separator=",">
  21. (#{entity.tenantId}, #{entity.balance}, #{entity.frozenAmount}, #{entity.createdTime},
  22. #{entity.updatedTime})
  23. </foreach>
  24. </insert>
  25. <update id="deductAmount" parameterType="object">
  26. update tenant_assets_info
  27. set balance_ = balance_ - #{deductAmount}
  28. where tenant_id_ = #{tenantId}
  29. </update>
  30. <update id="checkDeductAmount" parameterType="object">
  31. update tenant_assets_info
  32. set balance_ = balance_ - #{deductAmount}
  33. where tenant_id_ = #{tenantId}
  34. and balance_ <![CDATA[ >= ]]> #{deductAmount}
  35. </update>
  36. <update id="updateAmount">
  37. update tenant_assets_info set balance_ = balance_ + #{amount} where tenant_id_ = #{tenantId}
  38. </update>
  39. <select id="queryPeopleNum" parameterType="integer" resultType="integer">
  40. select c.student_num_ +1
  41. from course_schedule as a
  42. left join vip_group as b
  43. on a.music_group_id_ = b.id_
  44. left join vip_group_category as c on b.vip_group_category_id_ = c.id_
  45. where a.id_ =#{courseId}
  46. </select>
  47. </mapper>