audit.sql.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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="auditSqlMapper">
  4. <sql id="base_column">
  5. t_advertiser.id as id,
  6. t_industry.id as industryId,
  7. t_advertiser.name as name,
  8. t_advertiser.reg_name as regName,
  9. t_advertiser.homepage as homePage,
  10. t_advertiser.contacts,
  11. t_advertiser.tel as tel,
  12. t_advertiser.email as email,
  13. t_advertiser.updated as updated,
  14. t_advertiser.cpi_path as cpiPath,
  15. t_advertiser.licence_path as licencePath,
  16. t_advertiser.id_path as idPath,
  17. t_advertiser.org_path as orgPath,
  18. t_advertiser.check_account as checkAccount,
  19. t_advertiser.check_status as checkStatus,
  20. t_advertiser.check_memo as checkMemo
  21. </sql>
  22. <select id="selectByParamsback" parameterType="map" resultType="com.cloudcross.ssp.model.Audit">
  23. select
  24. <include refid="base_column" />
  25. ,t_adv_agent.name as agentName,t_industry.name as industryName
  26. from t_adv_agent,t_industry,t_advertiser
  27. where t_adv_agent.id=t_advertiser.agent_id
  28. <if test="key!=null and value!=null">
  29. <choose>
  30. <when test="key=='name'">
  31. and t_advertiser.name like #{value}
  32. </when>
  33. </choose>
  34. </if>
  35. <if test="checkStatus!=null">
  36. and t_advertiser.check_status = #{checkStatus}
  37. </if>
  38. <if test="industryId!=null">
  39. and t_advertiser.industry_id = #{industryId}
  40. </if>
  41. and t_advertiser.status != -1
  42. and t_advertiser.industry_id = t_industry.id
  43. order by t_advertiser.id desc
  44. limit #{pager.offset}, #{pager.limit}
  45. </select>
  46. <select id="selectByParamsoperator" parameterType="map" resultType="com.cloudcross.ssp.model.Audit">
  47. select
  48. <include refid="base_column" />
  49. ,b.name as industryName, count(c.advertiser_id) as orderNum from t_industry b,t_advertiser left join t_order c
  50. on t_advertiser.id = c.advertiser_id
  51. where 1 = 1
  52. <if test="key!=null and value!=null">
  53. <choose>
  54. <when test="key=='name'">
  55. and t_advertiser.name like #{value}
  56. </when>
  57. </choose>
  58. </if>
  59. <if test="checkStatus!=null">
  60. and t_advertiser.check_status = #{checkStatus}
  61. </if>
  62. <if test="industryId!=null">
  63. and t_advertiser.industry_id = #{industryId}
  64. </if>
  65. and t_advertiser.status != -1
  66. and t_advertiser.industry_id = b.id
  67. group by t_advertiser.id
  68. order by t_advertiser.id desc
  69. limit #{pager.offset}, #{pager.limit}
  70. </select>
  71. <select id="countByParamsback" parameterType="map" resultType="int">
  72. select count(a.id)
  73. from t_advertiser a,t_adv_agent b
  74. where b.id=a.agent_id
  75. and a.status != -1
  76. <if test="key!=null and value!=null">
  77. <choose>
  78. <when test="key=='name'">
  79. and a.name like #{value}
  80. </when>
  81. </choose>
  82. </if>
  83. <if test="checkStatus!=null">
  84. and a.check_status = #{checkStatus}
  85. </if>
  86. <if test="industryId!=null">
  87. and a.industry_id = #{industryId}
  88. </if>
  89. </select>
  90. <select id="countByParamsoperator" parameterType="map" resultType="int">
  91. select count(a.id)
  92. from t_advertiser a where status != -1
  93. <if test="key!=null and value!=null">
  94. <choose>
  95. <when test="key=='name'">
  96. and a.name like #{value}
  97. </when>
  98. </choose>
  99. </if>
  100. <if test="checkStatus!=null">
  101. and a.check_status = #{checkStatus}
  102. </if>
  103. <if test="industryId!=null">
  104. and a.industry_id = #{industryId}
  105. </if>
  106. </select>
  107. <!--
  108. from t_advertiser a,t_adv_agent b
  109. where b.id=a.agent_id
  110. and a.status != -1
  111. <select id="selectByStatus" parameterType="map" resultType="audit">
  112. select
  113. <include refid="base_column" />
  114. ,b.name as industryName, count(c.advertiser_id) as orderNum from t_industry b,t_advertiser left join t_order c
  115. on t_advertiser.id = c.advertiser_id
  116. where 1 = 1
  117. and t_advertiser.check_status = #{checkStatus}
  118. and t_advertiser.industry_id = b.id
  119. group by t_advertiser.id
  120. order by t_advertiser.id desc
  121. limit #{pager.offset}, #{pager.limit}
  122. </select>
  123. -->
  124. <select id="selectByIdback" parameterType="int" resultType="com.cloudcross.ssp.model.Audit">
  125. select
  126. <include refid="base_column" />
  127. ,t_industry.name as industryName
  128. from t_advertiser,t_industry
  129. where t_industry.id = t_advertiser.industry_id and t_advertiser.id = #{id}
  130. <!-- from t_advertiser
  131. <where>
  132. id = #{id}
  133. </where> -->
  134. </select>
  135. <select id="selectByIdoperator" parameterType="int" resultType="com.cloudcross.ssp.model.Audit">
  136. select
  137. <include refid="base_column" />
  138. from t_advertiser
  139. <where>
  140. id = #{id}
  141. </where>
  142. </select>
  143. <select id="selectByStatus" parameterType="map" resultType="com.cloudcross.ssp.model.Audit">
  144. select
  145. <include refid="base_column" />
  146. ,b.name as industryName, count(c.advertiser_id) as orderNum from t_industry b,t_advertiser left join t_order c
  147. on t_advertiser.id = c.advertiser_id
  148. where 1 = 1
  149. and t_advertiser.check_status = #{checkStatus}
  150. and t_advertiser.industry_id = b.id
  151. group by t_advertiser.id
  152. order by t_advertiser.id desc
  153. limit #{pager.offset}, #{pager.limit}
  154. </select>
  155. <select id="countByStatus" parameterType="map" resultType="int">
  156. select count(a.id)
  157. from t_advertiser a where check_status = #{checkStatus}
  158. </select>
  159. <!-- <update id="updateStatus" parameterType="HashMap">
  160. update t_advertiser
  161. set check_status = #{checkStatus},updated = #{modifyDate}
  162. where t_advertiser.id in
  163. <foreach item="advertiserId" collection="advertiserIdList"
  164. open="(" separator="," close=")">
  165. #{auditId}
  166. </foreach>
  167. </update>
  168. -->
  169. <update id="updateCheckStatus" parameterType="HashMap">
  170. update t_advertiser
  171. set check_status = #{checkStatus},updated = NOW(),check_memo = #{checkMemo}
  172. where t_advertiser.id =#{auditId}
  173. </update>
  174. <update id="updateStatus" parameterType="HashMap">
  175. update t_advertiser
  176. set check_status = #{checkStatus},updated = #{modifyDate}
  177. where t_advertiser.id in
  178. <foreach item="advertiserId" collection="advertiserIdList"
  179. open="(" separator="," close=")">
  180. #{advertiserId}
  181. </foreach>
  182. </update>
  183. <!-- 导出Excel用 -->
  184. <select id="findDeliverEffectAnalysis" parameterType="map" resultType="com.cloudcross.ssp.model.Audit">
  185. select
  186. <include refid="base_column" />
  187. ,t_adv_agent.name as agentName,t_industry.name as industryName
  188. from t_adv_agent,t_industry,t_advertiser
  189. where t_adv_agent.id=t_advertiser.agent_id
  190. <if test="key!=null and value!=null">
  191. <choose>
  192. <when test="key=='name'">
  193. and t_advertiser.name like #{value}
  194. </when>
  195. </choose>
  196. </if>
  197. <if test="checkStatus!=null">
  198. and t_advertiser.check_status = #{checkStatus}
  199. </if>
  200. <if test="industryId!=null">
  201. and t_advertiser.industry_id = #{industryId}
  202. </if>
  203. and t_advertiser.status != -1
  204. and t_advertiser.industry_id = t_industry.id
  205. order by t_advertiser.id desc
  206. </select>
  207. </mapper>