Authored by caoyan

Merge branch 'master' of http://git.yoho.cn/ufo/ufo-platform

... ... @@ -79,10 +79,12 @@
limit #{page.startIndex}, #{page.pageSize}
</select>
<select id="selectAllSizeBySortId" resultMap="sizeMap">
select id, size_name
from size where sort_id = #{sortId}
from size where 1=1
<if test="sortId != null and sortId >0 ">
and sort_id = #{sortId}
</if>
</select>
<select id="selectByIdList" resultMap="sizeMap">
... ...
... ... @@ -6,6 +6,9 @@ import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.productcolor.ProductColorRequestBo;
import com.yohobuy.ufo.model.response.productcolor.ProductColorResponsetBo;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -42,6 +45,12 @@ public class ProductColorController {
LOGGER.info("getProductColorById param = {}", id);
return new ApiResponse<>(productColorService.getProductColorById(id));
}
@RequestMapping(value = "/getAllColor", method = RequestMethod.GET)
public ApiResponse<List<ProductColorResponsetBo>> getAllColor() {
LOGGER.info("getAllColor ");
return new ApiResponse<>(productColorService.getAllColor());
}
@RequestMapping(value = "/getProductSortPageList", method = RequestMethod.POST)
... ...
package com.yoho.ufo.service;
import java.util.List;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.productcolor.ProductColorRequestBo;
import com.yohobuy.ufo.model.response.productcolor.ProductColorResponsetBo;
... ... @@ -32,4 +34,6 @@ public interface IProductColorService {
*/
PageResponseBO<ProductColorResponsetBo> getProductColorPageList(ProductColorRequestBo productColorRequestBo);
List<ProductColorResponsetBo> getAllColor();
}
... ...
... ... @@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
... ... @@ -53,6 +54,17 @@ public class ProductColorServiceImpl implements IProductColorService {
LOGGER.info("getProductColorById id = {}", id);
return OrikaUtils.map(ufoProductColorMapper.selectOneById(id), ProductColorResponsetBo.class);
}
@Override
public List<ProductColorResponsetBo> getAllColor() {
LOGGER.info("getAllColor");
List<ProductColorResponsetBo> result = new ArrayList<>();
List<ProductColor> colorList = ufoProductColorMapper.selectAllColor();
for(ProductColor color : colorList) {
result.add(OrikaUtils.map(color, ProductColorResponsetBo.class));
}
return result;
}
@Override
public PageResponseBO<ProductColorResponsetBo> getProductColorPageList(ProductColorRequestBo productColorRequestBo) {
... ...