audit-banner.sql.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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="auditBannerSqlMapper">
  4. <sql id="base_column">
  5. id,
  6. banner_template_id as bannerTemplateId,
  7. order_id as orderId,
  8. campaign_id as campaignId,
  9. adgroup_id as adGroupId,
  10. visit_address as visitAddress,
  11. click_address as clickAddress,
  12. impression_address as impressionAddress
  13. checked,
  14. updated,
  15. memo
  16. </sql>
  17. <select id="countByParams" parameterType="map" resultType="int">
  18. select count(a.id) from t_banner a ,t_banner_template b
  19. <where>
  20. b.status != -1
  21. and a.banner_template_id = b.id
  22. <if test="key!=null and value!=null">
  23. <choose>
  24. <when test="key=='name'">
  25. and b.name like #{value}
  26. </when>
  27. </choose>
  28. </if>
  29. <if test="checked !=null">
  30. and a.checked like #{checked}
  31. </if>
  32. </where>
  33. </select>
  34. <select id="findByParams" parameterType="map" resultMap="AuditBanner">
  35. select a.id as id,a.banner_template_id as bannerTemplateId,a.order_id as orderId,a.campaign_id as campaignId,a.adgroup_id as adGroupId,a.visit_address as visitAddress,a.click_address as clickAddress,a.impression_address as impressionAddress,
  36. a.checked as checked,a.updated as updated,a.memo as memo,
  37. b.id as bannerTemplateId,b.advertiser_id as advertiserId,b.name as name,b.path as path,b.path_small as pathSmall,b.type as type,b.width as width,b.height as height,b.status as status,b.updated as updated ,
  38. (select name from t_advertiser where id=b.advertiser_id) as advertiserName,(select name from t_industry where id = (select industry_id from t_advertiser where id=b.advertiser_id)) as industryName from t_banner a
  39. left join t_banner_template b on a.banner_template_id=b.id
  40. left join t_order c on a.order_id= c.id
  41. left JOIN t_advertiser d on c.advertiser_id = d.id
  42. left join t_industry e on d.industry_id = e.id
  43. <where>
  44. b.status != -1
  45. <if test="key!=null and value!=null">
  46. <choose>
  47. <when test="key=='name'">
  48. and b.name like #{value}
  49. </when>
  50. </choose>
  51. </if>
  52. <if test="checked !=null">
  53. and a.checked like #{checked}
  54. </if>
  55. </where>
  56. order by a.id desc
  57. limit #{pager.offset}, #{pager.limit}
  58. </select>
  59. <select id="findAudit" parameterType="map" resultMap="AuditBanner">
  60. select a.id as id,a.banner_template_id as bannerTemplateId,a.order_id as orderId,a.campaign_id as campaignId,a.adgroup_id as adGroupId,a.visit_address as visitAddress,a.click_address as clickAddress,a.impression_address as impressionAddress,
  61. a.checked as checked,a.updated as updated,a.memo as memo,
  62. b.id as bannerTemplateId,b.advertiser_id as advertiserId,b.name as name,b.path as path,b.path_small as pathSmall,b.type as type,b.width as width,b.height as height,b.status as status,b.updated as updated ,
  63. (select name from t_advertiser where id=b.advertiser_id) as advertiserName,(select name from t_industry where id = (select industry_id from t_advertiser where id=b.advertiser_id)) as industryName from t_banner a
  64. left join t_banner_template b on a.banner_template_id=b.id
  65. left join t_order c on a.order_id= c.id
  66. left JOIN t_advertiser d on c.advertiser_id = d.id
  67. left join t_industry e on d.industry_id = e.id
  68. <where>
  69. b.status != -1
  70. <if test="key!=null and value!=null">
  71. <choose>
  72. <when test="key=='name'">
  73. and b.name like #{value}
  74. </when>
  75. </choose>
  76. </if>
  77. <if test="checked !=null">
  78. and a.checked like #{checked}
  79. </if>
  80. </where>
  81. order by a.id desc
  82. </select>
  83. <resultMap type="com.cloudcross.ssp.model.AuditBanner" id="AuditBanner">
  84. <id property="id" column="id"/>
  85. <result property="bannerTemplateId" column="bannerTemplateId"/>
  86. <result property="orderId" column="orderId"/>
  87. <result property="campaignId" column="campaignId"/>
  88. <result property="adGroupId" column="adGroupId"/>
  89. <result property="visitAddress" column="visitAddress"/>
  90. <result property="clickAddress" column="clickAddress"/>
  91. <result property="impressionAddress" column="impressionAddress"/>
  92. <result property="checked" column="checked"/>
  93. <result property="updated" column="updated"/>
  94. <result property="memo" column="memo"/>
  95. <result property="industryName" column="industryName"/>
  96. <result property="advertiserName" column="advertiserName"/>
  97. <association property="bannerTemplate" javaType="com.cloudcross.ssp.model.BannerTemplate" resultMap="bannerTemplate"/>
  98. </resultMap>
  99. <resultMap type="com.cloudcross.ssp.back.model.BannerTemplate" id="bannerTemplate">
  100. <id property="id" column="bannerTemplateId"/>
  101. <result property="advertiserId" column="advertiserId"/>
  102. <result property="name" column="name"/>
  103. <result property="path" column="path"/>
  104. <result property="pathSmall" column="pathSmall"/>
  105. <result property="type" column="type"/>
  106. <result property="width" column="width"/>
  107. <result property="height" column="height"/>
  108. <result property="status" column="status"/>
  109. <result property="updated" column="updated"/>
  110. </resultMap>
  111. <update id="updateBannerStatus" parameterType="HashMap">
  112. update t_banner a,t_banner_template b
  113. set a.checked=#{checked},b.updated = #{updated},a.updated = #{updated}
  114. <if test="memo != null">
  115. ,a.memo = #{memo}
  116. </if>
  117. where
  118. a.banner_template_id = b.id and
  119. a.id in
  120. <foreach item="id" collection="auditBannerIdList" open="(" separator=","
  121. close=")">
  122. #{id}
  123. </foreach>
  124. </update>
  125. <update id="updateOperatorBannerTime" parameterType="HashMap">
  126. update t_banner_operator
  127. set supdated = #{supdated}
  128. where banner_id in
  129. <foreach item="id" collection="auditBannerIdList" open="(" separator=","
  130. close=")">
  131. #{id}
  132. </foreach>
  133. </update>
  134. </mapper>