Authored by kun

update

package com.yoho.ufo.dal;
import com.yoho.ufo.model.commoditybasicrole.category.ProductSort;
import com.yohobuy.ufo.model.common.PageModel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
... ... @@ -48,13 +47,12 @@ public interface ProductSortMapper {
ProductSort selectOneById(Integer id);
/**
* 根据条件查询品类分页数据
* 根据条件查询品类数据
*
* @param productSort
* @param pageModel
* @return
*/
List<ProductSort> getProductSortPageList(@Param("productSort") ProductSort productSort, @Param("page") PageModel pageModel);
List<ProductSort> getProductSortList(@Param("productSort") ProductSort productSort);
/**
* 更新品类状态
... ...
... ... @@ -72,12 +72,11 @@
<include refid="queryPage"/>
</select>
<select id="getProductSortPageList" resultMap="productSortMap">
<select id="getProductSortList" resultMap="productSortMap">
select <include refid="queryColumns"/>
from product_sort
<include refid="queryPage"/>
order by update_time desc
limit #{page.startIndex}, #{page.pageSize}
</select>
<update id="updateProductSortStatus" parameterType="com.yoho.ufo.model.commoditybasicrole.category.ProductSort">
... ...
... ... @@ -5,7 +5,6 @@ import com.yoho.ufo.exception.CommonException;
import com.yoho.ufo.service.IProductSortService;
import com.yoho.ufo.util.OvalValidationUtils;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.productsort.ProductSortRequestBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortResponseBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortTreeViewResponseBo;
... ... @@ -58,10 +57,10 @@ public class ProductSortController {
}
@RequestMapping(value = "/getProductSortPageList", method = RequestMethod.POST)
public ApiResponse<PageResponseBO<ProductSortTreeViewResponseBo>> getProductSortPageList(ProductSortRequestBo productSortRequestBo) {
@RequestMapping(value = "/getProductSortList", method = RequestMethod.POST)
public ApiResponse<List<ProductSortTreeViewResponseBo>> getProductSortList(ProductSortRequestBo productSortRequestBo) {
LOGGER.info("getProductSortPageList param = {}", productSortRequestBo);
return new ApiResponse<>(productSortService.getProductSortPageList(productSortRequestBo));
return new ApiResponse<>(productSortService.getProductSortList(productSortRequestBo));
}
@RequestMapping(value = "/updateProductSortStatus", method = RequestMethod.POST)
... ...
... ... @@ -2,7 +2,6 @@ package com.yoho.ufo.service;
import com.alibaba.fastjson.JSONObject;
import com.yoho.ufo.model.commoditybasicrole.category.ProductSort;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.productsort.ProductSortRequestBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortResponseBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortTreeViewResponseBo;
... ... @@ -31,11 +30,11 @@ public interface IProductSortService {
ProductSortResponseBo getProductSortById(Integer id);
/**
* 根据条件获取品类分页信息
* 根据条件获取品类信息
* @param productSortRequestBo
* @return
*/
PageResponseBO<ProductSortTreeViewResponseBo> getProductSortPageList(ProductSortRequestBo productSortRequestBo);
List<ProductSortTreeViewResponseBo> getProductSortList(ProductSortRequestBo productSortRequestBo);
/**
* 更新品类状态
... ...
package com.yoho.ufo.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.ufo.dal.ProductSortMapper;
import com.yoho.ufo.exception.CommonException;
import com.yoho.ufo.model.commoditybasicrole.category.ProductSort;
import com.yoho.ufo.service.IProductSortService;
import com.yoho.ufo.util.OrikaUtils;
import com.yohobuy.ufo.model.common.PageModel;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.productsort.ProductSortRequestBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortResponseBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortTreeViewResponseBo;
... ... @@ -83,19 +82,18 @@ public class ProductSortServiceImpl implements IProductSortService {
}
@Override
public PageResponseBO<ProductSortTreeViewResponseBo> getProductSortPageList(ProductSortRequestBo productSortRequestBo) {
public List<ProductSortTreeViewResponseBo> getProductSortList(ProductSortRequestBo productSortRequestBo) {
LOGGER.info("getProductSortPageList param = {}", productSortRequestBo);
ProductSort productSort = OrikaUtils.map(productSortRequestBo, ProductSort.class);
PageModel pageModel = productSortRequestBo.toPageModel();
int count = productSortMapper.selectProductSortCount(productSort);
if (count == 0) {
LOGGER.warn("getProductSortPageList count is 0. param = {}", productSortRequestBo);
return new PageResponseBO<>();
return Lists.newArrayList();
}
List<ProductSort> productSorts = productSortMapper.getProductSortPageList(productSort, pageModel);
List<ProductSort> productSorts = productSortMapper.getProductSortList(productSort);
List<ProductSortTreeViewResponseBo> responseBos = new ArrayList<>();
processResult(productSorts, responseBos);
return new PageResponseBO<>(count, responseBos, pageModel.getCurrentPage(), pageModel.getPageSize());
return responseBos;
}
private void processResult(List<ProductSort> productSorts, List<ProductSortTreeViewResponseBo> responseBos) {
... ...
... ... @@ -60,7 +60,7 @@
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/productSort/getProductSortPageList",
url: contextPath + "/productSort/getProductSortList",
method: 'POST',
/*queryParams: {
'sortName':''
... ...