yujian
2019-09-06 f8673ebf787de77a9d4af41cf5e9913b0230471b
新版品牌信息
2个文件已修改
13个文件已添加
913 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandInfoMapper.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandInfoRecordMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandInfo.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandInfoRecord.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/brand/BrandInfoException.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoMapper.xml 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoRecordMapper.xml 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoRecordServiceImpl.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandInfoRecordService.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandInfoService.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/brand/BrandInfoVO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/search/SearchKeyVO.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java
@@ -591,7 +591,7 @@
                }
                
                BrandInfo brandInfo = new BrandInfo();
                brandInfo.setId(taoBaoShop.getShopId());
                brandInfo.setId(taoBaoShop.getId());
                brandInfo.setName(taoBaoShop.getShopName());
                brandInfo.setIcon(taoBaoShop.getShopIcon());
                list.add(brandInfo);
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java
@@ -367,15 +367,15 @@
        }
        
        JSONObject params = new JSONObject();
        params.put("url", "http://apph5.yeshitv.com/AppPage/1.8.0/all_help_content.html?id=204");
        params.put("url", configService.get("search_discovery_h5_link"));
        
        JSONObject root = new JSONObject();
        root.put("picture", "http://img.flqapp.com/resource/home_search_found.png");
        root.put("params", params);
        root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("integralExchange",
        root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("web",
                Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())));
        
        root.put("jumpResult", jumpDetailV2Service.getByTypeCache("web",
        root.put("jumpResult", jumpDetailV2Service.getByTypeCache("search_goods_result",
                Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())));
        root.put("keyList", array);
        return root;
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandInfoMapper.java
New file
@@ -0,0 +1,35 @@
package com.yeshi.fanli.dao.mybatis.brand;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.brand.BrandInfo;
import com.yeshi.fanli.vo.brand.BrandInfoVO;
public interface BrandInfoMapper extends BaseMapper<BrandInfo> {
    int deleteBatchByPrimaryKey(List<Long> list);
    /**
     * 查询返回前端品牌
     * @param start
     * @param count
     * @param cid
     * @return
     */
    List<BrandInfoVO> listBrandInfoVO(@Param("start")long start, @Param("count")int count,@Param("cid") Long cid);
    long countBrandInfo(@Param("cid") Long cid);
    /**
     * 查询有效店铺
     * @param cid
     * @return
     */
    List<BrandInfoVO> listValidBrandInfoCache(@Param("cid") Long cid);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandInfoRecordMapper.java
New file
@@ -0,0 +1,37 @@
package com.yeshi.fanli.dao.mybatis.brand;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.brand.BrandInfoRecord;
public interface BrandInfoRecordMapper extends BaseMapper<BrandInfoRecord> {
    /**
     * 将状态更新为删除状态
     * @param uid
     * @return
     */
    void updateState(@Param("brandId") Long brandId, @Param("uid") Long uid, @Param("device") String device);
    /**
     *  查询记录
     * @param uid
     * @return
     */
    BrandInfoRecord getRecord(@Param("brandId") Long brandId, @Param("uid") Long uid, @Param("device") String device);
    /**
     *  查询历史记录
     * @param uid
     * @return
     */
    List<BrandInfoRecord> listRecord(@Param("start") long start, @Param("count") int count,
            @Param("uid") Long uid, @Param("device") String device);
    long countRecord(@Param("uid") Long uid, @Param("device") String device);
}
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandInfo.java
New file
@@ -0,0 +1,123 @@
package com.yeshi.fanli.entity.brand;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
/**
 * 品牌信息
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_brand_info")
public class BrandInfo implements Serializable{
    private static final long serialVersionUID = 1L;
    @Expose
    @Column(name = "bf_id")
    private Long id;
    @Column(name = "bf_cid")
    private BrandClass brandClass;// 分类
    @Expose
    @Column(name = "bf_name")
    private String name; // 品牌名称
    @Expose
    @Column(name = "bf_icon")
    private String icon; // 品牌logo
    @Column(name = "bf_weight")
    private Double weight; // 权重:值越大越前
    @Column(name = "bf_state")
    private Integer state;// 状态:0停用 1启用
    @Column(name = "bf_create_time")
    private Date createTime;
    @Column(name = "bf_update_time")
    private Date updateTime;
    public BrandInfo() {}
    public BrandInfo(Long id) {
        this.id = id;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public BrandClass getBrandClass() {
        return brandClass;
    }
    public void setBrandClass(BrandClass brandClass) {
        this.brandClass = brandClass;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getIcon() {
        return icon;
    }
    public void setIcon(String icon) {
        this.icon = icon;
    }
    public Double getWeight() {
        return weight;
    }
    public void setWeight(Double weight) {
        this.weight = weight;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandInfoRecord.java
New file
@@ -0,0 +1,94 @@
package com.yeshi.fanli.entity.brand;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 品牌信息浏览记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_brand_info_record")
public class BrandInfoRecord {
    @Column(name = "bir_id")
    private Long id;
    @Column(name = "bir_bid")
    private BrandInfo brandInfo;// 品牌信息
    @Column(name = "bir_uid")
    private Long uid;
    @Column(name = "bir_device")
    private String device;
    @Column(name = "bir_state")
    private Integer state;// 1已删除 0未删除
    @Column(name = "bir_create_time")
    private Date createTime;
    @Column(name = "bir_update_time")
    private Date updateTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public BrandInfo getBrandInfo() {
        return brandInfo;
    }
    public void setBrandInfo(BrandInfo brandInfo) {
        this.brandInfo = brandInfo;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public String getDevice() {
        return device;
    }
    public void setDevice(String device) {
        this.device = device;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/brand/BrandInfoException.java
New file
@@ -0,0 +1,16 @@
package com.yeshi.fanli.exception.brand;
import com.yeshi.fanli.exception.BaseException;
public class BrandInfoException extends BaseException {
    private static final long serialVersionUID = 1L;
    public BrandInfoException(int code, String msg) {
        super(code, msg);
    }
    public BrandInfoException() {
        super();
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoMapper.xml
New file
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.brand.BrandInfoMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.brand.BrandInfo">
    <id column="bf_id" property="id" jdbcType="BIGINT"/>
    <result column="bf_name" property="name" jdbcType="VARCHAR"/>
    <result column="bf_icon" property="icon" jdbcType="VARCHAR"/>
    <result column="bf_weight" property="weight" jdbcType="DOUBLE"/>
    <result column="bf_state" property="state" jdbcType="INTEGER"/>
    <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="bf_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass">
        <id column="bf_cid" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.brand.BrandInfoVO">
    <id column="bf_id" property="id" jdbcType="BIGINT"/>
    <result column="bf_name" property="name" jdbcType="VARCHAR"/>
    <result column="bf_icon" property="icon" jdbcType="VARCHAR"/>
    <result column="bf_weight" property="weight" jdbcType="DOUBLE"/>
    <result column="bf_state" property="state" jdbcType="INTEGER"/>
    <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="bf_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass">
        <id column="bf_cid" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <sql id="Base_Column_List">bf_id,bf_cid,bf_name,bf_icon,bf_weight,bf_state,bf_create_time,bf_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info (bf_id,bf_cid,bf_name,bf_icon,bf_weight,bf_state,bf_create_time,bf_update_time) values (#{id,jdbcType=BIGINT},#{brandClass.id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{weight,jdbcType=DOUBLE},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">bf_id,</if>
      <if test="brandClass != null">bf_cid,</if>
      <if test="name != null">bf_name,</if>
      <if test="icon != null">bf_icon,</if>
      <if test="weight != null">bf_weight,</if>
      <if test="state != null">bf_state,</if>
      <if test="createTime != null">bf_create_time,</if>
      <if test="updateTime != null">bf_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="brandClass != null">#{brandClass.id,jdbcType=BIGINT},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="icon != null">#{icon,jdbcType=VARCHAR},</if>
      <if test="weight != null">#{weight,jdbcType=DOUBLE},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info set bf_cid = #{brandClass.id,jdbcType=BIGINT},bf_name = #{name,jdbcType=VARCHAR},bf_icon = #{icon,jdbcType=VARCHAR},bf_weight = #{weight,jdbcType=DOUBLE},bf_state = #{state,jdbcType=INTEGER},bf_create_time = #{createTime,jdbcType=TIMESTAMP},bf_update_time = #{updateTime,jdbcType=TIMESTAMP} where bf_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info
    <set>
      <if test="brandClass != null">bf_cid=#{brandClass.id,jdbcType=BIGINT},</if>
      <if test="name != null">bf_name=#{name,jdbcType=VARCHAR},</if>
      <if test="icon != null">bf_icon=#{icon,jdbcType=VARCHAR},</if>
      <if test="weight != null">bf_weight=#{weight,jdbcType=DOUBLE},</if>
      <if test="state != null">bf_state=#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">bf_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">bf_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where bf_id = #{id,jdbcType=BIGINT}
  </update>
  <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
    delete from yeshi_ec_brand_info WHERE bf_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
  </delete>
  <select id="listBrandInfoVO" resultMap="ResultVOMap">
      SELECT * FROM yeshi_ec_brand_info d
    WHERE d.`bf_state` = 1 <if test="cid != null">AND d.`bf_cid` = #{cid} </if>
    ORDER BY d.`bf_weight` DESC
    LIMIT ${start},${count}
  </select>
  <select id="countBrandInfo" resultType="Long">
      SELECT IFNULL(COUNT(d.`bf_id`),0) FROM yeshi_ec_brand_info d
    WHERE d.`bf_state` = 1 <if test="cid != null">AND d.`bf_cid` = #{cid} </if>
  </select>
  <select id="listValidBrandInfoCache" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_brand_info d
    WHERE d.`bf_state` = 1 AND d.`bf_cid` = #{cid}
    ORDER BY d.`bf_weight` DESC
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoRecordMapper.xml
New file
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.brand.BrandInfoRecordMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.brand.BrandInfoRecord">
    <id column="bir_id" property="id" jdbcType="BIGINT"/>
    <result column="bir_uid" property="uid" jdbcType="BIGINT"/>
    <result column="bir_device" property="device" jdbcType="VARCHAR"/>
    <result column="bir_state" property="state" jdbcType="INTEGER"/>
    <result column="bir_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bir_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="bir_bid" property="brandInfo"
        resultMap="com.yeshi.fanli.dao.mybatis.brand.BrandInfoMapper.BaseResultMap">
    </association>
  </resultMap>
  <sql id="Base_Column_List">bir_id,bir_bid,bir_uid,bir_device,bir_state,bir_create_time,bir_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_brand_info_record where bir_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_info_record where bir_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandInfoRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info_record (bir_id,bir_bid,bir_uid,bir_device,bir_state,bir_create_time,bir_update_time) values (#{id,jdbcType=BIGINT},#{brandInfo.id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfoRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">bir_id,</if>
      <if test="brandInfo != null">bir_bid,</if>
      <if test="uid != null">bir_uid,</if>
      <if test="device != null">bir_device,</if>
      <if test="state != null">bir_state,</if>
      <if test="createTime != null">bir_create_time,</if>
      <if test="updateTime != null">bir_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="brandInfo != null">#{brandInfo.id,jdbcType=BIGINT},</if>
      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
      <if test="device != null">#{device,jdbcType=VARCHAR},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandInfoRecord">update yeshi_ec_brand_info_record set bir_bid = #{brandInfo.id,jdbcType=BIGINT},bir_uid = #{uid,jdbcType=BIGINT},bir_device = #{device,jdbcType=VARCHAR},bir_state = #{state,jdbcType=INTEGER},bir_create_time = #{createTime,jdbcType=TIMESTAMP},bir_update_time = #{updateTime,jdbcType=TIMESTAMP} where bir_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfoRecord">update yeshi_ec_brand_info_record
    <set>
      <if test="brandInfo != null">bir_bid=#{brandInfo.id,jdbcType=BIGINT},</if>
      <if test="uid != null">bir_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="device != null">bir_device=#{device,jdbcType=VARCHAR},</if>
      <if test="state != null">bir_state=#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">bir_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">bir_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where bir_id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateState">
        update yeshi_ec_brand_info_record set bir_state = 1
        where bir_bid = #{brandId}
               <if test="uid != null">AND bir_uid = #{uid}</if>
             <if test="device != null">AND bir_device = #{device}</if>
  </update>
  <select id="getRecord" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_brand_info_record
    WHERE bir_bid = #{brandId}
          <if test="uid != null">AND bir_uid = #{uid}</if>
            <if test="device != null">AND bir_device = #{device}</if>
    ORDER BY bir_update_time DESC
    LIMIT 1
  </select>
  <select id="listRecord" resultMap="BaseResultMap">
    SELECT * FROM
        (SELECT bir_id FROM yeshi_ec_brand_info_record
        WHERE bir_state = 0
           <if test="uid != null">AND bir_uid = #{uid}</if>
             <if test="device != null">AND bir_device = #{device}</if>
        GROUP BY bir_bid)A
    LEFT JOIN yeshi_ec_brand_info_record h on  A.bir_id = h.bir_id
    LEFT JOIN `yeshi_ec_brand_info` p ON h.`bir_bid` = p.`bf_id`
    ORDER BY  h.bir_update_time DESC
    LIMIT ${start},${count}
  </select>
  <select id="countRecord" resultType="Long">
      SELECT IFNULL(COUNT(DISTINCT bir_bid),0) FROM yeshi_ec_brand_info_record
    WHERE bir_state = 0
         <if test="uid != null">AND bir_uid = #{uid}</if>
           <if test="device != null">AND bir_device = #{device}</if>
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoRecordServiceImpl.java
New file
@@ -0,0 +1,96 @@
package com.yeshi.fanli.service.impl.brand;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.brand.BrandInfoRecordMapper;
import com.yeshi.fanli.entity.brand.BrandInfo;
import com.yeshi.fanli.entity.brand.BrandInfoRecord;
import com.yeshi.fanli.service.inter.brand.BrandInfoRecordService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class BrandInfoRecordServiceImpl implements BrandInfoRecordService {
    @Resource
    private BrandInfoRecordMapper brandInfoRecordMapper;
    @Override
    @Transactional
    public void deleteRecord(List<Long> list, Long uid, String device) {
        if (list == null || list.size() == 0)
            return;
        if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device))
            return;
        // 优先用户为主
        if (uid != null && uid > 0)
            device = null;
        for (long brandId: list) {
            brandInfoRecordMapper.updateState(brandId, uid, device);
        }
    }
    @Override
    public void addRecord(Long brandId, Long uid, String device) {
        if (brandId == null || brandId == 0)
            return;
        if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device))
            return;
        // 优先用户为主
        if (uid != null && uid > 0)
            device = null;
        BrandInfoRecord record = brandInfoRecordMapper.getRecord(brandId, uid, device);
        if (record != null) {
            BrandInfoRecord update = new BrandInfoRecord();
            update.setState(0);
            update.setId(record.getId());
            update.setUpdateTime(new Date());
            brandInfoRecordMapper.updateByPrimaryKeySelective(update);
        } else {
            record = new BrandInfoRecord();
            record.setUid(uid);
            record.setDevice(device);
            record.setBrandInfo(new BrandInfo(brandId));
            record.setCreateTime(new Date());
            record.setUpdateTime(new Date());
            brandInfoRecordMapper.insertSelective(record);
        }
    }
    @Override
    public List<BrandInfoRecord> listRecord(long start, int count, Long uid, String device) {
        if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device))
            return null;
        // 优先用户为主
        if (uid != null && uid > 0)
            device = null;
        return brandInfoRecordMapper.listRecord(start, count, uid, device);
    }
    @Override
    public long countRecord(Long uid, String device) {
        if ((uid == null || uid == 0) && StringUtil.isNullOrEmpty(device))
            return 0;
        // 优先用户为主
        if (uid != null && uid > 0)
            device = null;
        return brandInfoRecordMapper.countRecord(uid, device);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
New file
@@ -0,0 +1,145 @@
package com.yeshi.fanli.service.impl.brand;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.brand.BrandInfoMapper;
import com.yeshi.fanli.entity.brand.BrandInfo;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.exception.brand.BrandInfoException;
import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
import com.yeshi.fanli.service.inter.brand.BrandInfoService;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.vo.brand.BrandInfoVO;
import com.yeshi.fanli.vo.brand.TaoBaoShopVO;
@Service
public class BrandInfoServiceImpl implements BrandInfoService {
    @Resource
    private BrandInfoMapper brandInfoMapper;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private QualityGoodsService qualityGoodsService;
    @Resource
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    @Resource
    private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
    @Resource
    private BrandClassShopService brandClassShopService;
    @Override
    public void saveObject(BrandInfo record) throws BrandInfoException{
        String name = record.getName();
        if (name == null || name.trim().length() == 0)
            throw new BrandInfoException(1, "名称不能为空");
        Integer state = record.getState();
        if (state == null)
            record.setState(0);
        Long id = record.getId();
        if (id == null) {
            record.setCreateTime(new Date());
            record.setUpdateTime(new Date());
            brandInfoMapper.insert(record);
        } else {
            BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id);
            if (resultObj == null)
                throw new BrandInfoException(1, "修改内容已不存在");
            record.setCreateTime(resultObj.getCreateTime());
            record.setUpdateTime(new Date());
            brandInfoMapper.updateByPrimaryKey(record);
        }
    }
    @Override
    public int deleteBatchByPrimaryKey(List<Long> list) {
        return brandInfoMapper.deleteBatchByPrimaryKey(list);
    }
    @Override
    public List<BrandInfo> listQuery(long start, int count, String key, Integer state) {
        return null;
    }
    @Override
    public long countQuery(String key, Integer state) {
        return 0;
    }
    @Override
    @Cacheable(value = "brandCache", key = "'listValidBrandInfoCache-'+#cid")
    public List<BrandInfo> listValidBrandInfoCache(Long cid) {
        List<BrandInfo> listInfo = new ArrayList<BrandInfo>();
        List<TaoBaoShop> listShop = brandClassShopService.listEffectiveClassShop(cid);
        if (listShop == null || listShop.size() == 0)
            return listInfo;
        for (TaoBaoShop taoBaoShop : listShop) {
            BrandInfo brandInfo = new BrandInfo();
            brandInfo.setId(taoBaoShop.getId());
            brandInfo.setName(taoBaoShop.getShopName());
            brandInfo.setIcon(taoBaoShop.getShopIcon());
            listInfo.add(brandInfo);
        }
        return listInfo;
    }
    @Override
    @Cacheable(value = "brandCache", key = "'listBrandInfoCache-'+#start+'-'+#start +'-'+#cid")
    public List<BrandInfoVO> listBrandInfoCache(long start, int count, Long cid) {
        List<BrandInfoVO> listInfo = new ArrayList<BrandInfoVO>();
        List<TaoBaoShopVO> listShop = brandClassShopService.listEffectiveShop(start, count, cid);
        if (listShop == null || listShop.size() == 0)
            return listInfo;
        for (TaoBaoShopVO taoBaoShopVO : listShop) {
            String shopNameCustom = taoBaoShopVO.getShopNameCustom();
            if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
                taoBaoShopVO.setShopName(shopNameCustom);
            }
            String shopIconCustom = taoBaoShopVO.getShopIconCustom();
            if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
                taoBaoShopVO.setShopIcon(shopIconCustom);
            }
            BrandInfoVO brandInfoVO = new BrandInfoVO();
            brandInfoVO.setId(taoBaoShopVO.getId());
            brandInfoVO.setName(taoBaoShopVO.getShopName());
            brandInfoVO.setIcon(taoBaoShopVO.getShopIcon());
            brandInfoVO.setListGoods(taoBaoShopVO.getListGoodsVO());
            listInfo.add(brandInfoVO);
        }
        return listInfo;
    }
    @Override
    public long countBrandInfo(Long cid){
        return brandClassShopService.countBrandShopinfo(cid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandInfoRecordService.java
New file
@@ -0,0 +1,43 @@
package com.yeshi.fanli.service.inter.brand;
import java.util.List;
import com.yeshi.fanli.entity.brand.BrandInfoRecord;
/**
 *   店铺足迹
 *
 * @author Administrator
 *
 */
public interface BrandInfoRecordService {
    /**
     * 足迹列表
     * @param start
     * @param count
     * @param uid
     * @return
     */
    public List<BrandInfoRecord> listRecord(long start, int count, Long uid, String device);
    public long countRecord(Long uid, String device);
    /**
     * 添加历史记录
     * @param shopId
     * @param uid
     * @param device
     */
    public void addRecord(Long brandId, Long uid, String device);
    /**
     * 删除足迹
     * @param list
     * @param uid
     * @param device
     */
    public void deleteRecord(List<Long> list, Long uid, String device);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandInfoService.java
New file
@@ -0,0 +1,74 @@
package com.yeshi.fanli.service.inter.brand;
import java.util.List;
import com.yeshi.fanli.entity.brand.BrandInfo;
import com.yeshi.fanli.exception.brand.BrandClassException;
import com.yeshi.fanli.exception.brand.BrandInfoException;
import com.yeshi.fanli.vo.brand.BrandInfoVO;
/**
 * 品牌信息
 *
 * @author Administrator
 *
 */
public interface BrandInfoService {
    /**
     * 保存品牌信息
     * @param record
     * @throws BrandClassException
     * @throws Exception
     */
    public void saveObject(BrandInfo record) throws BrandInfoException;
    /**
     * 批量删除
     * @param list
     * @return
     */
    public int deleteBatchByPrimaryKey(List<Long> list);
    /**
     * 查询列表
     * @param start
     * @param count
     * @param key
     * @param state
     * @return
     */
    public List<BrandInfo> listQuery(long start, int count, String key, Integer state);
    public long countQuery(String key, Integer state);
    /**
     * 查询品牌返回前端
     * @param start
     * @param count
     * @param cid
     * @return
     * @throws BrandInfoException
     */
    public List<BrandInfoVO> listBrandInfoCache(long start, int count, Long cid);
    /**
     * 品牌数量
     * @param cid
     * @return
     * @throws BrandInfoException
     */
    public long countBrandInfo(Long cid);
    /**
     * 有效店铺
     * @param cid
     * @return
     */
    public  List<BrandInfo> listValidBrandInfoCache(Long cid);
}
fanli/src/main/java/com/yeshi/fanli/vo/brand/BrandInfoVO.java
New file
@@ -0,0 +1,26 @@
package com.yeshi.fanli.vo.brand;
import java.io.Serializable;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.entity.brand.BrandInfo;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
public class BrandInfoVO extends BrandInfo implements Serializable{
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    @Expose
    private List<GoodsDetailVO> listGoods;
    public List<GoodsDetailVO> getListGoods() {
        return listGoods;
    }
    public void setListGoods(List<GoodsDetailVO> listGoods) {
        this.listGoods = listGoods;
    }
}
fanli/src/main/java/com/yeshi/fanli/vo/search/SearchKeyVO.java
New file
@@ -0,0 +1,30 @@
package com.yeshi.fanli.vo.search;
import java.io.Serializable;
import com.google.gson.annotations.Expose;
public class SearchKeyVO implements Serializable {
    private static final long serialVersionUID = 1L;
    // 搜索词
    @Expose
    private String name;
    // 跳转参数
    @Expose
    private String params;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getParams() {
        return params;
    }
    public void setParams(String params) {
        this.params = params;
    }
}