StoreApplyReadMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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.slodon.b2b2c.dao.read.seller.StoreApplyReadMapper">
  4. <resultMap id="resultMap" type="com.slodon.b2b2c.seller.pojo.StoreApply">
  5. <id column="apply_id" property="applyId" />
  6. <result column="vendor_id" property="vendorId" />
  7. <result column="vendor_name" property="vendorName" />
  8. <result column="store_id" property="storeId" />
  9. <result column="store_name" property="storeName" />
  10. <result column="store_type" property="storeType" />
  11. <result column="state" property="state" />
  12. <result column="apply_year" property="applyYear" />
  13. <result column="store_grade_id" property="storeGradeId" />
  14. <result column="store_category_id" property="storeCategoryId" />
  15. <result column="submit_time" property="submitTime" />
  16. <result column="refuse_reason" property="refuseReason" />
  17. <result column="audit_info" property="auditInfo" />
  18. <result column="pay_sn" property="paySn" />
  19. <result column="pay_amount" property="payAmount" />
  20. <result column="callback_time" property="callbackTime" />
  21. <result column="trade_sn" property="tradeSn" />
  22. <result column="payment_name" property="paymentName" />
  23. <result column="payment_code" property="paymentCode" />
  24. <result column="apply_time" property="applyTime" />
  25. </resultMap>
  26. <!--按照主键值进行操作-->
  27. <sql id="pkWhere">
  28. WHERE `apply_id` = #{primaryKey}
  29. </sql>
  30. <!--操作条件-->
  31. <sql id="whereCondition">
  32. <if test="example != null">
  33. <trim prefix="WHERE" prefixOverrides="AND|OR">
  34. <if test="example.applyIdNotEquals != null">
  35. AND `apply_id` != #{example.applyIdNotEquals}
  36. </if>
  37. <if test="example.applyIdIn != null">
  38. AND `apply_id` in (${example.applyIdIn})
  39. </if>
  40. <if test="example.vendorId != null">
  41. AND `vendor_id` = #{example.vendorId}
  42. </if>
  43. <if test="example.vendorIdNotEquals != null">
  44. AND `vendor_id` != #{example.vendorIdNotEquals}
  45. </if>
  46. <if test="example.vendorName != null">
  47. AND `vendor_name` = #{example.vendorName}
  48. </if>
  49. <if test="example.vendorNameLike != null">
  50. AND `vendor_name` like concat('%',#{example.vendorNameLike},'%')
  51. </if>
  52. <if test="example.storeId != null">
  53. AND `store_id` = #{example.storeId}
  54. </if>
  55. <if test="example.storeName != null">
  56. AND `store_name` = #{example.storeName}
  57. </if>
  58. <if test="example.storeNameLike != null">
  59. AND `store_name` like concat('%',#{example.storeNameLike},'%')
  60. </if>
  61. <if test="example.storeType != null">
  62. AND `store_type` = #{example.storeType}
  63. </if>
  64. <if test="example.state != null">
  65. AND `state` = #{example.state}
  66. </if>
  67. <if test="example.stateNotEquals != null">
  68. AND `state` != #{example.stateNotEquals}
  69. </if>
  70. <if test="example.applyYear != null">
  71. AND `apply_year` = #{example.applyYear}
  72. </if>
  73. <if test="example.storeGradeId != null">
  74. AND `store_grade_id` = #{example.storeGradeId}
  75. </if>
  76. <if test="example.storeCategoryId != null">
  77. AND `store_category_id` = #{example.storeCategoryId}
  78. </if>
  79. <if test="example.submitTimeAfter != null">
  80. AND `submit_time` <![CDATA[ >= ]]> #{example.submitTimeAfter}
  81. </if>
  82. <if test="example.submitTimeBefore != null">
  83. AND `submit_time` <![CDATA[ <= ]]> #{example.submitTimeBefore}
  84. </if>
  85. <if test="example.refuseReason != null">
  86. AND `refuse_reason` = #{example.refuseReason}
  87. </if>
  88. <if test="example.auditInfo != null">
  89. AND `audit_info` = #{example.auditInfo}
  90. </if>
  91. <if test="example.paySn != null">
  92. AND `pay_sn` = #{example.paySn}
  93. </if>
  94. <if test="example.paySnLike != null">
  95. AND `pay_sn` like concat('%',#{example.paySnLike},'%')
  96. </if>
  97. <if test="example.payAmount != null">
  98. AND `pay_amount` = #{example.payAmount}
  99. </if>
  100. <if test="example.callbackTimeAfter != null">
  101. AND `callback_time` <![CDATA[ >= ]]> #{example.callbackTimeAfter}
  102. </if>
  103. <if test="example.callbackTimeBefore != null">
  104. AND `callback_time` <![CDATA[ <= ]]> #{example.callbackTimeBefore}
  105. </if>
  106. <if test="example.tradeSn != null">
  107. AND `trade_sn` = #{example.tradeSn}
  108. </if>
  109. <if test="example.tradeSnLike != null">
  110. AND `trade_sn` like concat('%',#{example.tradeSnLike},'%')
  111. </if>
  112. <if test="example.paymentName != null">
  113. AND `payment_name` = #{example.paymentName}
  114. </if>
  115. <if test="example.paymentNameLike != null">
  116. AND `payment_name` like concat('%',#{example.paymentNameLike},'%')
  117. </if>
  118. <if test="example.paymentCode != null">
  119. AND `payment_code` = #{example.paymentCode}
  120. </if>
  121. <if test="example.applyTime != null">
  122. AND `apply_time` = #{example.applyTime}
  123. </if>
  124. </trim>
  125. </if>
  126. </sql>
  127. <!--排序条件-->
  128. <sql id="orderBy">
  129. ORDER BY `apply_id` DESC
  130. </sql>
  131. <sql id="orderByOther">
  132. order by ${example.orderBy}
  133. </sql>
  134. <!--分组条件-->
  135. <sql id="groupBy">
  136. group by ${example.groupBy}
  137. </sql>
  138. <!--分页条件-->
  139. <sql id="limit">
  140. <if test="size != null and size &gt; 0">
  141. limit #{startRow},#{size}
  142. </if>
  143. </sql>
  144. <!--查询符合条件的记录数-->
  145. <select id="countByExample" parameterType="com.slodon.b2b2c.seller.example.StoreApplyExample" resultType="java.lang.Integer">
  146. SELECT
  147. COUNT(*)
  148. FROM `store_apply`
  149. <include refid="whereCondition" />
  150. </select>
  151. <!--根据主键查询记录-->
  152. <select id="getByPrimaryKey" resultMap="resultMap">
  153. SELECT
  154. *
  155. FROM `store_apply`
  156. <include refid="pkWhere" />
  157. </select>
  158. <!--查询符合条件的记录(所有字段)-->
  159. <select id="listByExample" resultMap="resultMap">
  160. SELECT
  161. *
  162. FROM `store_apply`
  163. <include refid="whereCondition" />
  164. <if test="example.groupBy != null">
  165. <include refid="groupBy" />
  166. </if>
  167. <choose>
  168. <when test="example.orderBy != null">
  169. <include refid="orderByOther" />
  170. </when>
  171. <otherwise>
  172. <include refid="orderBy" />
  173. </otherwise>
  174. </choose>
  175. </select>
  176. <!--分页查询符合条件的记录(所有字段)-->
  177. <select id="listPageByExample" resultMap="resultMap">
  178. SELECT
  179. *
  180. FROM `store_apply`
  181. <include refid="whereCondition" />
  182. <if test="example.groupBy != null">
  183. <include refid="groupBy" />
  184. </if>
  185. <choose>
  186. <when test="example.orderBy != null">
  187. <include refid="orderByOther" />
  188. </when>
  189. <otherwise>
  190. <include refid="orderBy" />
  191. </otherwise>
  192. </choose>
  193. <include refid="limit" />
  194. </select>
  195. <!--查询符合条件的记录(指定字段)-->
  196. <select id="listFieldsByExample" resultMap="resultMap">
  197. SELECT
  198. ${fields}
  199. FROM `store_apply`
  200. <include refid="whereCondition" />
  201. <if test="example.groupBy != null">
  202. <include refid="groupBy" />
  203. </if>
  204. <choose>
  205. <when test="example.orderBy != null">
  206. <include refid="orderByOther" />
  207. </when>
  208. <otherwise>
  209. <include refid="orderBy" />
  210. </otherwise>
  211. </choose>
  212. </select>
  213. <!--分页查询符合条件的记录(指定字段)-->
  214. <select id="listFieldsPageByExample" resultMap="resultMap">
  215. SELECT
  216. ${fields}
  217. FROM `store_apply`
  218. <include refid="whereCondition" />
  219. <if test="example.groupBy != null">
  220. <include refid="groupBy" />
  221. </if>
  222. <choose>
  223. <when test="example.orderBy != null">
  224. <include refid="orderByOther" />
  225. </when>
  226. <otherwise>
  227. <include refid="orderBy" />
  228. </otherwise>
  229. </choose>
  230. <include refid="limit" />
  231. </select>
  232. <!--获取店铺审核手机号-->
  233. <select id="getVendorMobileByStoreApply" parameterType="java.util.List" resultType="java.lang.String">
  234. select t2.vendor_mobile from store_apply t1, vendor t2 where t1.vendor_id = t2.vendor_id
  235. <if test="ids != null">
  236. and
  237. <foreach collection="ids" open="(" close=")" separator="or" item="id">
  238. t1.apply_id = #{id}
  239. </foreach>
  240. </if>
  241. </select>
  242. <select id="countCnByExample" resultType="java.lang.Integer">
  243. select COUNT(store_apply.apply_id)
  244. from store_apply
  245. left join store_name on store_apply.store_id = store_name.store_id
  246. left join store_site_info on store_name.store_id = store_site_info.store_id
  247. <where>
  248. <if test="example.storeType != null">
  249. and store_apply.store_type = #{example.storeType}
  250. </if>
  251. <if test="example.vendorNameLike != null">
  252. and store_apply.vendor_name like concat('%', #{example.vendorNameLike},'%')
  253. </if>
  254. <if test="example.state != null">
  255. AND store_apply.state = #{example.state}
  256. </if>
  257. <if test="example.stateNotEquals != null">
  258. AND store_apply.state != #{example.stateNotEquals}
  259. </if>
  260. <if test="example.storeNameLike != null">
  261. and store_name.store_name like concat('%',#{example.storeNameLike},'%')
  262. </if>
  263. <if test="example.storeGradeId != null">
  264. and store.site_info.store_grade_id = #{example.storeGradeId}
  265. </if>
  266. </where>
  267. </select>
  268. <select id="listCnPageByExample" resultType="com.slodon.b2b2c.seller.pojo.StoreApply">
  269. select
  270. store_apply.apply_id as applyId,
  271. store_apply.vendor_name as vendorName,
  272. store_apply.state as state,
  273. store_apply.refuse_reason as refuseReason,
  274. store_apply.audit_info as auditInfo,
  275. store_apply.submit_time as submitTime,
  276. store_apply.apply_time as applyTime,
  277. store_name.store_name as storeName,
  278. store_site_info.store_grade_id as storeGradeId,
  279. store_apply.vendor_id as vendorId
  280. from store_apply
  281. left join store_name on store_apply.store_id = store_name.store_id
  282. left join store_site_info on store_name.store_id = store_site_info.store_id
  283. <where>
  284. <if test="example.storeType != null">
  285. and store_apply.store_type = #{example.storeType}
  286. </if>
  287. <if test="example.vendorNameLike != null">
  288. and store_apply.vendor_name like concat('%', #{example.vendorNameLike},'%')
  289. </if>
  290. <if test="example.state != null">
  291. AND store_apply.state = #{example.state}
  292. </if>
  293. <if test="example.stateNotEquals != null">
  294. AND store_apply.state != #{example.stateNotEquals}
  295. </if>
  296. <if test="example.storeNameLike != null">
  297. and store_name.store_name like concat('%',#{example.storeNameLike},'%')
  298. </if>
  299. <if test="example.storeGradeId != null">
  300. and store.site_info.store_grade_id = #{example.storeGradeId}
  301. </if>
  302. </where>
  303. order by store_apply.submit_time desc
  304. <include refid="limit"></include>
  305. </select>
  306. </mapper>