|
@@ -3,115 +3,23 @@
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.ruoyi.demo.mapper.BrandDao">
|
|
<mapper namespace="com.ruoyi.demo.mapper.BrandDao">
|
|
- <resultMap type="com.ruoyi.demo.entity.Brand" id="BrandResult">
|
|
|
|
- <result property="brandId" column="brand_id"/>
|
|
|
|
- <result property="brandImg" column="brand_img"/>
|
|
|
|
- <result property="brandName" column="brand_name"/>
|
|
|
|
- <result property="industryCode" column="industry_code"/>
|
|
|
|
- <result property="enterpriseUsci" column="enterprise_usci"/>
|
|
|
|
- <result property="perCapitaConsumption" column="per_capita_consumption"/>
|
|
|
|
- <result property="commentCount" column="comment_count"/>
|
|
|
|
- <result property="score" column="score"/>
|
|
|
|
- <result property="menuInfo" column="menu_info"/>
|
|
|
|
- <result property="indexScore" column="index_score"/>
|
|
|
|
- <result property="createDate" column="create_date"/>
|
|
|
|
- <result property="audit" column="audit"/>
|
|
|
|
- <result property="collectPerson" column="collect_person"/>
|
|
|
|
- <result property="collectTime" column="collect_time"/>
|
|
|
|
- <result property="enterTime" column="enter_time"/>
|
|
|
|
- <result property="updateTime" column="update_time"/>
|
|
|
|
- <result property="hash" column="hash"/>
|
|
|
|
- </resultMap>
|
|
|
|
- <select id="searchAll" resultMap="BrandResult">
|
|
|
|
- select * from ddt_brand
|
|
|
|
- </select>
|
|
|
|
- <update id="updatePerCapitaConsumptionByBrandId">
|
|
|
|
- UPDATE `ddt_brand`
|
|
|
|
- SET per_capita_consumption = (
|
|
|
|
- SELECT
|
|
|
|
- ROUND(
|
|
|
|
- SUM(per_capita_consumption) / COUNT(*),
|
|
|
|
- 2
|
|
|
|
- )
|
|
|
|
- FROM
|
|
|
|
- `ddt_store_wd`
|
|
|
|
- WHERE
|
|
|
|
- brand_id = #{brandId}
|
|
|
|
- )
|
|
|
|
- WHERE
|
|
|
|
- brand_id = #{brandId};
|
|
|
|
- </update>
|
|
|
|
- <update id="updateScoreByBrandId">
|
|
|
|
- UPDATE `ddt_brand`
|
|
|
|
- SET score = (
|
|
|
|
- SELECT
|
|
|
|
- ROUND(SUM(score) / COUNT(*), 2)
|
|
|
|
- FROM
|
|
|
|
- `ddt_store_wd`
|
|
|
|
- WHERE
|
|
|
|
- brand_id = #{brandId}
|
|
|
|
- )
|
|
|
|
- WHERE
|
|
|
|
- brand_id = #{brandId};
|
|
|
|
- </update>
|
|
|
|
- <update id="updateCommentCountByBrandId">
|
|
|
|
- UPDATE `ddt_brand`
|
|
|
|
- SET comment_count = (
|
|
|
|
- SELECT
|
|
|
|
- FLOOR(
|
|
|
|
- SUM(comment_count) / COUNT(*)
|
|
|
|
- )
|
|
|
|
- FROM
|
|
|
|
- `ddt_store_wd`
|
|
|
|
- WHERE
|
|
|
|
- brand_id = #{brandId}
|
|
|
|
- )
|
|
|
|
- WHERE
|
|
|
|
- brand_id = #{brandId};
|
|
|
|
- </update>
|
|
|
|
- <update id="updateIndexScoreByBrandId">
|
|
|
|
- UPDATE `ddt_brand`
|
|
|
|
- SET index_score = (
|
|
|
|
- SELECT
|
|
|
|
- ROUND(
|
|
|
|
- SUM(index_score) / COUNT(*),
|
|
|
|
- 2
|
|
|
|
- )
|
|
|
|
- FROM
|
|
|
|
- `ddt_store_wd`
|
|
|
|
- WHERE
|
|
|
|
- brand_id = #{brandId}
|
|
|
|
- )
|
|
|
|
- WHERE
|
|
|
|
- brand_id = #{brandId};
|
|
|
|
- </update>
|
|
|
|
- <select id="searchList" resultMap="BrandResult">
|
|
|
|
- select * from ddt_brand where brand_name like concat("%",#{text},"%")
|
|
|
|
- </select>
|
|
|
|
- <select id="searchById" resultMap="BrandResult">
|
|
|
|
- select * from ddt_brand where brand_id = #{brandId}
|
|
|
|
- </select>
|
|
|
|
- <select id="searchByIndustryCodeList" resultMap="BrandResult">
|
|
|
|
- select * from ddt_brand where industry_code = #{industryCode} and brand_id <![CDATA[<>]]> #{brandId}
|
|
|
|
- </select>
|
|
|
|
- <select id="searchNotIns" resultMap="BrandResult">
|
|
|
|
- SELECT
|
|
|
|
- *
|
|
|
|
|
|
+ <select id="selectAllId" resultType="java.lang.String">
|
|
|
|
+ SELECT DISTINCT
|
|
|
|
+ brand_id
|
|
FROM
|
|
FROM
|
|
`ddt_brand`
|
|
`ddt_brand`
|
|
- <where>
|
|
|
|
- <if test="notIns != null">
|
|
|
|
- <foreach collection="notIns" item="ontIn" open="brand_id NOT IN (" separator="," close=")">
|
|
|
|
- #{ontIn,jdbcType=VARCHAR}
|
|
|
|
- </foreach>
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
|
|
+ WHERE show_delete = 0;
|
|
</select>
|
|
</select>
|
|
- <select id="selectAllId" resultType="java.lang.String">
|
|
|
|
|
|
+ <select id="selectAllByNotIn" resultType="java.lang.String">
|
|
SELECT DISTINCT
|
|
SELECT DISTINCT
|
|
brand_id
|
|
brand_id
|
|
FROM
|
|
FROM
|
|
`ddt_brand`
|
|
`ddt_brand`
|
|
- WHERE show_delete = 0;
|
|
|
|
|
|
+ WHERE show_delete = 0
|
|
|
|
+ <if test="notIns != null">
|
|
|
|
+ <foreach collection="notIns" item="notIn" open="AND brand_id NOT IN (" separator="," close=")">
|
|
|
|
+ #{notIn,jdbcType=VARCHAR}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
</mapper>
|
|
</mapper>
|