Browse Source

调整详情代码

master
xyiege 3 years ago
parent
commit
0a4e6e1bea
  1. 7
      src/main/java/cn/chjyj/szwh/mapper/GoodsDetailMapper.java
  2. 11
      src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java
  3. 47
      src/main/resources/mapper/szwh/GoodsDetailMapper.xml

7
src/main/java/cn/chjyj/szwh/mapper/GoodsDetailMapper.java

@ -30,4 +30,11 @@ public interface GoodsDetailMapper {
* @return
*/
GoodsDetailVo getGoodsDetailVoList(String goodsIslicode);
/**
* 新增商品明细
* @param goodsDetail
* @return
*/
int add(GoodsDetail goodsDetail);
}

11
src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

@ -17,6 +17,7 @@ import cn.chjyj.szwh.vo.GoodsListVo;
import cn.chjyj.szwh.vo.OrderDetailVo;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.json.JsonMapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -105,9 +106,15 @@ public class GoodsServiceImpl implements GoodsService {
if(tgoods!=null){
continue;
}
// add goodsSource
// add goodsSource,循环插入 商品资源
for(int x=0;x<gdArr.size();x++){
JSONObject gditem = (JSONObject) gdArr.get(x);
GoodsSource goodsSource = ApiGoodsUtils.jsonToGoodsSource(gditem,goodsId);
goodsSourceMapper.add(goodsSource);
}
// insertGoodsDetail
GoodsDetail goodsDetail = ApiGoodsUtils.jsonToGoodsDetail(nsdjson,sdjson);
goodsDetailMapper.add(goodsDetail);
}
return count;

47
src/main/resources/mapper/szwh/GoodsDetailMapper.xml

@ -65,20 +65,43 @@
</select>
<!--新增用户-->
<insert id="addUser" parameterType="cn.chjyj.szwh.bean.Goods" useGeneratedKeys="true" keyColumn="uid">
<insert id="add" parameterType="cn.chjyj.szwh.bean.GoodsDetail" useGeneratedKeys="true" keyColumn="id">
insert into <include refid="tbName"/>
(uname,password,gender,urealname,ubirth,nickname,avatarurl,platfrom,sessionkey,openid)
(goods_name,goods_image,identifier,identifiers,stock,price,goods_ownership,
goods_ownership_str,goods_type,
charges_type ,goods_islicode ,goods_entrust,
contractual_period ,earnest_money ,transaction_class,contract,
otherIdentifiers,classification,source_islicode,
source_islicode_name ,source_url ,source_status ,
data_json,source_json ,join_field ,
sourcedata_islicode ,createtime,updatetime,is_deleted,is_join)
values (
#{uname},
#{password},
#{gender},
#{urealname},
#{ubirth},
#{nickname},
#{avatarurl},
#{platfrom},
#{sessionkey},
#{openid}
#{goodsName},
#{goodsImage},
#{identifier},
#{identifiers},
#{stock},
#{price},
#{goodsOwnership},
#{goodsOwnershipStr},
#{goodsType},
#{chargesType},
#{goodsIslicode},
#{goodsEntrust},
#{contractualPeriod},
#{transactionClass},
#{contract},
#{otherIdentifiers},
#{classification},
#{sourceIslicode},
#{sourceIslicodeName},
#{sourceUrl},
#{sourceStatus},
#{dataJson},
#{sourceJson},
#{joinField},
#{sourcedataIslicode},
0,0
)
</insert>

Loading…
Cancel
Save