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_name"/>
  34. <result property="enterpriseUsci" column="enterprise_usci"/>
  35. <result property="coverCityCount" column="cover_city_count"/>
  36. <result property="total" column="total"/>
  37. <result property="updateTime" column="update_time"/>
  38. </resultMap>
  39. <resultMap type="com.ruoyi.demo.entity.bo.BrandAddrDistribution" id="AddrDisResult">
  40. <result property="addrCode" column="addr_code"/>
  41. <result property="count" column="count"/>
  42. </resultMap>
  43. <select id="searchByIndustryCodeList" resultMap="BrandResult">
  44. select * from ddt_brand where manage_type_code = #{manageTypeCode} and brand_id <![CDATA[<>]]> #{brandId} and show_delete=0
  45. </select>
  46. <select id="searchSearchByMulti" resultMap="BrandSearchResult">
  47. SELECT
  48. db.brand_id as brand_id,
  49. db.brand_name as brand_name,
  50. brand_img,
  51. enterprise_usci,
  52. enterprise_name,
  53. index_score,
  54. cover_city_count,
  55. total,
  56. bbs.update_time as update_time
  57. FROM
  58. `ddt_brand` db,
  59. `bl_brand_statistics` bbs
  60. WHERE
  61. bbs.brand_id = db.brand_id and show_delete=0
  62. <if test="countDown != null">
  63. AND #{countDown} <![CDATA[<=]]> total
  64. </if>
  65. <if test="countUp">
  66. AND total <![CDATA[<=]]> #{countUp}
  67. </if>
  68. <if test="coverDown != null">
  69. AND #{coverDown} <![CDATA[<=]]> cover_city_count
  70. </if>
  71. <if test="coverUp != null">
  72. AND cover_city_count <![CDATA[<=]]> #{coverUp}
  73. </if>
  74. <if test="text != null">
  75. AND db.brand_name LIKE concat('%',#{text},'%')
  76. </if>
  77. <if test="ew != null">
  78. AND db.enterprise_usci in (select enterprise_usci from ddt_enterprise ${ew.customSqlSegment})
  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>