| | |
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap;
|
| | | import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass;
|
| | | import com.yeshi.fanli.exception.FloatADException;
|
| | | import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoClassService taoBaoClassService;
|
| | |
|
| | | @Resource
|
| | | private GoodsSubClassLabelService goodsSubClassLabelService;
|
| | |
|
| | | /**
|
| | | * 保存信息
|
| | |
| | | }
|
| | | goodsSubClass.setTaobaoCids(taobaoCids);
|
| | | }
|
| | |
|
| | | // 查询标签
|
| | | GoodsSubClassLabelMap map = goodsSubClassLabelService.selectBySubClassId(goodsSubClass.getId());
|
| | | if (map != null)
|
| | | goodsSubClass.setClassLabel(map.getLabel());
|
| | |
|
| | | }
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | |
| | | @Column(name = "cs_state")
|
| | | private Integer state;
|
| | |
|
| | | @Column(name = "sex")
|
| | | private Integer sex;//男女 0-部分男女 1-男 2-女
|
| | |
|
| | | |
| | | public Integer getSex() {
|
| | | return sex;
|
| | | }
|
| | |
|
| | | public void setSex(Integer sex) {
|
| | | this.sex = sex;
|
| | | }
|
| | |
|
| | | // 点击次数
|
| | | private Long countClick = 0l;
|
| | | // 关联标签数量
|
| | |
| | |
|
| | | @Column(name = "sub_updatetime")
|
| | | private Date updatetime; // 创建时间
|
| | | @Column(name = "sub_sex")
|
| | | private Integer sex;//性别
|
| | | @Column(name = "sub_month")
|
| | | private String month;//月份
|
| | | |
| | | |
| | | private GoodsSubClassLabel classLabel;//标签
|
| | |
|
| | | |
| | |
|
| | | public GoodsSubClassLabel getClassLabel() {
|
| | | return classLabel;
|
| | | }
|
| | |
|
| | | public void setClassLabel(GoodsSubClassLabel classLabel) {
|
| | | this.classLabel = classLabel;
|
| | | }
|
| | |
|
| | | public Integer getSex() {
|
| | | return sex;
|
| | | }
|
| | |
|
| | | public void setSex(Integer sex) {
|
| | | this.sex = sex;
|
| | | }
|
| | |
|
| | | public String getMonth() {
|
| | | return month;
|
| | | }
|
| | |
|
| | | public void setMonth(String month) {
|
| | | this.month = month;
|
| | | }
|
| | |
|
| | | private Long countClick = 0l;
|
| | | // 关联标签数量
|
| | |
| | | <?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.GoodsClassMapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.GoodsClass">
|
| | | <id column="id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="name" property="name" jdbcType="VARCHAR"/>
|
| | | <result column="picture" property="picture" jdbcType="VARCHAR"/>
|
| | | <result column="url" property="url" jdbcType="VARCHAR"/>
|
| | | <result column="key" property="key" jdbcType="VARCHAR"/>
|
| | | <result column="search_param" property="searchParam" jdbcType="VARCHAR"/>
|
| | | <result column="orderby" property="orderby" jdbcType="INTEGER"/>
|
| | | <result column="createtime" property="createtime" jdbcType="BIGINT"/>
|
| | | <result column="ios_click" property="iosClick" jdbcType="BIGINT"/>
|
| | | <result column="android_click" property="androidClick" jdbcType="BIGINT"/>
|
| | | <result column="cs_state" property="state" jdbcType="INTEGER"/>
|
| | | </resultMap>
|
| | | |
| | | <sql id="Base_Column_List">id,`name`,picture,`key`,search_param,orderby,createtime,ios_click,android_click,cs_state</sql>
|
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
| | | select * from yeshi_ec_class where id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_class where id = #{id,jdbcType=BIGINT}</delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_class (id,`name`,picture,url,`key`,search_param,orderby,createtime,ios_click,android_click,cs_state) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{url,jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{searchParam,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{createtime,jdbcType=BIGINT},#{iosClick,jdbcType=BIGINT},#{androidClick,jdbcType=BIGINT},#{state,jdbcType=INTEGER})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_class
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">id,</if>
|
| | | <if test="name != null">`name`,</if>
|
| | | <if test="picture != null">picture,</if>
|
| | | <if test="url != null">url,</if>
|
| | | <if test="key != null">`key`,</if>
|
| | | <if test="searchParam != null">search_param,</if>
|
| | | <if test="orderby != null">orderby,</if>
|
| | | <if test="createtime != null">createtime,</if>
|
| | | <if test="iosClick != null">ios_click,</if>
|
| | | <if test="androidClick != null">android_click,</if>
|
| | | <if test="state != null">cs_state,</if>
|
| | | </trim>values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if>
|
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
|
| | | <if test="url != null">#{url,jdbcType=VARCHAR},</if>
|
| | | <if test="key != null">#{key,jdbcType=VARCHAR},</if>
|
| | | <if test="searchParam != null">#{searchParam,jdbcType=VARCHAR},</if>
|
| | | <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if>
|
| | | <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if>
|
| | | <if test="iosClick != null">#{iosClick,jdbcType=BIGINT},</if>
|
| | | <if test="androidClick != null">#{androidClick,jdbcType=BIGINT},</if>
|
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">update yeshi_ec_class set `name` = #{name,jdbcType=VARCHAR},picture = #{picture,jdbcType=VARCHAR},url = #{url,jdbcType=VARCHAR},`key` = #{key,jdbcType=VARCHAR},search_param = #{searchParam,jdbcType=VARCHAR},orderby = #{orderby,jdbcType=INTEGER},createtime = #{createtime,jdbcType=BIGINT},ios_click = #{iosClick,jdbcType=BIGINT},android_click = #{androidClick,jdbcType=BIGINT},cs_state = #{state,jdbcType=INTEGER} where id = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">update yeshi_ec_class
|
| | | <set>
|
| | | <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if>
|
| | | <if test="picture != null">picture=#{picture,jdbcType=VARCHAR},</if>
|
| | | <if test="url != null">url=#{url,jdbcType=VARCHAR},</if>
|
| | | <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if>
|
| | | <if test="searchParam != null">search_param=#{searchParam,jdbcType=VARCHAR},</if>
|
| | | <if test="orderby != null">orderby=#{orderby,jdbcType=INTEGER},</if>
|
| | | <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if>
|
| | | <if test="iosClick != null">ios_click=#{iosClick,jdbcType=BIGINT},</if>
|
| | | <if test="androidClick != null">android_click=#{androidClick,jdbcType=BIGINT},</if>
|
| | | <if test="state != null">cs_state=#{state,jdbcType=INTEGER},</if>
|
| | | </set> where id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | |
| | | |
| | | <select id="getKeysById" resultType="java.lang.String">
|
| | | SELECT ec.`key` FROM `yeshi_ec_class` ec WHERE ec.`id` = #{id};
|
| | | </select>
|
| | | |
| | | <select id="listGoodsClassBySystemId" resultMap="BaseResultMap">
|
| | | SELECT c.id,c.name,c.picture,c.url FROM `yeshi_ec_class` c
|
| | | RIGHT JOIN `yeshi_ec_super_goodsclass` sp ON sp.`goodsclass_id` = c.`id`
|
| | | WHERE sp.`system_id` = #{systemId}
|
| | | ORDER BY c.`orderby`
|
| | | </select>
|
| | | |
| | | <select id="getByAdjoinOrder" resultMap="BaseResultMap">
|
| | | SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_class fd |
| | | WHERE 1=1
|
| | | <if test="type == -1">
|
| | | AND fd.`orderby` <![CDATA[<]]> #{order} |
| | | ORDER BY fd.`orderby` desc
|
| | | </if>
|
| | | |
| | | <if test="type == 1">
|
| | | AND fd.`orderby` <![CDATA[>]]> #{order} |
| | | ORDER BY fd.`orderby` |
| | | </if>
|
| | | LIMIT 1
|
| | | </select>
|
| | | |
| | | |
| | | <select id="getGoodsClassAll" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_class rs ORDER BY rs.`orderby`
|
| | | </select>
|
| | | |
| | | <select id="listByName" resultMap="BaseResultMap">
|
| | | SELECT * from yeshi_ec_class rs |
| | | WHERE rs.name like '%#{name}%'
|
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | | |
| | | <select id="countByName" resultType="java.lang.Integer">
|
| | | SELECT IFNULL(COUNT(rs.id),0) FROM yeshi_ec_class rs |
| | | <if test="systemId != null">
|
| | | RIGHT JOIN yeshi_ec_super_goodsclass sp ON sp.`goodsclass_id` = rs.`id` |
| | | </if>
|
| | | WHERE rs.name LIKE '%#{name}%' |
| | | <if test="systemId != null">
|
| | | AND sp.`system_id` = #{systemId}
|
| | | </if>
|
| | | </select>
|
| | | |
| | | <select id="getMaxOrder" resultType="java.lang.Integer">
|
| | | SELECT IFNULL(MAX(orderby),0) FROM `yeshi_ec_class`
|
| | | </select>
|
| | | |
| | | <select id="getEffectiveClass" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_class rs |
| | | WHERE rs.cs_state = 1
|
| | | ORDER BY rs.`orderby`
|
| | | </select>
|
| | | |
| | | </mapper>
|
| | | <?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.GoodsClassMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.GoodsClass"> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="picture" property="picture" jdbcType="VARCHAR" /> |
| | | <result column="url" property="url" jdbcType="VARCHAR" /> |
| | | <result column="key" property="key" jdbcType="VARCHAR" /> |
| | | <result column="search_param" property="searchParam" jdbcType="VARCHAR" /> |
| | | <result column="orderby" property="orderby" jdbcType="INTEGER" /> |
| | | <result column="createtime" property="createtime" jdbcType="BIGINT" /> |
| | | <result column="ios_click" property="iosClick" jdbcType="BIGINT" /> |
| | | <result column="android_click" property="androidClick" |
| | | jdbcType="BIGINT" /> |
| | | <result column="cs_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="sex" property="sex" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,`name`,picture,`key`,search_param,orderby,createtime,ios_click,android_click,cs_state,sex |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long">select * from yeshi_ec_class where id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_class where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_class |
| | | (id,`name`,picture,url,`key`,search_param,orderby,createtime,ios_click,android_click,cs_state,sex) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{url,jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{searchParam,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{createtime,jdbcType=BIGINT},#{iosClick,jdbcType=BIGINT},#{androidClick,jdbcType=BIGINT},#{state,jdbcType=INTEGER},#{sex,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_class |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="name != null">`name`,</if> |
| | | <if test="picture != null">picture,</if> |
| | | <if test="url != null">url,</if> |
| | | <if test="key != null">`key`,</if> |
| | | <if test="searchParam != null">search_param,</if> |
| | | <if test="orderby != null">orderby,</if> |
| | | <if test="createtime != null">createtime,</if> |
| | | <if test="iosClick != null">ios_click,</if> |
| | | <if test="androidClick != null">android_click,</if> |
| | | <if test="state != null">cs_state,</if> |
| | | |
| | | <if test="sex != null">sex,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="url != null">#{url,jdbcType=VARCHAR},</if> |
| | | <if test="key != null">#{key,jdbcType=VARCHAR},</if> |
| | | <if test="searchParam != null">#{searchParam,jdbcType=VARCHAR},</if> |
| | | <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if> |
| | | <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if> |
| | | <if test="iosClick != null">#{iosClick,jdbcType=BIGINT},</if> |
| | | <if test="androidClick != null">#{androidClick,jdbcType=BIGINT},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | |
| | | <if test="sex != null">#{sex,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">update |
| | | yeshi_ec_class set `name` = #{name,jdbcType=VARCHAR},picture = |
| | | #{picture,jdbcType=VARCHAR},url = #{url,jdbcType=VARCHAR},`key` = |
| | | #{key,jdbcType=VARCHAR},search_param = |
| | | #{searchParam,jdbcType=VARCHAR},orderby = |
| | | #{orderby,jdbcType=INTEGER},createtime = |
| | | #{createtime,jdbcType=BIGINT},ios_click = |
| | | #{iosClick,jdbcType=BIGINT},android_click = |
| | | #{androidClick,jdbcType=BIGINT},cs_state = #{state,jdbcType=INTEGER} |
| | | ,sex =#{sex,jdbcType=INTEGER} where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass"> |
| | | update yeshi_ec_class |
| | | <set> |
| | | <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="url != null">url=#{url,jdbcType=VARCHAR},</if> |
| | | <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if> |
| | | <if test="searchParam != null">search_param=#{searchParam,jdbcType=VARCHAR},</if> |
| | | <if test="orderby != null">orderby=#{orderby,jdbcType=INTEGER},</if> |
| | | <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if> |
| | | <if test="iosClick != null">ios_click=#{iosClick,jdbcType=BIGINT},</if> |
| | | <if test="androidClick != null">android_click=#{androidClick,jdbcType=BIGINT},</if> |
| | | <if test="state != null">cs_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="sex !=null">sex =#{sex,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <select id="getKeysById" resultType="java.lang.String">SELECT ec.`key` FROM |
| | | `yeshi_ec_class` ec WHERE ec.`id` = #{id}; |
| | | </select> |
| | | <select id="listGoodsClassBySystemId" resultMap="BaseResultMap">SELECT |
| | | c.id,c.name,c.picture,c.url FROM `yeshi_ec_class` c RIGHT JOIN |
| | | `yeshi_ec_super_goodsclass` sp ON sp.`goodsclass_id` = c.`id` WHERE |
| | | sp.`system_id` = #{systemId} ORDER BY c.`orderby` |
| | | </select> |
| | | <select id="getByAdjoinOrder" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_class fd WHERE 1=1 |
| | | <if test="type == -1">AND |
| | | fd.`orderby` <![CDATA[<]]> |
| | | #{order} ORDER BY fd.`orderby` desc |
| | | </if> |
| | | <if test="type == 1">AND |
| | | fd.`orderby` <![CDATA[>]]> |
| | | #{order} ORDER BY fd.`orderby` |
| | | </if> |
| | | LIMIT 1 |
| | | </select> |
| | | <select id="getGoodsClassAll" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_class rs ORDER BY rs.`orderby` |
| | | </select> |
| | | <select id="listByName" resultMap="BaseResultMap">SELECT * from yeshi_ec_class |
| | | rs WHERE rs.name like '%#{name}%' LIMIT ${start},${count}</select> |
| | | <select id="countByName" resultType="java.lang.Integer"> |
| | | SELECT IFNULL(COUNT(rs.id),0) FROM yeshi_ec_class rs |
| | | <if test="systemId != null">RIGHT JOIN yeshi_ec_super_goodsclass sp ON |
| | | sp.`goodsclass_id` = rs.`id` |
| | | </if> |
| | | WHERE rs.name LIKE '%#{name}%' |
| | | <if test="systemId != null">AND sp.`system_id` = #{systemId}</if> |
| | | </select> |
| | | <select id="getMaxOrder" resultType="java.lang.Integer">SELECT |
| | | IFNULL(MAX(orderby),0) FROM `yeshi_ec_class` |
| | | </select> |
| | | <select id="getEffectiveClass" resultMap="BaseResultMap">SELECT * FROM |
| | | yeshi_ec_class rs WHERE rs.cs_state = 1 ORDER BY rs.`orderby` |
| | | </select> |
| | | </mapper> |
| | |
| | | jdbcType="BIGINT" /> |
| | | <result column="sub_createtime" property="createtime" jdbcType="TIMESTAMP" /> |
| | | <result column="sub_updatetime" property="updatetime" jdbcType="TIMESTAMP" /> |
| | | <result column="sub_sex" property="sex" jdbcType="INTEGER" /> |
| | | <result column="sub_month" property="month" jdbcType="VARCHAR" /> |
| | | <association property="rootClass" column="sub_root_id" |
| | | select="com.yeshi.fanli.dao.mybatis.GoodsClassMapper.selectByPrimaryKey" /> |
| | | <association property="parent" column="sub_pid" |
| | | select="com.yeshi.fanli.dao.mybatis.GoodsSubClassMapper.selectByPrimaryKey" /> |
| | | |
| | | </resultMap> |
| | | <resultMap id="SimpleResultMap" |
| | | type="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass"> |
| | |
| | | jdbcType="BIGINT" /> |
| | | <result column="sub_createtime" property="createtime" jdbcType="TIMESTAMP" /> |
| | | <result column="sub_updatetime" property="updatetime" jdbcType="TIMESTAMP" /> |
| | | <result column="sub_sex" property="sex" jdbcType="INTEGER" /> |
| | | <result column="sub_month" property="month" jdbcType="VARCHAR" /> |
| | | <association property="rootClass" column="sub_root_id" |
| | | javaType="com.yeshi.fanli.entity.bus.clazz.GoodsClass"> |
| | | <id column="sub_root_id" property="id" jdbcType="BIGINT" /> |
| | |
| | | <id column="sub_pid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sub_id,sub_name,sub_picture,sub_picture_second,sub_weight,sub_root_id,sub_pid,sub_level,sub_state,sub_key,sub_search_json,sub_ios_click,sub_android_click,sub_createtime,sub_updatetime |
| | | <sql id="Base_Column_List">sub_id,sub_name,sub_picture,sub_picture_second,sub_weight,sub_root_id,sub_pid,sub_level,sub_state,sub_key,sub_search_json,sub_ios_click,sub_android_click,sub_createtime,sub_updatetime,sub_sex,sub_month |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | from yeshi_ec_sub_class where sub_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_sub_class where sub_id = #{id,jdbcType=BIGINT}</delete> |
| | | yeshi_ec_sub_class where sub_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_sub_class |
| | | (sub_id,sub_name,sub_picture,sub_picture_second,sub_weight,sub_root_id,sub_pid,sub_level,sub_state,sub_key,sub_search_json,sub_ios_click,sub_android_click,sub_createtime,sub_updatetime) |
| | | (sub_id,sub_name,sub_picture,sub_picture_second,sub_weight,sub_root_id,sub_pid,sub_level,sub_state,sub_key,sub_search_json,sub_ios_click,sub_android_click,sub_createtime,sub_updatetime,sub_sex,sub_month) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{pictureSecond,jdbcType=VARCHAR},#{weight,jdbcType=INTEGER},#{rootClass.id,jdbcType=BIGINT},#{parent.id,jdbcType=BIGINT},#{level,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{key,jdbcType=VARCHAR},#{searchJson,jdbcType=VARCHAR},#{iosClick,jdbcType=BIGINT},#{androidClick,jdbcType=BIGINT},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP}) |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{pictureSecond,jdbcType=VARCHAR},#{weight,jdbcType=INTEGER},#{rootClass.id,jdbcType=BIGINT},#{parent.id,jdbcType=BIGINT},#{level,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{key,jdbcType=VARCHAR},#{searchJson,jdbcType=VARCHAR},#{iosClick,jdbcType=BIGINT},#{androidClick,jdbcType=BIGINT},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{month,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="androidClick != null">sub_android_click,</if> |
| | | <if test="createtime != null">sub_createtime,</if> |
| | | <if test="updatetime != null">sub_updatetime,</if> |
| | | <if test="sex != null">sub_sex,</if> |
| | | <if test="month != null">sub_month,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="androidClick != null">#{androidClick,jdbcType=BIGINT},</if> |
| | | <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if> |
| | | <if test="sex != null">#{sex,jdbcType=INTEGER},</if> |
| | | <if test="month != null">#{month,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass">update |
| | |
| | | #{iosClick,jdbcType=BIGINT},sub_android_click = |
| | | #{androidClick,jdbcType=BIGINT},sub_createtime = |
| | | #{createtime,jdbcType=TIMESTAMP},sub_updatetime = |
| | | #{updatetime,jdbcType=TIMESTAMP} where sub_id = #{id,jdbcType=BIGINT} |
| | | #{updatetime,jdbcType=TIMESTAMP} ,sub_sex =#{sex,jdbcType=INTEGER} |
| | | ,sub_month =#{month,jdbcType=VARCHAR} where sub_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClass"> |
| | | update yeshi_ec_sub_class |
| | |
| | | <if test="androidClick != null">sub_android_click=#{androidClick,jdbcType=BIGINT},</if> |
| | | <if test="createtime != null">sub_createtime=#{createtime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updatetime != null">sub_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if> |
| | | <if test="sex !=null">sub_sex =#{sex,jdbcType=INTEGER},</if> |
| | | <if test="month !=null">sub_month =#{month,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where sub_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | import com.yeshi.fanli.dao.mybatis.TaoBaoClassRelationMapper;
|
| | | import com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoClassRelationService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
|
| | |
|
| | | @Service
|
| | | public class TaoBaoClassRelationServiceImpl implements TaoBaoClassRelationService {
|
| | |
|
| | | @Resource
|
| | | private TaoBaoClassRelationMapper taoBaoClassRelationMapper;
|
| | | |
| | |
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | |
| | | public int updateByPrimaryKey(TaoBaoClassRelation record) {
|
| | | return taoBaoClassRelationMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.goods;
|
| | |
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation;
|
| | |
|
| | |
|
| | | public interface TaoBaoClassRelationService {
|
| | | |
| | |
|
| | | public int deleteByPrimaryKey(Long id);
|
| | |
|
| | | public int insert(TaoBaoClassRelation record);
|
| | |
| | | "🌟",// 发光的星星
|
| | | };
|
| | |
|
| | | static final String[] timeEmojis = new String[] { |
| | | "🕛",// 十二点
|
| | | "🕧",// 十二点半
|
| | | "🕐",// 一点钟
|
| | | "🕜",// 一点半
|
| | | "🕑",// 两点
|
| | | "🕝",// 两点半
|
| | | "🕒",// 三点钟
|
| | | "🕞",// 三点半
|
| | | "🕓",// 四点钟
|
| | | "🕟",// 四点半
|
| | | "🕔",// 五时
|
| | | "🕠",// 五点半
|
| | | "🕕",// 六点
|
| | | "🕡",// 六点半
|
| | | "🕖",// 七点
|
| | | "🕢",// 七点半
|
| | | "🕗",// 八点
|
| | | "🕣",// 八点半
|
| | | "🕘",// 九点钟
|
| | | "🕤",// 九点半
|
| | | "🕙",// 的十点
|
| | | "🕥",// 十点半
|
| | | "🕚",// 十一点
|
| | | static final String[] timeEmojis = new String[] { "🕛", // 十二点
|
| | | "🕧", // 十二点半
|
| | | "🕐", // 一点钟
|
| | | "🕜", // 一点半
|
| | | "🕑", // 两点
|
| | | "🕝", // 两点半
|
| | | "🕒", // 三点钟
|
| | | "🕞", // 三点半
|
| | | "🕓", // 四点钟
|
| | | "🕟", // 四点半
|
| | | "🕔", // 五时
|
| | | "🕠", // 五点半
|
| | | "🕕", // 六点
|
| | | "🕡", // 六点半
|
| | | "🕖", // 七点
|
| | | "🕢", // 七点半
|
| | | "🕗", // 八点
|
| | | "🕣", // 八点半
|
| | | "🕘", // 九点钟
|
| | | "🕤", // 九点半
|
| | | "🕙", // 的十点
|
| | | "🕥", // 十点半
|
| | | "🕚", // 十一点
|
| | | "🕦",// 十一点半
|
| | | };
|
| | |
|
| | |
| | | }
|
| | |
|
| | | private static List<DaTaoKeDetail> parseCurrent(String url) {
|
| | | |
| | | List<DaTaoKeDetail> list=new ArrayList<>();
|
| | |
|
| | | List<DaTaoKeDetail> list = new ArrayList<>();
|
| | | try {
|
| | | Document doc = Jsoup.connect(url)
|
| | | .userAgent(
|
| | |
| | | .getElementsByTag("b").get(0).text();
|
| | |
|
| | | System.out.println(id + "-" + currentSale);
|
| | | DaTaoKeDetail detail=new DaTaoKeDetail();
|
| | | DaTaoKeDetail detail = new DaTaoKeDetail();
|
| | | detail.setId(id);
|
| | | detail.setSalesNum(Integer.parseInt(currentSale));
|
| | | list.add(detail);
|
| | |
| | | return parseCurrent(url);
|
| | | }
|
| | |
|
| | | private static String getRandomCommonEmoji() {
|
| | | return commonEmojis[(int) (Math.random() * commonEmojis.length)];
|
| | | }
|
| | |
|
| | | public static String getDesc(DaTaoKeDetail detail) {
|
| | |
|
| | | // 标题+券后价+包邮+描述
|
| | | String desc = "😛" + detail.getdTitle() + "😛";
|
| | | String desc = detail.getdTitle();
|
| | | desc += "\n";
|
| | | desc += "😛" + String.format("券后💰【%s元】包邮秒杀 ", MoneyBigDecimalUtil.getWithNoZera(detail.getPrice()).toString())
|
| | | + "😛";
|
| | | desc += String.format("券后价%s【%s元】包邮秒杀 ",Math.random()>0.5?"💰":"", MoneyBigDecimalUtil.getWithNoZera(detail.getPrice()).toString())
|
| | | + (Math.random()>0.5?getRandomCommonEmoji():"");
|
| | | desc += "\n";
|
| | | desc += detail.getIntroduce();
|
| | | // desc += detail.getIntroduce();
|
| | | String introduce = detail.getIntroduce().replace(",", ",").replace("。", ",").replace("!", ",")
|
| | | .replace(",", ",");
|
| | | introduce=introduce.replace(",,,", ",").replace(",,", ",");
|
| | | |
| | | String[] sts = introduce.split(",");
|
| | | introduce = "";
|
| | | for (int i = 0; i < sts.length; i++) {
|
| | | if (i % 2 == 1) {// 需要换行
|
| | | introduce += sts[i] + (Math.random()>0.5?getRandomCommonEmoji():i==sts.length-1?"":",") + "\n";
|
| | | } else
|
| | | introduce += sts[i] + (Math.random()>0.5?getRandomCommonEmoji():i==sts.length-1?"":",");
|
| | | }
|
| | | desc+=introduce;
|
| | | return desc;
|
| | | }
|
| | |
|
| | | |
| | | public static TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods, DaTaoKeDetail detail) {
|
| | | if (detail != null) {
|
| | | // 重新设置标题与券价格
|
| | |
| | | }
|
| | | return goods;
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | tg.setShopTitle(tb.getShopTitle());
|
| | | tg.setState(tb.getState()); // 状态:2018-12-03
|
| | | if (tb.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) {
|
| | | |
| | | tg.setCoupon(true);// 有券 |
| | | |
| | |
|
| | | tg.setCoupon(true);// 有券
|
| | |
|
| | | TaoBaoQuanInfo quanInfo = new TaoBaoQuanInfo();
|
| | | quanInfo.setCouponAmount(tb.getCouponAmount());
|
| | | String couponEffectiveEndTime = tb.getCouponEffectiveEndTime();
|
| | |
| | | tg.setSalesType(1);
|
| | | // 测试使用
|
| | | // tg.setSalesType(Math.random() > 0.5 ? tg.getSalesType() : 3);
|
| | | List<ClientTextStyleVO> labels = new ArrayList<>();
|
| | | labels.add(new ClientTextStyleVO("标签内容", "#F14242"));
|
| | | labels.add(new ClientTextStyleVO("标签内容", "#00FF00"));
|
| | | tg.setLabels(labels);
|
| | | // List<ClientTextStyleVO> labels = new ArrayList<>();
|
| | | // labels.add(new ClientTextStyleVO("标签内容", "#F14242"));
|
| | | // labels.add(new ClientTextStyleVO("标签内容", "#00FF00"));
|
| | | // tg.setLabels(labels);
|
| | | return tg;
|
| | | }
|
| | |
|
| | |
| | | // tg.setMoneyType(Math.random() > 0.5 ? 1 : 2);
|
| | | // tg.setSalesType(Math.random() > 0.5 ? 1 : 2);
|
| | | // tg.setSalesType(Math.random() > 0.5 ? tg.getSalesType() : 3);
|
| | | List<ClientTextStyleVO> labels = new ArrayList<>();
|
| | | labels.add(new ClientTextStyleVO("标签内容", "#F14242"));
|
| | | labels.add(new ClientTextStyleVO("标签内容", "#000000"));
|
| | | tg.setLabels(labels);
|
| | | // List<ClientTextStyleVO> labels = new ArrayList<>();
|
| | | // labels.add(new ClientTextStyleVO("标签内容", "#F14242"));
|
| | | // labels.add(new ClientTextStyleVO("标签内容", "#000000"));
|
| | | // tg.setLabels(labels);
|
| | |
|
| | | return tg;
|
| | | }
|