選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 

141 行
6.3 KiB

  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.iformall.mapper.TtCouponMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.TtCoupon">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="type" jdbcType="INTEGER" property="type"/>
  9. <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
  10. <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
  11. <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/>
  12. <result column="title" jdbcType="VARCHAR" property="title"/>
  13. <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
  14. <result column="video_id" jdbcType="VARCHAR" property="videoId"/>
  15. <result column="video_time" jdbcType="INTEGER" property="videoTime"/>
  16. <result column="html" jdbcType="VARCHAR" property="html"/>
  17. <result column="is_landscape" jdbcType="INTEGER" property="isLandscape"/>
  18. <result column="is_payment" jdbcType="INTEGER" property="isPayment"/>
  19. <result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
  20. <result column="orig_price" jdbcType="INTEGER" property="origPrice"/>
  21. <result column="is_preview" jdbcType="INTEGER" property="isPreview"/>
  22. <result column="preview_duration" jdbcType="INTEGER" property="previewDuration"/>
  23. <result column="detail" jdbcType="VARCHAR" property="detail"/>
  24. <result column="false_sell_count" jdbcType="INTEGER" property="falseSellCount"/>
  25. <result column="dy_title" jdbcType="VARCHAR" property="dyTitle"/>
  26. <result column="inventory" jdbcType="INTEGER" property="inventory"/>
  27. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  28. <result column="status" jdbcType="INTEGER" property="status"/>
  29. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  30. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  31. <result column="see_count" jdbcType="INTEGER" property="seeCount"/>
  32. <result column="sell_count" jdbcType="INTEGER" property="sellCount"/>
  33. <result column="assess_count" jdbcType="INTEGER" property="assessCount"/>
  34. <result column="collect_count" jdbcType="INTEGER" property="collectCount"/>
  35. <result column="is_del" jdbcType="INTEGER" property="isDel"/>
  36. <result column="column_id" jdbcType="BIGINT" property="columnId"/>
  37. <result column="popularity" jdbcType="INTEGER" property="popularity"/>
  38. <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
  39. <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
  40. <result column="business_id" jdbcType="BIGINT" property="businessId"/>
  41. <result column="business_name" jdbcType="VARCHAR" property="businessName"/>
  42. </resultMap>
  43. <sql id="allColumns">
  44. `id`, `tenant_id`, `parent_tenant_id`, `type`, `cover_img`, `cover_picture`, `detail_picture`,
  45. `title`, `sub_title`, `video_id`, `video_time`, `html`, `is_landscape`, `is_payment`,
  46. `sale_price`, `orig_price`, `is_preview`, `preview_duration`, `detail`, `false_sell_count`,
  47. `dy_title`, `inventory`, `remark`, `status`, `create_date`, `update_date`,
  48. `see_count`, `sell_count`, `assess_count`, `collect_count`, `is_del`,
  49. `column_id`, `popularity`, `merchant_id`, `merchant_name`, `business_id`, `business_name`
  50. </sql>
  51. <sql id="dynamicWhereConditions">
  52. where `is_del` = 0
  53. <if test=" null != id ">
  54. and `id` = #{id}
  55. </if>
  56. <if test=" null != tenantId and '' != tenantId">
  57. and `tenant_id` = #{tenantId}
  58. </if>
  59. <if test=" null != parentTenantId and '' != parentTenantId">
  60. and `parent_tenant_id` = #{parentTenantId}
  61. </if>
  62. <if test=" null != type ">
  63. and `type` = #{type}
  64. </if>
  65. <if test=" null != title and ''!=title">
  66. and `title` like concat('%', #{title},'%')
  67. </if>
  68. <if test=" null != isLandscape ">
  69. and `is_landscape` = #{isLandscape}
  70. </if>
  71. <if test=" null != isPayment ">
  72. and `is_payment` = #{isPayment}
  73. </if>
  74. <if test=" null != isPreview ">
  75. and `is_preview` = #{isPreview}
  76. </if>
  77. <if test=" null != status">
  78. and `status` = #{status}
  79. </if>
  80. <if test=" null != startdate and null!=enddate">
  81. and `create_date` between #{startdate} and #{enddate}
  82. </if>
  83. <if test=" null != businessId ">
  84. and `business_id` = #{businessId}
  85. </if>
  86. <if test=" null != merchantId ">
  87. and `merchant_id` = #{merchantId}
  88. </if>
  89. <if test=" null != ids ">
  90. and id in
  91. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  92. #{idItem}
  93. </foreach>
  94. </if>
  95. <if test=" null != sortColumns">order by ${sortColumns}</if>
  96. </sql>
  97. <select id="findList" parameterType="com.iformall.domain.po.TtCoupon" resultMap="BaseResultMap">
  98. select
  99. <include refid="allColumns"/>
  100. from tt_coupon
  101. <include refid="dynamicWhereConditions"/>
  102. </select>
  103. <select id="selectById" parameterType="Long" resultMap="BaseResultMap">
  104. select <include refid="allColumns"/> from tt_coupon where id = #{id}
  105. </select>
  106. <delete id="deleteById" parameterType="Long">
  107. update tt_coupon set is_del = 1, update_date=now() where id = #{id}
  108. </delete>
  109. <update id="addSeeCount" parameterType="Long">
  110. update tt_coupon SET see_count = see_count+1, update_date=now() where id = #{id}
  111. </update>
  112. <update id="addSellCount" parameterType="Long">
  113. update tt_coupon SET sell_count = sell_count+1, false_sell_count = false_sell_count+1, update_date=now() where id = #{id}
  114. </update>
  115. <update id="reduceSellCount" parameterType="Long">
  116. update tt_coupon SET sell_count = sell_count-1, update_date=now() where id = #{id}
  117. </update>
  118. </mapper>