You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

164 line
4.6 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.WxCampaignMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCampaign">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
  8. <result column="title" jdbcType="VARCHAR" property="title" />
  9. <result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
  10. <result column="use_price" jdbcType="INTEGER" property="usePrice" />
  11. <result column="discount_price" jdbcType="INTEGER" property="discountPrice" />
  12. <result column="detail" jdbcType="VARCHAR" property="detail" />
  13. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" />
  14. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" />
  15. <result column="img_detail" jdbcType="VARCHAR" property="imgDetail" />
  16. <result column="type" jdbcType="INTEGER" property="type" />
  17. <result column="coupon_ids" jdbcType="VARCHAR" property="couponIds" />
  18. <result column="mechant_id" jdbcType="BIGINT" property="mechantId" />
  19. <result column="sort_num" jdbcType="INTEGER" property="sortNum" />
  20. <result column="status" jdbcType="INTEGER" property="status" />
  21. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  22. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  23. <result column="html" jdbcType="VARCHAR" property="html" />
  24. </resultMap>
  25. <sql id="allColumns">
  26. `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`,
  27. `mechant_id`,`sort_num`,`status`,`create_time`,`update_time`,`html`
  28. </sql>
  29. <sql id="allCHeadColumns">
  30. `id`,`tenant_id`,`cover_img`,`title`,`type`,`sort_num`
  31. </sql>
  32. <sql id="allAHeadColumns">
  33. `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`,
  34. `mechant_id`,`sort_num`,`status`,`create_time`,`update_time`
  35. </sql>
  36. <sql id="dynamicWhereConditions">
  37. where 1 = 1
  38. <if test=" null != id ">
  39. and `id` = #{id}
  40. </if>
  41. <if test=" null != tenantId ">
  42. and `tenant_id` = #{tenantId}
  43. </if>
  44. <if test=" null != coverImg ">
  45. and `cover_img` like concat('%', #{coverImg},'%')
  46. </if>
  47. <if test=" null != title ">
  48. and `title` like concat('%', #{title},'%')
  49. </if>
  50. <if test=" null != subTitle ">
  51. and `sub_title` like concat('%', #{subTitle},'%')
  52. </if>
  53. <if test=" null != usePrice ">
  54. and `use_price` = #{usePrice}
  55. </if>
  56. <if test=" null != discountPrice ">
  57. and `discount_price` = #{discountPrice}
  58. </if>
  59. <if test=" null != detail ">
  60. and `detail` like concat('%', #{detail},'%')
  61. </if>
  62. <if test=" null != validStartDate ">
  63. and `valid_start_date` = #{validStartDate}
  64. </if>
  65. <if test=" null != validEndDate ">
  66. and `valid_end_date` = #{validEndDate}
  67. </if>
  68. <if test=" null != imgDetail ">
  69. and `img_detail` like concat('%', #{imgDetail},'%')
  70. </if>
  71. <if test=" null != type ">
  72. and `type` = #{type}
  73. </if>
  74. <if test=" null != couponIds ">
  75. and `coupon_ids` like concat('%', #{couponIds},'%')
  76. </if>
  77. <if test=" null != mechantId ">
  78. and `mechant_id` = #{mechantId}
  79. </if>
  80. <if test=" null != sortNum ">
  81. and `sort_num` = #{sortNum}
  82. </if>
  83. <if test=" null != status ">
  84. and `status` = #{status}
  85. </if>
  86. <if test=" null != createTime ">
  87. and `create_time` = #{createTime}
  88. </if>
  89. <if test=" null != updateTime ">
  90. and `update_time` = #{updateTime}
  91. </if>
  92. <if test=" null != ids ">
  93. and id in
  94. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  95. #{idItem}
  96. </foreach>
  97. </if>
  98. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  99. </sql>
  100. <select id="findList" parameterType="com.iformall.domain.po.WxCampaign" resultMap="BaseResultMap">
  101. select <include refid="allAHeadColumns" /> from wx_campaign
  102. <include refid="dynamicWhereConditions" />
  103. </select>
  104. <select id="findCList" parameterType="com.iformall.domain.po.WxCampaign" resultMap="BaseResultMap">
  105. select <include refid="allCHeadColumns" /> from wx_campaign
  106. <include refid="dynamicWhereConditions" />
  107. </select>
  108. <select id="getMaxSortNum" parameterType="java.lang.String" resultType="java.lang.Integer">
  109. select max(sort_num) from wx_campaign where `tenant_id` = #{tenantId}
  110. </select>
  111. </mapper>