Authored by mali

保存网销的完整信息

@@ -42,13 +42,218 @@ @@ -42,13 +42,218 @@
42 ### 对应SQL的操作库表 42 ### 对应SQL的操作库表
43 43
44 ```xml 44 ```xml
45 - <insert id="insert" parameterType="com.yohobuy.platform.dal.product.model.Size" >  
46 - insert into size (id, size_name, sort_id,  
47 - attribute_id, order_by, create_time,  
48 - update_time)  
49 - values (#{id,jdbcType=SMALLINT}, #{sizeName,jdbcType=VARCHAR}, #{sortId,jdbcType=SMALLINT},  
50 - #{attributeId,jdbcType=VARCHAR}, #{orderBy,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER},  
51 - #{updateTime,jdbcType=INTEGER}) 45 + <update id="updateByPrimaryKeySelective" parameterType="com.yohobuy.platform.dal.product.model.BaseProduct" >
  46 + update product
  47 + <set >
  48 + <if test="productName != null" >
  49 + product_name = #{productName,jdbcType=VARCHAR},
  50 + </if>
  51 + <if test="cnAlphabet != null" >
  52 + cn_alphabet = #{cnAlphabet,jdbcType=VARCHAR},
  53 + </if>
  54 + <if test="brandId != null" >
  55 + brand_id = #{brandId,jdbcType=SMALLINT},
  56 + </if>
  57 + <if test="shopId != null" >
  58 + shop_id = #{shopId,jdbcType=SMALLINT},
  59 + </if>
  60 + <if test="supplierId != null" >
  61 + supplier_id = #{supplierId,jdbcType=INTEGER},
  62 + </if>
  63 + <if test="isJit != null" >
  64 + is_jit = #{isJit,jdbcType=CHAR},
  65 + </if>
  66 + <if test="isScreen != null" >
  67 + is_screen = #{isScreen,jdbcType=CHAR},
  68 + </if>
  69 + <if test="isMeasure != null" >
  70 + is_measure = #{isMeasure,jdbcType=CHAR},
  71 + </if>
  72 + <if test="maxSortId != null" >
  73 + max_sort_id = #{maxSortId,jdbcType=SMALLINT},
  74 + </if>
  75 + <if test="middleSortId != null" >
  76 + middle_sort_id = #{middleSortId,jdbcType=SMALLINT},
  77 + </if>
  78 + <if test="smallSortId != null" >
  79 + small_sort_id = #{smallSortId,jdbcType=SMALLINT},
  80 + </if>
  81 + <if test="sortId != null" >
  82 + sort_id = #{sortId,jdbcType=SMALLINT},
  83 + </if>
  84 + <if test="seriesId != null" >
  85 + series_id = #{seriesId,jdbcType=INTEGER},
  86 + </if>
  87 + <if test="gender != null" >
  88 + gender = #{gender,jdbcType=CHAR},
  89 + </if>
  90 + <if test="style != null" >
  91 + style = #{style,jdbcType=VARCHAR},
  92 + </if>
  93 + <if test="pattern != null" >
  94 + pattern = #{pattern,jdbcType=VARCHAR},
  95 + </if>
  96 + <if test="series != null" >
  97 + series = #{series,jdbcType=VARCHAR},
  98 + </if>
  99 + <if test="models != null" >
  100 + models = #{models,jdbcType=VARCHAR},
  101 + </if>
  102 + <if test="material != null" >
  103 + material = #{material,jdbcType=VARCHAR},
  104 + </if>
  105 + <if test="isLimited != null" >
  106 + is_limited = #{isLimited,jdbcType=CHAR},
  107 + </if>
  108 + <if test="isSpecial != null" >
  109 + is_special = #{isSpecial,jdbcType=CHAR},
  110 + </if>
  111 + <if test="isSales != null" >
  112 + is_sales = #{isSales,jdbcType=CHAR},
  113 + </if>
  114 + <if test="isAdvance != null" >
  115 + is_advance = #{isAdvance,jdbcType=CHAR},
  116 + </if>
  117 + <if test="isRetrieval != null" >
  118 + is_retrieval = #{isRetrieval,jdbcType=CHAR},
  119 + </if>
  120 + <if test="isPromotion != null" >
  121 + is_promotion = #{isPromotion,jdbcType=SMALLINT},
  122 + </if>
  123 + <if test="isOutLets != null" >
  124 + is_outlets = #{isOutLets,jdbcType=CHAR},
  125 + </if>
  126 + <if test="isDown != null" >
  127 + is_down = #{isDown,jdbcType=CHAR},
  128 + </if>
  129 + <if test="attribute != null" >
  130 + attribute = #{attribute,jdbcType=TINYINT},
  131 + </if>
  132 + <if test="seasons != null" >
  133 + seasons = #{seasons,jdbcType=CHAR},
  134 + </if>
  135 + <if test="salableTime != null" >
  136 + salable_time = #{salableTime,jdbcType=VARCHAR},
  137 + </if>
  138 + edit_time = UNIX_TIMESTAMP(),
  139 + <if test="expectArrivalTime != null" >
  140 + expect_arrival_time = #{expectArrivalTime,jdbcType=INTEGER},
  141 + </if>
  142 + <if test="productTag != null" >
  143 + product_tag = #{productTag,jdbcType=VARCHAR},
  144 + </if>
  145 + <if test="productElements != null" >
  146 + product_elements = #{productElements,jdbcType=VARCHAR},
  147 + </if>
  148 + <if test="productStyle != null" >
  149 + product_style = #{productStyle,jdbcType=VARCHAR},
  150 + </if>
  151 + <if test="grade != null" >
  152 + grade = #{grade,jdbcType=CHAR},
  153 + </if>
  154 + <if test="brandFolder != null" >
  155 + brand_folder = #{brandFolder,jdbcType=INTEGER},
  156 + </if>
  157 + <if test="limitStartTime != null" >
  158 + limit_start_time = #{limitStartTime,jdbcType=INTEGER},
  159 + </if>
  160 + <if test="limitEndTime != null" >
  161 + limit_end_time = #{limitEndTime,jdbcType=INTEGER},
  162 + </if>
  163 + <if test="expectShelfTime != null" >
  164 + expect_shelf_time = #{expectShelfTime,jdbcType=INTEGER},
  165 + </if>
  166 + <if test="factoryCode != null" >
  167 + factory_code = #{factoryCode,jdbcType=VARCHAR},
  168 + </if>
  169 + <if test="ageLevel != null" >
  170 + age_level = #{ageLevel,jdbcType=VARCHAR},
  171 + </if>
  172 + <if test="goodsYears != null" >
  173 + goods_years = #{goodsYears,jdbcType=SMALLINT},
  174 + </if>
  175 + <if test="goodsSeason != null" >
  176 + goods_season = #{goodsSeason,jdbcType=SMALLINT},
  177 + </if>
  178 + <if test="isPromotionalGifts != null" >
  179 + is_promotional_gifts = #{isPromotionalGifts,jdbcType=CHAR},
  180 + </if>
  181 + <if test="isLimitbuy != null" >
  182 + is_limitbuy = #{isLimitbuy,jdbcType=CHAR},
  183 + </if>
  184 + <if test="isMeasure != null" >
  185 + is_measure = #{isMeasure},
  186 + </if>
  187 + <if test="isVip != null" >
  188 + is_vip = #{isVip,jdbcType=CHAR},
  189 + </if>
  190 + <if test="editId != null" >
  191 + editId = #{editId,jdbcType=INTEGER},
  192 + </if>
  193 + <if test="operateInfo != null" >
  194 + operate_info = #{operateInfo,jdbcType=VARCHAR},
  195 + </if>
  196 + <if test="founder != null" >
  197 + founder = #{founder,jdbcType=INTEGER},
  198 + </if>
  199 + </set>
  200 + where product_skn = #{productSkn,jdbcType=INTEGER}
  201 + </update>
  202 +
  203 +
  204 + <update id="updateByProductSkn" parameterType="com.yohobuy.platform.dal.shops.model.Product">
  205 + update product set erp_product_id = erp_product_id,
  206 + <if test="salesPhrase != null" >
  207 + sales_phrase = #{salesPhrase,jdbcType=VARCHAR}
  208 + </if>
  209 + <if test="phrase != null" >
  210 + phrase = #{phrase,jdbcType=VARCHAR}
  211 + </if>
  212 + where erp_product_id= #{erpProductId,jdbcType=INTEGER}
  213 + </update>
  214 +
  215 +
  216 + <update id="updateByProductSkn" parameterType="com.yohobuy.platform.dal.shops.model.Product">
  217 + update product set erp_product_id = erp_product_id,
  218 + <if test="salesPhrase != null" >
  219 + sales_phrase = #{salesPhrase,jdbcType=VARCHAR}
  220 + </if>
  221 + <if test="phrase != null" >
  222 + phrase = #{phrase,jdbcType=VARCHAR}
  223 + </if>
  224 + where erp_product_id= #{erpProductId,jdbcType=INTEGER}
  225 + </update>
  226 +
  227 + <delete id="delBatchBySkn" parameterType="java.lang.Integer" >
  228 + delete from product_attribute_property_values
  229 + where product_skn = #{productSkn,jdbcType=INTEGER} AND display_position in
  230 + <foreach collection="displayPositions" item="item" open="(" close=")" separator=",">
  231 + #{item, jdbcType=INTEGER}
  232 + </foreach>
  233 + </delete>
  234 +
  235 + <insert id="insertBatch">
  236 + insert into product_attribute_property_values (product_skn, attribute_id,
  237 + attribute_value_id, display_position)
  238 + values
  239 + <foreach collection="doList" item="item" index="index" separator=",">
  240 + (#{item.productSkn,jdbcType=INTEGER}, #{item.attributeId,jdbcType=INTEGER},
  241 + #{item.attributeValueId,jdbcType=INTEGER}, #{item.displayPosition,jdbcType=INTEGER})
  242 + </foreach>
  243 + </insert>
  244 +
  245 + <update id="updateBrandSeriesBySkn" parameterType="com.yohobuy.platform.dal.product.model.BaseProduct">
  246 + update product set series_id = #{seriesId,jdbcType=INTEGER}, brand_folder = #{brandFolder,jdbcType=INTEGER} where product_skn= #{productSkn, jdbcType=INTEGER}
  247 + </update>
  248 +
  249 + <insert id="updateProductOnSaleInfo">
  250 + insert into product_ext (product_skn, brand_model, brand_series, make_crafts, sales_phrase, is_hostsell)
  251 + values (#{extInfo.productSkn,jdbcType=INTEGER}, #{extInfo.brandModel,jdbcType=VARCHAR}
  252 + , #{extInfo.brandSeries,jdbcType=VARCHAR}, #{extInfo.makeCrafts,jdbcType=VARCHAR}
  253 + , #{extInfo.salesPhrase,jdbcType=VARCHAR}, #{extInfo.isHostsell,jdbcType=CHAR})
  254 + ON DUPLICATE KEY UPDATE brand_model=#{extInfo.brandModel,jdbcType=VARCHAR}, brand_series=#{extInfo.brandSeries,jdbcType=VARCHAR},
  255 + make_crafts=#{extInfo.makeCrafts,jdbcType=VARCHAR}, sales_phrase=#{extInfo.salesPhrase,jdbcType=VARCHAR},
  256 + is_hostsell=#{extInfo.isHostsell,jdbcType=CHAR}
52 </insert> 257 </insert>
53 ``` 258 ```
54 259