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.
 
 
 
 
 

123 lines
4.9 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.iformall.mapper.WxLegionActivityMerchantConfigMapper">
  6. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLegionActivityMerchantConfig">
  7. <id property="id" column="id" jdbcType="BIGINT"/>
  8. <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
  9. <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/>
  10. <result property="activityId" column="activity_id" jdbcType="BIGINT"/>
  11. <result property="legionId" column="legion_id" jdbcType="BIGINT"/>
  12. <result property="merchantId" column="merchant_id" jdbcType="BIGINT"/>
  13. <result property="unionId" column="union_id" jdbcType="BIGINT"/>
  14. <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
  15. <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
  16. </resultMap>
  17. <sql id="allColumns">
  18. id,tenant_id,parent_tenant_id,
  19. activity_id,legion_id,merchant_id,
  20. union_id,create_date,update_date
  21. </sql>
  22. <sql id="dynamicWhereConditions">
  23. where 1 = 1
  24. <if test=" null != id ">
  25. and `id` = #{id}
  26. </if>
  27. <if test=" null != tenantId and '' != tenantId">
  28. and `tenant_id` = #{tenantId}
  29. </if>
  30. <if test=" null != parentTenantId and '' != parentTenantId">
  31. and `parent_tenant_id` = #{parentTenantId}
  32. </if>
  33. <if test=" null != activityId ">
  34. and `activity_id` = #{activityId}
  35. </if>
  36. <if test=" null != legionId ">
  37. and `legion_id` = #{legionId}
  38. </if>
  39. <if test=" null != merchantId ">
  40. and `merchant_id` = #{merchantId}
  41. </if>
  42. <if test=" null != unionId ">
  43. and `union_id` = #{unionId}
  44. </if>
  45. <if test=" null != ids ">
  46. and id in
  47. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  48. #{idItem}
  49. </foreach>
  50. </if>
  51. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  52. </sql>
  53. <select id="findList" parameterType="com.iformall.domain.po.WxLegionActivityMerchantConfig" resultMap="BaseResultMap">
  54. select <include refid="allColumns" /> from wx_legion_activity_merchant_config
  55. <include refid="dynamicWhereConditions" />
  56. </select>
  57. <delete id="deleteConfig" parameterType="java.util.HashMap">
  58. delete from wx_legion_activity_merchant_config
  59. where `activity_id` = #{activityId}
  60. <if test=" null != tenantId and '' != tenantId">
  61. and `tenant_id` = #{tenantId}
  62. </if>
  63. </delete>
  64. <insert id="insertList" parameterType="java.util.List">
  65. insert into wx_legion_activity_merchant_config
  66. (id,
  67. activity_id,legion_id,merchant_id,
  68. union_id,create_date,update_date)
  69. values
  70. <foreach collection="configList" item="item" index="index" separator=",">
  71. (#{item.id,jdbcType=BIGINT},
  72. #{item.activityId,jdbcType=BIGINT},#{item.legionId,jdbcType=BIGINT},#{item.merchantId,jdbcType=BIGINT},
  73. #{item.unionId,jdbcType=BIGINT},#{item.createDate,jdbcType=TIMESTAMP},#{item.updateDate,jdbcType=TIMESTAMP})
  74. </foreach>
  75. </insert>
  76. <select id="findActivityCount" parameterType="com.iformall.domain.po.WxLegionActivityMerchantConfig" resultType="com.iformall.domain.vo.LegionActivityCount">
  77. select activity_id as 'activityId',
  78. count(1) as 'count'
  79. from wx_legion_activity_merchant_config
  80. where 1 = 1
  81. <if test=" null != tenantId and '' != tenantId">
  82. and `tenant_id` = #{tenantId}
  83. </if>
  84. <if test=" null != parentTenantId and '' != parentTenantId">
  85. and `parent_tenant_id` = #{parentTenantId}
  86. </if>
  87. <if test=" null != activityId ">
  88. and `activity_id` = #{activityId}
  89. </if>
  90. <if test=" null != activityIdList ">
  91. and `activity_id` in
  92. <foreach collection="activityIdList" index="index" item="idItem" open="(" separator="," close=")">
  93. #{idItem}
  94. </foreach>
  95. </if>
  96. group by activity_id
  97. </select>
  98. <delete id="deleteByIds" parameterType="com.iformall.domain.po.WxLegionActivityMerchantConfig">
  99. delete from wx_legion_activity_merchant_config
  100. where `activity_id` = #{activityId}
  101. <if test=" null != tenantId and '' != tenantId">
  102. and `tenant_id` = #{tenantId}
  103. </if>
  104. <if test=" null != ids ">
  105. and id in
  106. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  107. #{idItem}
  108. </foreach>
  109. </if>
  110. </delete>
  111. </mapper>