Authored by mali

二手

package com.yoho.product.dal;
import com.yoho.product.model.SecondhandInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SecondhandInfoMapper {
List<SecondhandInfo> selectBySkups(@Param("skupList")List<Integer> skupList);
}
\ No newline at end of file
... ...
package com.yoho.product.model;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class SecondhandInfo {
private Integer id;
private Integer skup;
private String flawId;
private String flawAttr;
private String describeInfo;
private String rejectReason;
}
\ No newline at end of file
... ...
<?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.yoho.product.dal.SecondhandInfoMapper" >
<resultMap id="BaseResultMap" type="com.yoho.product.model.SecondhandInfo" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="skup" property="skup" jdbcType="INTEGER" />
<result column="flaw_id" property="flawId" jdbcType="VARCHAR" />
<result column="flaw_attr" property="flawAttr" jdbcType="VARCHAR" />
<result column="describe_info" property="describe_info" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="reject_reason" property="rejectReason" javaType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List" >
id, skup, flaw_id, flaw_attr, describe_info, create_time, reject_reason
</sql>
<select id="selectBySkups" resultMap="BaseResultMap" >
select <include refid="Base_Column_List" />
from secondhand_info where skup in
<foreach item="item" index="index" collection="skupList" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -55,7 +55,7 @@ public class ProductAssistService {
private UfoSizeMapper sizeMapper;
@Autowired
private AuditRejectInfoService auditRejectInfoService;
private SecondhandInfoService secondhandInfoService;
// 商品列表填充品牌名称
public ProductAssistService fillBrandName(List<ProductResponceBo> productResponceBos) {
... ... @@ -199,7 +199,7 @@ public class ProductAssistService {
List<Integer> skupList = productResponceBos.stream().filter(item -> ProductSkupStatusEnum.CHECK_REJEST.getStatus().equals(item.getStatus()))
.map(ProductResponceBo::getSkup).collect(Collectors.toList());
Map<Integer, String> auditRejectInfos = auditRejectInfoService.selectBySkupsEx(skupList);
Map<Integer, String> auditRejectInfos = secondhandInfoService.selectBySkupsEx(skupList);
productResponceBos.stream().forEach(item -> item.setCheckRejustReason(auditRejectInfos.get(item.getSkup())));
return this;
... ...
package com.yoho.ufo.service.impl;
import com.google.common.collect.Lists;
import com.yoho.product.dal.SecondhandInfoMapper;
import com.yoho.product.model.AuditRejectInfo;
import com.yoho.product.model.SecondhandInfo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by li.ma on 2019/4/10.
*/
@Service
public class SecondhandInfoService {
@Autowired
private SecondhandInfoMapper secondhandInfoMapper;
public List<SecondhandInfo> selectBySkups(List<Integer> skupList) {
if (CollectionUtils.isEmpty(skupList)) {
return Lists.newArrayList();
}
return secondhandInfoMapper.selectBySkups(skupList);
}
public Map<Integer, String> selectBySkupsEx(List<Integer> skupList) {
List<SecondhandInfo> auditRejectInfos = selectBySkups(skupList);
return auditRejectInfos.stream().collect(Collectors.toMap(SecondhandInfo::getSkup, SecondhandInfo::getRejectReason));
}
}
... ...
... ... @@ -11,6 +11,7 @@ datasources:
- com.yoho.product.dal.ProductSelfShelvesMapper
- com.yoho.product.dal.ProductSelfShelvesPicMapper
- com.yoho.product.dal.AuditRejectInfoMapper
- com.yoho.product.dal.SecondhandInfoMapper
ufo_order:
servers:
... ...
... ... @@ -11,6 +11,7 @@ datasources:
- com.yoho.product.dal.ProductSelfShelvesMapper
- com.yoho.product.dal.ProductSelfShelvesPicMapper
- com.yoho.product.dal.AuditRejectInfoMapper
- com.yoho.product.dal.SecondhandInfoMapper
ufo_order:
servers:
... ...