feat:商城1.0.0基础版本

This commit is contained in:
haoxr 2021-03-22 00:53:29 +08:00
parent 1d06be93b1
commit bcbb405d3c
12 changed files with 43 additions and 43 deletions

View File

@ -100,4 +100,10 @@ public class OmsOrder extends BaseEntity {
@TableField(exist = false)
private List<OmsOrderItem> orderItems;
@TableField(exist = false)
private String startDate;
@TableField(exist = false)
private String endDate;
}

View File

@ -45,29 +45,12 @@ public class OrderController {
@GetMapping
@ApiImplicitParams({
@ApiImplicitParam(name = "page", defaultValue = "1", value = "页码", paramType = "query", dataType = "Long"),
@ApiImplicitParam(name = "limit", defaultValue = "10", value = "每页数量", paramType = "query", dataType = "Long"),
@ApiImplicitParam(name = "status", value = "订单状态", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "limit", defaultValue = "10", value = "每页数量", paramType = "query", dataType = "Long")
})
public Result list(
@RequestParam(defaultValue = "1") Long page,
@RequestParam(defaultValue = "10") Long limit,
Integer status,
String startDate,
String endDate,
String orderSn
) {
LambdaQueryWrapper<OmsOrder> queryWrapper = new LambdaQueryWrapper<OmsOrder>()
.like(StrUtil.isNotBlank(orderSn), OmsOrder::getOrderSn, orderSn)
.eq(status != null, OmsOrder::getStatus, status)
.apply(StrUtil.isNotBlank(startDate),
"date_format (gmt_crate,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')")
.apply(StrUtil.isNotBlank(endDate),
"date_format (gmt_crate,'%Y-%m-%d') <= date_format('" + endDate + "','%Y-%m-%d')")
.orderByDesc(OmsOrder::getGmtModified)
.orderByDesc(OmsOrder::getGmtCreate);
IPage<OmsOrder> result = orderService.list(new Page<>(page, limit), new OmsOrder().setStatus(status));
public Result list(@RequestParam(defaultValue = "1") Long page,
@RequestParam(defaultValue = "10") Long limit,
OmsOrder order) {
IPage<OmsOrder> result = orderService.list(new Page<>(page, limit), order);
return Result.success(result.getRecords(), result.getTotal());
}

View File

@ -1,9 +1,10 @@
package com.youlai.mall.oms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.mall.oms.pojo.domain.OmsOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
@ -16,13 +17,22 @@ import java.util.List;
@Mapper
public interface OrderMapper extends BaseMapper<OmsOrder> {
@Select("<script>" +
" select id,order_sn,total_amount,pay_amount,status,total_amount,total_quantity,gmt_create,member_id,source_type from oms_order" +
" select id,order_sn,total_amount,pay_amount,pay_type,status,total_amount,total_quantity,gmt_create,member_id,source_type from oms_order" +
" where 1=1 " +
" <if test ='order.status !=null ' >" +
" AND status= #{order.status} " +
" </if>" +
" <if test ='order.orderSn !=null and order.orderSn.trim() neq \"\"' >" +
" AND order_sn= #{order.orderSn} " +
" </if>" +
" <if test ='order.startDate !=null and order.startDate.trim() neq \"\"' >" +
" AND date_format (gmt_crate,'%Y-%m-%d') &gt;= date_format(#{order.startDate},'%Y-%m-%d')" +
" </if>" +
" <if test ='order.endDate !=null and order.endDate.trim() neq \"\"' >" +
" AND date_format (gmt_crate,'%Y-%m-%d') &lt;= date_format(#{order.endDate},'%Y-%m-%d') " +
" </if>" +
" order by gmt_create desc "+
"</script>")
@Results({
@Result(id = true, column = "id", property = "id"),

View File

@ -54,7 +54,6 @@ public class CartServiceImpl implements ICartService {
return cartItems;
}
/**
* 删除用户购物车(清空购物车)
*/

View File

@ -149,7 +149,7 @@
<version>1.0.0</version>
<executions>
<!--执行mvn package,即执行 mvn clean package docker:build-->
<!--<execution>
<!-- <execution>
<id>build-image</id>
<phase>package</phase>
<goals>
@ -174,9 +174,9 @@
<entryPoint>["java","-jar","${project.build.finalName}.jar"]</entryPoint>
<!-- 指定远程 Docker API地址 -->
<dockerHost>https://b.youlai.store:2376</dockerHost>
<dockerHost>https://f.youlai.store:2376</dockerHost>
<!-- 指定tls证书的目录 -->
<dockerCertPath>C:\cert\docker\b.youlai.store</dockerCertPath>
<dockerCertPath>C:\cert\docker\f.youlai.store</dockerCertPath>
<!-- 复制 jar包到docker容器指定目录-->
<resources>

View File

@ -1,3 +1,3 @@
spring:
profiles:
active: dev
active: dev

View File

@ -5,6 +5,8 @@ import lombok.Data;
@Data
public class MemberVO {
private Long id;
private String nickname;

View File

@ -30,7 +30,7 @@ public class AddressController {
@ApiOperation(value = "获取会员的地址列表")
@GetMapping
public Result list(@RequestParam Long memberId) {
public Result list(@RequestParam(required = false) Long memberId) {
List<UmsAddress> addressList = iUmsAddressService.list(new LambdaQueryWrapper<UmsAddress>()
.eq(UmsAddress::getMemberId, memberId)
.orderByDesc(UmsAddress::getDefaulted));

View File

@ -11,7 +11,7 @@ import java.util.List;
public interface UmsAddressMapper extends BaseMapper<UmsAddress> {
@Select("<script>" +
" SELECT * from ums_address where user_id =#{userId} " +
" SELECT * from ums_address where member_id =#{userId} " +
"</script>")
List<UmsAddress> listByUserId(Long userId);

View File

@ -117,7 +117,7 @@
<entryPoint>["java","-jar","${project.build.finalName}.jar"]</entryPoint>
<!-- 指定远程 Docker API地址 -->
<dockerHost>http://f.youlai.store:2375</dockerHost>
<dockerHost>https://f.youlai.store:2376</dockerHost>
<!-- 指定tls证书的目录 -->
<dockerCertPath>C:\cert\docker\f.youlai.store</dockerCertPath>

View File

@ -153,7 +153,7 @@
<entryPoint>["java","-jar","${project.build.finalName}.jar"]</entryPoint>
<!-- 指定远程 Docker API地址 -->
<dockerHost>http://f.youlai.store:2375</dockerHost>
<dockerHost>https://f.youlai.store:2376</dockerHost>
<!-- 指定tls证书的目录 -->
<dockerCertPath>C:\cert\docker\f.youlai.store</dockerCertPath>

View File

@ -34,6 +34,15 @@ public class Result<T> implements Serializable {
}
public static <T> Result<T> success(T data, Long total) {
Result<T> result = new Result();
result.setCode(ResultCode.SUCCESS.getCode());
result.setMsg(ResultCode.SUCCESS.getMsg());
result.setData(data);
result.setTotal(total.intValue());
return result;
}
public static <T> Result<T> failed() {
return result(ResultCode.SYSTEM_EXECUTION_ERROR.getCode(), ResultCode.SYSTEM_EXECUTION_ERROR.getMsg(), null);
}
@ -66,15 +75,6 @@ public class Result<T> implements Serializable {
return result;
}
public static <T> Result<T> success(T data, Long total) {
Result<T> result = new Result();
result.setCode(ResultCode.SUCCESS.getCode());
result.setMsg(ResultCode.SUCCESS.getMsg());
result.setData(data);
result.setTotal(total.intValue());
return result;
}
public static boolean isSuccess(Result result) {
if(result!=null&&ResultCode.SUCCESS.getCode().equals(result.getCode())){