Showing
6 changed files
with
59 additions
and
53 deletions
@@ -28,11 +28,6 @@ | @@ -28,11 +28,6 @@ | ||
28 | <version>${project.version}</version> | 28 | <version>${project.version}</version> |
29 | </dependency> | 29 | </dependency> |
30 | <dependency> | 30 | <dependency> |
31 | - <groupId>com.yoho.ufo.model</groupId> | ||
32 | - <artifactId>order-service-model</artifactId> | ||
33 | - <version>${project.version}</version> | ||
34 | - </dependency> | ||
35 | - <dependency> | ||
36 | <groupId>com.yoho.ufo</groupId> | 31 | <groupId>com.yoho.ufo</groupId> |
37 | <artifactId>ufo-platform-common</artifactId> | 32 | <artifactId>ufo-platform-common</artifactId> |
38 | </dependency> | 33 | </dependency> |
@@ -2,6 +2,11 @@ package com.yoho.order.dal; | @@ -2,6 +2,11 @@ package com.yoho.order.dal; | ||
2 | 2 | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | 4 | ||
5 | +import org.apache.ibatis.annotations.Param; | ||
6 | + | ||
7 | +import com.yoho.order.model.BuyerOrder; | ||
8 | +import com.yoho.order.model.BuyerOrderReq; | ||
9 | + | ||
5 | /** | 10 | /** |
6 | * Created by caoyan on 2018/9/12. | 11 | * Created by caoyan on 2018/9/12. |
7 | */ | 12 | */ |
@@ -9,7 +14,7 @@ public interface BuyerOrderMapper { | @@ -9,7 +14,7 @@ public interface BuyerOrderMapper { | ||
9 | 14 | ||
10 | int selectCountByStatus(List<Byte> statusList); | 15 | int selectCountByStatus(List<Byte> statusList); |
11 | 16 | ||
12 | -// int selectTotalByCondition(BuyerOrderListReq req); | 17 | + int selectTotalByCondition(@Param("buyerOrderReq") BuyerOrderReq req); |
13 | 18 | ||
14 | -// List<BuyerOrder> selectByCondition(BuyerOrderListReq req); | 19 | + List<BuyerOrder> selectByCondition(@Param("buyerOrderReq") BuyerOrderReq req); |
15 | } | 20 | } |
@@ -38,29 +38,29 @@ | @@ -38,29 +38,29 @@ | ||
38 | </select> | 38 | </select> |
39 | 39 | ||
40 | <sql id="Query_Order_Sql" > | 40 | <sql id="Query_Order_Sql" > |
41 | - <if test="statusList != null and statusList.size() > 0"> | 41 | + <if test="buyerOrderReq.statusList != null and buyerOrderReq.statusList.size() > 0"> |
42 | and status in | 42 | and status in |
43 | - <foreach collection="statusList" item="status" open="(" close=")" separator=","> | 43 | + <foreach collection="buyerOrderReq.statusList" item="status" open="(" close=")" separator=","> |
44 | #{status} | 44 | #{status} |
45 | </foreach> | 45 | </foreach> |
46 | </if> | 46 | </if> |
47 | </sql> | 47 | </sql> |
48 | 48 | ||
49 | - <select id="selectTotalByCondition" resultType="java.lang.Integer"> | 49 | + <select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.BuyerOrderReq"> |
50 | select count(1) | 50 | select count(1) |
51 | from buyer_order | 51 | from buyer_order |
52 | where 1=1 | 52 | where 1=1 |
53 | <include refid="Query_Order_Sql" /> | 53 | <include refid="Query_Order_Sql" /> |
54 | </select> | 54 | </select> |
55 | 55 | ||
56 | - <select id="selectByCondition" resultMap="BaseResultMap"> | 56 | + <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.order.model.BuyerOrderReq"> |
57 | select <include refid="Base_Column_List" /> | 57 | select <include refid="Base_Column_List" /> |
58 | from buyer_order | 58 | from buyer_order |
59 | where 1=1 | 59 | where 1=1 |
60 | <include refid="Query_Order_Sql" /> | 60 | <include refid="Query_Order_Sql" /> |
61 | order by create_time desc | 61 | order by create_time desc |
62 | - <if test="start!=null and size != null"> | ||
63 | - limit #{start},#{size} | 62 | + <if test="buyerOrderReq.start!=null and buyerOrderReq.size != null"> |
63 | + limit #{buyerOrderReq.start},#{buyerOrderReq.size} | ||
64 | </if> | 64 | </if> |
65 | </select> | 65 | </select> |
66 | 66 |
@@ -8,8 +8,11 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -8,8 +8,11 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.web.bind.annotation.RequestMapping; | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
9 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
10 | 10 | ||
11 | +import com.yoho.order.model.BuyerOrderReq; | ||
11 | import com.yoho.ufo.order.service.IBuyerOrderService; | 12 | import com.yoho.ufo.order.service.IBuyerOrderService; |
12 | import com.yoho.ufo.service.model.ApiResponse; | 13 | import com.yoho.ufo.service.model.ApiResponse; |
14 | +import com.yoho.ufo.service.model.PageResponseBO; | ||
15 | +import com.yohobuy.ufo.model.order.resp.BuyerOrderResp; | ||
13 | 16 | ||
14 | @RestController | 17 | @RestController |
15 | @RequestMapping(value = "/buyerOrder") | 18 | @RequestMapping(value = "/buyerOrder") |
@@ -27,10 +30,10 @@ public class BuyerOrderController { | @@ -27,10 +30,10 @@ public class BuyerOrderController { | ||
27 | return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(map).build(); | 30 | return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(map).build(); |
28 | } | 31 | } |
29 | 32 | ||
30 | -// @RequestMapping(value = "/queryOrderList") | ||
31 | -// public ApiResponse queryOrderList(BuyerOrderListReq req) { | ||
32 | -// LOGGER.info("queryOrderList in. req is {}", req); | ||
33 | -// PageResponseBO<BuyerOrderResp> result = buyerOrderService.queryOrderList(req); | ||
34 | -// return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build(); | ||
35 | -// } | 33 | + @RequestMapping(value = "/queryOrderList") |
34 | + public ApiResponse queryOrderList(BuyerOrderReq req) { | ||
35 | + LOGGER.info("queryOrderList in. req is {}", req); | ||
36 | + PageResponseBO<BuyerOrderResp> result = buyerOrderService.queryOrderList(req); | ||
37 | + return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build(); | ||
38 | + } | ||
36 | } | 39 | } |
@@ -2,6 +2,10 @@ package com.yoho.ufo.order.service; | @@ -2,6 +2,10 @@ package com.yoho.ufo.order.service; | ||
2 | 2 | ||
3 | import java.util.Map; | 3 | import java.util.Map; |
4 | 4 | ||
5 | +import com.yoho.order.model.BuyerOrderReq; | ||
6 | +import com.yoho.ufo.service.model.PageResponseBO; | ||
7 | +import com.yohobuy.ufo.model.order.resp.BuyerOrderResp; | ||
8 | + | ||
5 | /** | 9 | /** |
6 | * @author caoyan | 10 | * @author caoyan |
7 | * @date 2018/9/13 | 11 | * @date 2018/9/13 |
@@ -9,5 +13,5 @@ import java.util.Map; | @@ -9,5 +13,5 @@ import java.util.Map; | ||
9 | public interface IBuyerOrderService { | 13 | public interface IBuyerOrderService { |
10 | Map<String, Integer> getCountByJudgeStatus(); | 14 | Map<String, Integer> getCountByJudgeStatus(); |
11 | 15 | ||
12 | -// PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderListReq req); | 16 | + PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req); |
13 | } | 17 | } |
@@ -14,11 +14,11 @@ import org.springframework.stereotype.Service; | @@ -14,11 +14,11 @@ import org.springframework.stereotype.Service; | ||
14 | import com.yoho.core.common.utils.DateUtil; | 14 | import com.yoho.core.common.utils.DateUtil; |
15 | import com.yoho.order.dal.BuyerOrderMapper; | 15 | import com.yoho.order.dal.BuyerOrderMapper; |
16 | import com.yoho.order.model.BuyerOrder; | 16 | import com.yoho.order.model.BuyerOrder; |
17 | +import com.yoho.order.model.BuyerOrderReq; | ||
17 | import com.yoho.ufo.order.constant.Constant; | 18 | import com.yoho.ufo.order.constant.Constant; |
18 | import com.yoho.ufo.order.service.IBuyerOrderService; | 19 | import com.yoho.ufo.order.service.IBuyerOrderService; |
19 | -import com.yohobuy.ufo.model.order.req.BuyerOrderListReq; | 20 | +import com.yoho.ufo.service.model.PageResponseBO; |
20 | import com.yohobuy.ufo.model.order.resp.BuyerOrderResp; | 21 | import com.yohobuy.ufo.model.order.resp.BuyerOrderResp; |
21 | -import com.yohobuy.ufo.model.order.resp.PageResponseBO; | ||
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @author caoyan | 24 | * @author caoyan |
@@ -50,36 +50,35 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -50,36 +50,35 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
50 | return resultMap; | 50 | return resultMap; |
51 | } | 51 | } |
52 | 52 | ||
53 | -// public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderListReq req) { | ||
54 | -// int total = buyerOrderMapper.selectTotalByCondition(req); | ||
55 | -// if(total == 0) { | ||
56 | -// return null; | ||
57 | -// } | ||
58 | -// | ||
59 | -// List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req); | ||
60 | -// if(CollectionUtils.isEmpty(orderList)) { | ||
61 | -// return null; | ||
62 | -// } | ||
63 | -// | ||
64 | -// List<BuyerOrderResp> respList = Lists.newArrayList(); | ||
65 | -// for(BuyerOrder item : orderList) { | ||
66 | -// BuyerOrderResp resp = new BuyerOrderResp(); | ||
67 | -// resp.setOrderCode(item.getOrderCode()); | ||
68 | -// resp.setStatus(item.getStatus()); | ||
69 | -// resp.setCreateTimeStr(DateUtil.long2DateStr(item.getCreateTime()*1000, "yyyy-MM-dd HH:mm:ss")); | ||
70 | -// | ||
71 | -// respList.add(resp); | ||
72 | -// } | ||
73 | -// | ||
74 | -// PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>(); | ||
75 | -// result.setList(respList); | ||
76 | -// result.setPage(req.getPage()); | ||
77 | -// result.setSize(req.getSize()); | ||
78 | -// result.setTotal(total); | ||
79 | -// | ||
80 | -// return result; | ||
81 | - | ||
82 | - | ||
83 | -// } | 53 | + public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req) { |
54 | + int total = buyerOrderMapper.selectTotalByCondition(req); | ||
55 | + if(total == 0) { | ||
56 | + return null; | ||
57 | + } | ||
58 | + | ||
59 | + List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req); | ||
60 | + if(CollectionUtils.isEmpty(orderList)) { | ||
61 | + return null; | ||
62 | + } | ||
63 | + | ||
64 | + List<BuyerOrderResp> respList = Lists.newArrayList(); | ||
65 | + for(BuyerOrder item : orderList) { | ||
66 | + BuyerOrderResp resp = new BuyerOrderResp(); | ||
67 | + resp.setOrderCode(item.getOrderCode()); | ||
68 | + resp.setStatus(item.getStatus()); | ||
69 | + resp.setCreateTimeStr(DateUtil.long2DateStr(item.getCreateTime()*1000, "yyyy-MM-dd HH:mm:ss")); | ||
70 | + | ||
71 | + respList.add(resp); | ||
72 | + } | ||
73 | + | ||
74 | + PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>(); | ||
75 | + result.setList(respList); | ||
76 | + result.setPage(req.getPage()); | ||
77 | + result.setSize(req.getSize()); | ||
78 | + result.setTotal(total); | ||
79 | + | ||
80 | + return result; | ||
81 | + | ||
82 | + } | ||
84 | 83 | ||
85 | } | 84 | } |
-
Please register or login to post a comment