Commit 808d8885 authored by machengbo's avatar machengbo

订单管理查询

parent d5626afd
...@@ -35,7 +35,7 @@ public class DatabaseConfig { ...@@ -35,7 +35,7 @@ public class DatabaseConfig {
/** /**
* mapper文件的相对路径 * mapper文件的相对路径
*/ */
private static final String MAPPER_LOCATION = "classpath:mapperconf.*/*.xml"; private static final String MAPPER_LOCATION = "classpath:mapperconf/*.xml";
private String filters; private String filters;
private String url; private String url;
......
package com.jz.dm.mall.moduls.controller.order; package com.jz.dm.mall.moduls.controller.order;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.jz.common.bean.PageInfoResponse;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jz.common.constant.Constants;
import com.jz.common.utils.Result; import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.entity.Order;
import com.jz.dm.mall.moduls.service.OrderService; import com.jz.dm.mall.moduls.service.OrderService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -30,13 +27,21 @@ public class OrderController{ ...@@ -30,13 +27,21 @@ public class OrderController{
@Autowired @Autowired
private OrderService tOrderService; private OrderService tOrderService;
@GetMapping(value = "/list") @PostMapping(value = "/list")
@ApiOperation(value = "订单管理列表(分页查询)", notes = "订单列表(分页查询)") @ApiOperation(value = "订单管理列表(分页查询)", notes = "订单列表(分页查询)")
public Result<IPage<Order>> queryPageList(Order order, HttpServletRequest req) throws Exception { public PageInfoResponse<OrderDto> queryPageList(@RequestBody OrderDto OrderDto, HttpServletRequest req) throws Exception {
Result<IPage<Order>> result = new Result<IPage<Order>>(); PageInfoResponse<OrderDto> pageInfo = new PageInfoResponse<OrderDto>();
IPage<Order> pageList = tOrderService.queryPage(new Page<Order>(1, 2), order); try {
pageInfo = tOrderService.findList(OrderDto, req);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
/* Result<IPage<OrderDto>> result = new Result<IPage<OrderDto>>();
IPage<OrderDto> pageList = tOrderService.queryPage(new Page<OrderDto>(1, 2), order);
result.setSuccess(true); result.setSuccess(true);
result.setResult(pageList); result.setResult(pageList);*/
return result; return pageInfo;
} }
} }
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.order.bean;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import java.util.Date;
/**
* 订单表(TOrder)实体类
*
* @author makejava
* @since 2020-12-01 10:41:40
*/
@ApiModel
public class OrderDto extends BasePageBean {
private static final long serialVersionUID = 651546246975691600L;
/**
* 订单id
*/
private Long orderId;
/**
* 订单编号
*/
private String orderNumber;
/**
* 用户id
*/
private Long customerId;
/**
* 订单状态:01待支付,02已支付,03已取消
*/
private String orderStatus;
/**
* 订单金额
*/
private Double orderMoney;
/**
* 订单时间
*/
private Date orderTime;
/**
* 卖家id
*/
private Long sellerId;
/**
* 支付金额
*/
private Double paymentMoney;
/**
* 支付时间
*/
private Date paymentTime;
/**
* 支付方式:01余额
*/
private String paymentMethod;
/**
* 优惠金额
*/
private Double districtMoney;
/**
* 购买方式:01年,02季,03月,04次(服务类型)
*/
private String purchaseMethod;
/**
* 商品token
*/
private String goodsToken;
/**
* 盐值
*/
private String saltValue;
/**
* apikey
*/
private String apiKey;
/**
* 生效日期
*/
private Date takeEffectTime;
/**
* 失效日期
*/
private Date invalidTime;
/**
* 价格类型:01免费,02收费
*/
private String priceType;
/**
* 创建人
*/
private String crePerson;
/**
* 创建时间
*/
private Date creTime;
/**
* 更新时间
*/
private Date uptTime;
/**
* 更新人
*/
private String uptPerson;
/**
* 删除标识
*/
private String delFlag;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public String getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public Double getOrderMoney() {
return orderMoney;
}
public void setOrderMoney(Double orderMoney) {
this.orderMoney = orderMoney;
}
public Date getOrderTime() {
return orderTime;
}
public void setOrderTime(Date orderTime) {
this.orderTime = orderTime;
}
public Long getSellerId() {
return sellerId;
}
public void setSellerId(Long sellerId) {
this.sellerId = sellerId;
}
public Double getPaymentMoney() {
return paymentMoney;
}
public void setPaymentMoney(Double paymentMoney) {
this.paymentMoney = paymentMoney;
}
public Date getPaymentTime() {
return paymentTime;
}
public void setPaymentTime(Date paymentTime) {
this.paymentTime = paymentTime;
}
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public Double getDistrictMoney() {
return districtMoney;
}
public void setDistrictMoney(Double districtMoney) {
this.districtMoney = districtMoney;
}
public String getPurchaseMethod() {
return purchaseMethod;
}
public void setPurchaseMethod(String purchaseMethod) {
this.purchaseMethod = purchaseMethod;
}
public String getGoodsToken() {
return goodsToken;
}
public void setGoodsToken(String goodsToken) {
this.goodsToken = goodsToken;
}
public String getSaltValue() {
return saltValue;
}
public void setSaltValue(String saltValue) {
this.saltValue = saltValue;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public Date getTakeEffectTime() {
return takeEffectTime;
}
public void setTakeEffectTime(Date takeEffectTime) {
this.takeEffectTime = takeEffectTime;
}
public Date getInvalidTime() {
return invalidTime;
}
public void setInvalidTime(Date invalidTime) {
this.invalidTime = invalidTime;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper; package com.jz.dm.mall.moduls.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jz.common.base.BaseMapper; import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.entity.Order; import com.jz.dm.mall.moduls.entity.Order;
import java.util.List;
import java.util.Map;
/** /**
* 订单表(TOrder)表数据库访问层 * 订单表(TOrder)表数据库访问层
* *
...@@ -14,5 +16,5 @@ import com.jz.dm.mall.moduls.entity.Order; ...@@ -14,5 +16,5 @@ import com.jz.dm.mall.moduls.entity.Order;
public interface OrderDao extends BaseMapper<Order> { public interface OrderDao extends BaseMapper<Order> {
IPage<Order> queryPage(Page<Order> orderPage,Order order); List<OrderDto> findList(Map<String, Object> param)throws Exception;
} }
\ No newline at end of file
package com.jz.dm.mall.moduls.service; package com.jz.dm.mall.moduls.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.jz.common.bean.PageInfoResponse;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.entity.Order;
import javax.servlet.http.HttpServletRequest;
/** /**
* 订单表(TOrder)表服务接口 * 订单表(TOrder)表服务接口
...@@ -13,5 +14,5 @@ import com.jz.dm.mall.moduls.entity.Order; ...@@ -13,5 +14,5 @@ import com.jz.dm.mall.moduls.entity.Order;
public interface OrderService { public interface OrderService {
IPage<Order> queryPage(Page<Order> orderPage, Order order); PageInfoResponse<OrderDto> findList(OrderDto order, HttpServletRequest req)throws Exception;
} }
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl; package com.jz.dm.mall.moduls.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.pagehelper.PageHelper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.pagehelper.PageInfo;
import com.jz.common.entity.User; import com.jz.common.bean.PageInfoResponse;
import com.jz.dm.mall.moduls.entity.Order; import com.jz.common.constant.Constants;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.mapper.OrderDao; import com.jz.dm.mall.moduls.mapper.OrderDao;
import com.jz.dm.mall.moduls.service.OrderService; import com.jz.dm.mall.moduls.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 订单表(TOrder)表服务实现类 * 订单表(TOrder)表服务实现类
* *
...@@ -19,11 +25,39 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -19,11 +25,39 @@ import org.springframework.transaction.annotation.Transactional;
@Service("orderService") @Service("orderService")
@Transactional @Transactional
public class OrderServiceImpl implements OrderService { public class OrderServiceImpl implements OrderService {
@Autowired @Autowired
private OrderDao tOrderDao; private OrderDao tOrderDao;
@Override @Override
public IPage<Order> queryPage(Page<Order> orderPage, Order order) { public PageInfoResponse<OrderDto> findList(OrderDto order, HttpServletRequest req) throws Exception{
return tOrderDao.queryPage(orderPage,order); PageInfoResponse<OrderDto> pageInfoResponse = new PageInfoResponse<>();
Map<String, Object> param = new HashMap<>();
//数据商品id
if (order.getOrderNumber() != null) {
param.put("orderNumber", order.getOrderNumber());
}
//商品分类id(行业)
if (order.getPurchaseMethod() != null) {
param.put("purchaseMethod", order.getPurchaseMethod());
}
/* //数据商户id
if (order.getUserId() != null) {
param.put("userId", order.getUserId());
}
//数据商品名称
if (!StringUtils.isEmpty(order.getDataName())) {
param.put("dataName", order.getDataName());
}*/
PageHelper.startPage(order.getPageNum(), order.getPageSize());
List<OrderDto> list = tOrderDao.findList(param);
PageInfo<OrderDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
} }
} }
\ No newline at end of file
...@@ -12,10 +12,10 @@ management: ...@@ -12,10 +12,10 @@ management:
spring: spring:
profiles: test profiles: test
datasource: datasource:
url: jdbc:mysql://119.23.32.151:3306/dm_demo?characterEncoding=utf8&useSSL=false url: jdbc:mysql://rm-wz9n399q2avsy3k6m4o.mysql.rds.aliyuncs.com:3306/wj-mkt-project?characterEncoding=utf8&useSSL=false
driverClassName: com.mysql.jdbc.Driver driverClassName: com.mysql.jdbc.Driver
username: dmp username: root
password: Ioubuy@2019@! password: I%ou$buy!ok
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
#监控统计拦截的filters #监控统计拦截的filters
filters: stat filters: stat
......
...@@ -223,36 +223,41 @@ ...@@ -223,36 +223,41 @@
delete from t_order where order_id = #{orderId} delete from t_order where order_id = #{orderId}
</delete> </delete>
<select id="queryPage" resultType="com.jz.dm.mall.moduls.entity.Order"> <select id="findList" resultType="com.jz.dm.mall.moduls.controller.order.bean.OrderDto" parameterType="map">
select select
t.order_id as orderId, t.order_id as orderId,
t.order_number as orderNumber, t.order_number as orderNumber,
t.customer_id as customerId, t.customer_id as customerId,
t.order_status as orderStatus, (case when t.order_status ='01' then '待支付'
when t.order_status ='02' then '已支付'
when t.order_status ='03' then '已取消'
end) as orderStatus,
t.order_money as orderMoney, t.order_money as orderMoney,
t.order_time as orderTime, t.order_time as orderTime,
t.payment_money as paymentMoney, t.payment_money as paymentMoney,
t.payment_time as paymentTime, t.payment_time as paymentTime,
t.payment_method AS paymentMethod, t.payment_method AS paymentMethod,
t.purchase_method AS purchaseMethod, (case when t.purchase_method ='01' then '年'
when t.purchase_method ='02' then '季'
when t.purchase_method ='03' then '月'
when t.purchase_method ='04' then '次'
end) as purchaseMethod,
t.price_type as priceType, t.price_type as priceType,
t.cre_time as creTime, t.cre_time as creTime,
t2.data_name as dataName, t2.data_name as dataName,
t2.data_type as dataType (case when t2.data_type ='01' then 'API' when t2.data_type ='02' then '数据包' end) as dataType
from t_order t from t_order t
left join t_order_goods_info t1 on t.order_id=t1.order_id left join t_order_goods_info t1 on t.order_id=t1.order_id
inner join t_data_goods t2 on t2.data_goods_id=t1.data_goods_id inner join t_data_goods t2 on t2.data_goods_id=t1.data_goods_id
where 1=1 where 1=1
<if test="orderId != null">and order_id = #{orderId}</if> <if test="orderId != null">and t.order_id = #{orderId}</if>
<if test="orderNumber != null and orderNumber != ''">and order_number = #{orderNumber}</if> <if test="dataType != null and dataType != ''">and t2.data_type = #{dataType}</if>
<if test="customerId != null">and customer_id = #{customerId}</if> <if test="orderNumber != null and orderNumber != ''">and t.order_number = #{orderNumber}</if>
<if test="orderStatus != null and orderStatus != ''">and order_status = #{orderStatus}</if> <if test="dataName != null and dataName != ''">and t2.data_name like concat('%',#{dataName},'%')</if>
<if test="orderMoney != null">and order_money = #{orderMoney}</if> <if test="purchaseMethod != null and purchaseMethod != ''">and t.purchase_method = #{purchaseMethod}</if>
<if test="orderTime != null">and order_time = #{orderTime}</if> <if test="categoryId != null">and t2.category_id = #{categoryId}</if>
<if test="sellerId != null">and seller_id = #{sellerId}</if> <if test="orderStatus != null and orderStatus != ''">and t.order_status = #{orderStatus}</if>
<if test="paymentMethod != null and paymentMethod != ''">and payment_method = #{paymentMethod}</if> <if test="orderTime != null">and t.order_time = #{orderTime}</if>
<if test="districtMoney != null">and district_money = #{districtMoney}</if>
<if test="purchaseMethod != null and purchaseMethod != ''">and purchase_method = #{purchaseMethod}</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment