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.
 
 
 
 
 

129 rivejä
3.8 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.simple.mapper.WxCampaignMapper">
  4. <resultMap id="BaseResultMap" type="com.simple.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. </resultMap>
  21. <sql id="allColumns">
  22. `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`,`mechant_id`,`sort_num`
  23. </sql>
  24. <sql id="dynamicWhereConditions">
  25. where 1 = 1
  26. <if test=" null != id ">
  27. and `id` = #{id}
  28. </if>
  29. <if test=" null != tenantId ">
  30. and `tenant_id` like concat('%', #{tenantId},'%')
  31. </if>
  32. <if test=" null != coverImg ">
  33. and `cover_img` like concat('%', #{coverImg},'%')
  34. </if>
  35. <if test=" null != title ">
  36. and `title` like concat('%', #{title},'%')
  37. </if>
  38. <if test=" null != subTitle ">
  39. and `sub_title` like concat('%', #{subTitle},'%')
  40. </if>
  41. <if test=" null != usePrice ">
  42. and `use_price` = #{usePrice}
  43. </if>
  44. <if test=" null != discountPrice ">
  45. and `discount_price` = #{discountPrice}
  46. </if>
  47. <if test=" null != detail ">
  48. and `detail` like concat('%', #{detail},'%')
  49. </if>
  50. <if test=" null != validStartDate ">
  51. and `valid_start_date` = #{validStartDate}
  52. </if>
  53. <if test=" null != validEndDate ">
  54. and `valid_end_date` = #{validEndDate}
  55. </if>
  56. <if test=" null != imgDetail ">
  57. and `img_detail` like concat('%', #{imgDetail},'%')
  58. </if>
  59. <if test=" null != type ">
  60. and `type` = #{type}
  61. </if>
  62. <if test=" null != couponIds ">
  63. and `coupon_ids` like concat('%', #{couponIds},'%')
  64. </if>
  65. <if test=" null != mechantId ">
  66. and `mechant_id` = #{mechantId}
  67. </if>
  68. <if test=" null != sortNum ">
  69. and `sort_num` = #{sortNum}
  70. </if>
  71. <if test=" null != ids ">
  72. and id in
  73. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  74. #{idItem}
  75. </foreach>
  76. </if>
  77. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  78. </sql>
  79. <select id="findList" parameterType="com.simple.domain.po.WxCampaign" resultMap="BaseResultMap">
  80. select <include refid="allColumns" /> from wx_campaign
  81. <include refid="dynamicWhereConditions" />
  82. </select>
  83. <select id="getMaxSortNum" parameterType="java.lang.String" resultType="java.lang.Integer">
  84. select max(sort_num) from wx_campaign where `tenant_id` = #{tenantId}
  85. </select>
  86. </mapper>