订单状态数量接口
This commit is contained in:
parent
59f084baf4
commit
da9fca3675
|
|
@ -186,6 +186,16 @@ public class OrderDetailController extends BaseController {
|
|||
return getDataTable(orderDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询每种订单状态有多少数量
|
||||
*/
|
||||
@GetMapping("/status/count")
|
||||
@ResponseBody
|
||||
public AjaxResult statusCount() {
|
||||
List<OrderStatusCount> statusCount = orderDetailService.statusCount();
|
||||
return AjaxResult.success(statusCount);
|
||||
}
|
||||
|
||||
@PostMapping("/app/detail")
|
||||
@ResponseBody
|
||||
public AjaxResult appDetail(@RequestBody OrderDetail request) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package com.ghy.order.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderStatusCount {
|
||||
|
||||
private Integer orderStatus;
|
||||
private Long count;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ghy.order.mapper;
|
||||
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.ghy.order.domain.OrderStatusCount;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -86,4 +87,6 @@ public interface OrderDetailMapper {
|
|||
* 查询指定状态的订单
|
||||
*/
|
||||
List<OrderDetail> selectByStatus(List<Integer> status);
|
||||
|
||||
List<OrderStatusCount> statusCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ghy.order.service;
|
||||
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.ghy.order.domain.OrderStatusCount;
|
||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
|
||||
|
|
@ -131,4 +132,5 @@ public interface OrderDetailService {
|
|||
|
||||
FinancialChangeRecord getChangedPriceRecord(Long orderDetailId);
|
||||
|
||||
List<OrderStatusCount> statusCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.ghy.common.utils.ObjectUtils;
|
|||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.ghy.order.domain.OrderGoods;
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
import com.ghy.order.domain.OrderStatusCount;
|
||||
import com.ghy.order.mapper.OrderDetailMapper;
|
||||
import com.ghy.order.mapper.OrderMasterMapper;
|
||||
import com.ghy.order.service.OrderDetailService;
|
||||
|
|
@ -569,4 +570,9 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStatusCount> statusCount() {
|
||||
return orderDetailMapper.statusCount();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,6 +259,16 @@
|
|||
WHERE order_master_id = #{orderMasterId}
|
||||
</update>
|
||||
|
||||
<select id="statusCount" resultType="com.ghy.order.domain.OrderStatusCount">
|
||||
SELECT
|
||||
`order_status` AS `orderStatus`,
|
||||
COUNT( * ) AS `count`
|
||||
FROM
|
||||
`order_detail`
|
||||
GROUP BY
|
||||
order_status
|
||||
</select>
|
||||
|
||||
<insert id="insertOrderDetail" parameterType="com.ghy.order.domain.OrderDetail" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO order_detail(
|
||||
<if test="code != null and code != ''">code,</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue