Authored by caoyan

订单管理

... ... @@ -2,9 +2,6 @@ package com.yoho.order.dal;
import java.util.List;
import com.yoho.order.model.BuyerOrder;
import com.yohobuy.ufo.model.order.req.BuyerOrderListReq;
/**
* Created by caoyan on 2018/9/12.
*/
... ... @@ -12,7 +9,7 @@ public interface BuyerOrderMapper {
int selectCountByStatus(List<Byte> statusList);
int selectTotalByCondition(BuyerOrderListReq req);
// int selectTotalByCondition(BuyerOrderListReq req);
List<BuyerOrder> selectByCondition(BuyerOrderListReq req);
// List<BuyerOrder> selectByCondition(BuyerOrderListReq req);
}
... ...
... ... @@ -46,16 +46,14 @@
</if>
</sql>
<select id="selectTotalByCondition" resultType="java.lang.Integer"
parameterType="com.yohobuy.ufo.model.order.req.BuyerOrderListReq">
<select id="selectTotalByCondition" resultType="java.lang.Integer">
select count(1)
from buyer_order
where 1=1
<include refid="Query_Order_Sql" />
</select>
<select id="selectByCondition" resultMap="BaseResultMap"
parameterType="com.yohobuy.ufo.model.order.req.BuyerOrderListReq">
<select id="selectByCondition" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from buyer_order
where 1=1
... ...
... ... @@ -10,9 +10,6 @@ import org.springframework.web.bind.annotation.RestController;
import com.yoho.ufo.order.service.IBuyerOrderService;
import com.yoho.ufo.service.model.ApiResponse;
import com.yohobuy.ufo.model.order.req.BuyerOrderListReq;
import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
import com.yohobuy.ufo.model.order.resp.PageResponseBO;
@RestController
@RequestMapping(value = "/buyerOrder")
... ... @@ -30,10 +27,10 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(map).build();
}
@RequestMapping(value = "/queryOrderList")
public ApiResponse queryOrderList(BuyerOrderListReq req) {
LOGGER.info("queryOrderList in. req is {}", req);
PageResponseBO<BuyerOrderResp> result = buyerOrderService.queryOrderList(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}
// @RequestMapping(value = "/queryOrderList")
// public ApiResponse queryOrderList(BuyerOrderListReq req) {
// LOGGER.info("queryOrderList in. req is {}", req);
// PageResponseBO<BuyerOrderResp> result = buyerOrderService.queryOrderList(req);
// return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
// }
}
... ...
... ... @@ -2,10 +2,6 @@ package com.yoho.ufo.order.service;
import java.util.Map;
import com.yohobuy.ufo.model.order.req.BuyerOrderListReq;
import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
import com.yohobuy.ufo.model.order.resp.PageResponseBO;
/**
* @author caoyan
* @date 2018/9/13
... ... @@ -13,5 +9,5 @@ import com.yohobuy.ufo.model.order.resp.PageResponseBO;
public interface IBuyerOrderService {
Map<String, Integer> getCountByJudgeStatus();
PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderListReq req);
// PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderListReq req);
}
... ...
... ... @@ -50,35 +50,36 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return resultMap;
}
public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderListReq req) {
int total = buyerOrderMapper.selectTotalByCondition(req);
if(total == 0) {
return null;
}
// public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderListReq req) {
// int total = buyerOrderMapper.selectTotalByCondition(req);
// if(total == 0) {
// return null;
// }
//
// List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req);
// if(CollectionUtils.isEmpty(orderList)) {
// return null;
// }
//
// List<BuyerOrderResp> respList = Lists.newArrayList();
// for(BuyerOrder item : orderList) {
// BuyerOrderResp resp = new BuyerOrderResp();
// resp.setOrderCode(item.getOrderCode());
// resp.setStatus(item.getStatus());
// resp.setCreateTimeStr(DateUtil.long2DateStr(item.getCreateTime()*1000, "yyyy-MM-dd HH:mm:ss"));
//
// respList.add(resp);
// }
//
// PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
// result.setList(respList);
// result.setPage(req.getPage());
// result.setSize(req.getSize());
// result.setTotal(total);
//
// return result;
List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req);
if(CollectionUtils.isEmpty(orderList)) {
return null;
}
List<BuyerOrderResp> respList = Lists.newArrayList();
for(BuyerOrder item : orderList) {
BuyerOrderResp resp = new BuyerOrderResp();
resp.setOrderCode(item.getOrderCode());
resp.setStatus(item.getStatus());
resp.setCreateTimeStr(DateUtil.long2DateStr(item.getCreateTime()*1000, "yyyy-MM-dd HH:mm:ss"));
respList.add(resp);
}
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
result.setList(respList);
result.setPage(req.getPage());
result.setSize(req.getSize());
result.setTotal(total);
return result;
}
// }
}
... ...