StoreInfoMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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="shop.alien.mapper.StoreInfoMapper">
  6. <!--
  7. 门店证照查询
  8. 证照类型与状态、提交时间、到期时间映射关系:
  9. - img_type = 14: 营业执照
  10. - img_type IN (31, 32): 娱乐经营许可证
  11. - img_type IN (24, 25): 食品经营许可证
  12. -->
  13. <select id="getStoreLicensePage"
  14. resultType="shop.alien.entity.store.vo.StoreLicenseInfoVo">
  15. SELECT
  16. CASE
  17. WHEN si.img_type = 14 THEN '营业执照'
  18. WHEN si.img_type IN (31, 32) THEN '娱乐经营许可证'
  19. WHEN si.img_type IN (24, 25) THEN '食品经营许可证'
  20. WHEN si.img_type IN (33) THEN '身份证正面'
  21. WHEN si.img_type IN (34) THEN '身份证反面'
  22. ELSE ''
  23. END AS img_description,
  24. si.img_type AS img_type,
  25. s.id AS id,
  26. s.store_name AS store_name,
  27. s.store_tel AS store_tel,
  28. su.name AS name,
  29. si.img_url,
  30. s.business_section_name,
  31. s.business_classify_name,
  32. s.business_types_name,
  33. CASE
  34. WHEN si.img_type = 14 THEN s.business_license_status
  35. WHEN si.img_type IN (31, 32) THEN s.entertainment_licence_status
  36. WHEN si.img_type IN (24, 25) THEN s.food_licence_status
  37. WHEN si.img_type IN (33, 34) THEN s.id_card_status
  38. ELSE ''
  39. END AS states,
  40. CASE
  41. WHEN si.img_type = 14 THEN s.update_business_license_time
  42. WHEN si.img_type IN (31, 32) THEN s.update_entertainment_licence_time
  43. WHEN si.img_type IN (24, 25) THEN s.update_food_licence_time
  44. WHEN si.img_type IN (33, 34) THEN s.update_id_card_time
  45. ELSE NULL
  46. END AS submit_date,
  47. CASE
  48. WHEN si.img_type = 14 THEN s.business_license_expiration_time
  49. WHEN si.img_type IN (31, 32) THEN s.entertainment_licence_expiration_time
  50. WHEN si.img_type IN (24, 25) THEN s.food_licence_expiration_time
  51. WHEN si.img_type IN (33, 34) THEN s.id_card_expiration_time
  52. ELSE NULL
  53. END AS expiration_time,
  54. CASE
  55. WHEN si.img_type = 14 THEN s.business_license_reason
  56. WHEN si.img_type IN (31, 32) THEN s.entertainment_licence_reason
  57. WHEN si.img_type IN (24, 25) THEN s.food_licence_reason
  58. WHEN si.img_type IN (33, 34) THEN s.id_card_reason
  59. ELSE NULL
  60. END AS expiration_reason
  61. FROM store_info s
  62. LEFT JOIN store_img si
  63. ON s.id = si.store_id
  64. AND si.img_type IN (14, 24, 25, 31, 32, 33, 34)
  65. AND si.delete_flag = 0
  66. left join store_user su on s.id = su.store_id
  67. WHERE s.delete_flag = 0
  68. <if test="storeName != null and storeName != ''">
  69. AND s.store_name LIKE CONCAT('%', #{storeName}, '%')
  70. </if>
  71. <if test="storeContact != null and storeContact != ''">
  72. AND su.name LIKE CONCAT('%', #{storeContact}, '%')
  73. </if>
  74. <if test="storeTel != null and storeTel != ''">
  75. AND s.store_tel LIKE CONCAT('%', #{storeTel}, '%')
  76. </if>
  77. <if test="businessSection != null and businessSection != ''">
  78. AND s.business_section = #{businessSection}
  79. </if>
  80. <if test="imgType != null">
  81. AND si.img_type = #{imgType}
  82. </if>
  83. <if test="states != null and states != ''">
  84. AND (
  85. (si.img_type = 14 AND s.business_license_status = #{states})
  86. OR (si.img_type IN (31, 32) AND s.entertainment_licence_status = #{states})
  87. OR (si.img_type IN (24, 25) AND s.food_licence_status = #{states})
  88. )
  89. </if>
  90. <if test="startSubmitDate != null and startSubmitDate != ''">
  91. AND (
  92. (si.img_type = 14 AND s.update_business_license_time &gt;= #{startSubmitDate})
  93. OR (si.img_type IN (31, 32) AND s.update_entertainment_licence_time &gt;= #{startSubmitDate})
  94. OR (si.img_type IN (24, 25) AND s.update_food_licence_time &gt;= #{startSubmitDate})
  95. )
  96. </if>
  97. <if test="endSubmitDate != null and endSubmitDate != ''">
  98. AND (
  99. (si.img_type = 14 AND s.update_business_license_time &lt;= #{endSubmitDate})
  100. OR (si.img_type IN (31, 32) AND s.update_entertainment_licence_time &lt;= #{endSubmitDate})
  101. OR (si.img_type IN (24, 25) AND s.update_food_licence_time &lt;= #{endSubmitDate})
  102. )
  103. </if>
  104. ORDER BY s.store_name ASC
  105. </select>
  106. </mapper>