BrandMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.ruoyi.demo.mapper.BrandMapper">
  6. <resultMap type="com.ruoyi.demo.entity.Brand" id="BrandResult">
  7. <result property="brandId" column="brand_id"/>
  8. <result property="brandImg" column="brand_img"/>
  9. <result property="brandName" column="brand_name"/>
  10. <result property="industryCode" column="industry_code"/>
  11. <result property="enterpriseUsci" column="enterprise_usci"/>
  12. <result property="perCapitaConsumption" column="per_capita_consumption"/>
  13. <result property="commentCount" column="comment_count"/>
  14. <result property="score" column="score"/>
  15. <result property="menuInfo" column="menu_info"/>
  16. <result property="indexScore" column="index_score"/>
  17. <result property="contact" column="contact"/>
  18. <result property="telephone" column="telephone"/>
  19. <result property="createDate" column="create_date"/>
  20. <result property="audit" column="audit"/>
  21. <result property="collectPerson" column="collect_person"/>
  22. <result property="collectTime" column="collect_time"/>
  23. <result property="enterTime" column="enter_time"/>
  24. <result property="updateTime" column="update_time"/>
  25. <result property="hash" column="hash"/>
  26. <result property="showDelete" column="show_delete"/>
  27. </resultMap>
  28. <resultMap type="com.ruoyi.demo.entity.bo.BrandSearch" id="BrandSearchResult">
  29. <result property="brandId" column="brand_id"/>
  30. <result property="brandImg" column="brand_img"/>
  31. <result property="brandName" column="brand_name"/>
  32. <result property="indexScore" column="index_score"/>
  33. <result property="enterpriseName" column="enterprise_usci"/>
  34. <result property="coverCityCount" column="cover_city_count"/>
  35. <result property="total" column="total"/>
  36. <result property="updateTime" column="update_time"/>
  37. </resultMap>
  38. <resultMap type="com.ruoyi.demo.entity.bo.BrandAddrDistribution" id="AddrDisResult">
  39. <result property="addrCode" column="addr_code"/>
  40. <result property="count" column="count"/>
  41. </resultMap>
  42. <select id="searchByIndustryCodeList" resultMap="BrandResult">
  43. select * from ddt_brand where manage_type_code = #{manageTypeCode} and brand_id <![CDATA[<>]]> #{brandId} and show_delete=0
  44. </select>
  45. <select id="searchSearchByMulti" resultMap="BrandSearchResult">
  46. SELECT
  47. db.brand_id as brand_id,
  48. db.brand_name as brand_name,
  49. brand_img,
  50. enterprise_usci,
  51. index_score,
  52. cover_city_count,
  53. total,
  54. bbs.update_time as update_time
  55. FROM
  56. `ddt_brand` db,
  57. `bl_brand_statistics` bbs
  58. WHERE
  59. bbs.brand_id = db.brand_id and show_delete=0
  60. <if test="text != null">
  61. AND db.brand_name LIKE concat('%',#{text},'%')
  62. </if>
  63. <if test="industryCode != null">
  64. <foreach collection="industryCode" item="industry_code" open="AND db.industry_code IN (" separator="," close=")">
  65. #{industry_code,jdbcType=VARCHAR}
  66. </foreach>
  67. </if>
  68. <if test="countDown != null">
  69. AND #{countDown} <![CDATA[<=]]> total
  70. </if>
  71. <if test="countUp">
  72. AND total <![CDATA[<=]]> #{countUp}
  73. </if>
  74. <if test="coverDown != null">
  75. AND #{coverDown} <![CDATA[<=]]> cover_city_count
  76. </if>
  77. <if test="coverUp != null">
  78. AND cover_city_count <![CDATA[<=]]> #{coverUp}
  79. </if>
  80. </select>
  81. <select id="list" parameterType="com.ruoyi.demo.entity.vo.BrandVo" resultType="com.ruoyi.demo.entity.Brand">
  82. select * from ddt_brand
  83. <where>
  84. <if test="brand.showDelete != -1">
  85. and show_delete = #{brand.showDelete}
  86. </if>
  87. <if test="brand.industryCode != null and brand.industryCode != ''">
  88. and industry_code = #{brand.industryCode}
  89. </if>
  90. <if test="brand.brandName != null and brand.brandName != ''">
  91. and brand_name like concat('%',#{brand.brandName},'%')
  92. </if>
  93. </where>
  94. </select>
  95. <update id="recoverBrand" parameterType="java.lang.String" >
  96. update ddt_brand set show_delete = 0 where brand_id = #{brand_id}
  97. </update>
  98. <select id="selectCountByYear" resultType="java.lang.Integer">
  99. SELECT
  100. COUNT(*)
  101. FROM
  102. `ddt_brand`
  103. WHERE
  104. show_delete = 0
  105. AND DATE_FORMAT(create_date, '%Y') = #{year}
  106. <if test="industryCodes != null">
  107. <foreach collection="industryCodes" item="code" open="AND industry_code in (" separator="," close=")">
  108. #{code,jdbcType=VARCHAR}
  109. </foreach>
  110. </if>;
  111. </select>
  112. </mapper>