添加“order”相关CRUD代码

This commit is contained in:
longbinbin 2024-11-29 17:21:32 +08:00
parent 81003d6d16
commit 5c93a22f9b
8 changed files with 438 additions and 2 deletions

View File

@ -1,7 +1,5 @@
package com.ycwl.basic.mapper.pc;
import com.ycwl.basic.model.pc.broker.entity.BrokerEntity;
import com.ycwl.basic.model.pc.broker.req.BrokerReqQuery;
import com.ycwl.basic.model.pc.member.entity.MemberEntity;
import com.ycwl.basic.model.pc.member.req.MemberReqQuery;
@ -10,6 +8,7 @@ import java.util.List;
/**
* @Authorlongbinbin
* @Date2024/11/29 15:57
* 用户前台
*/
public interface MemberMapper {
List<MemberEntity> list(MemberReqQuery memberReqQuery);

View File

@ -14,4 +14,6 @@ public interface MenuMapper {
int add(MenuEntity menuEntity);
List<MenuNode>getListByType(@Param("type")Integer type);
int update(MenuEntity menuEntity);
}

View File

@ -0,0 +1,21 @@
package com.ycwl.basic.mapper.pc;
import com.ycwl.basic.model.pc.order.entity.OrderEntity;
import com.ycwl.basic.model.pc.order.req.OrderReqQuery;
import com.ycwl.basic.model.pc.order.resp.OrderRespVO;
import java.util.List;
/**
* @Authorlongbinbin
* @Date2024/11/29 16:32
* 订单
*/
public interface OrderMapper {
List<OrderRespVO> list(OrderReqQuery orderReqQuery);
OrderEntity getById(Long id);
int add(OrderEntity order);
// int deleteById(Long id);
int update(OrderEntity order);
}

View File

@ -0,0 +1,80 @@
package com.ycwl.basic.model.pc.order.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Authorlongbinbin
* @Date2024/11/29 16:33
*/
@Data
@TableName("order")
public class OrderEntity {
@TableId
private Long id;
/**
* 用户id
*/
private Long memberId;
/**
* 微信openId
*/
private Long openId;
/**
* 价格
*/
private BigDecimal price;
/**
* 实际支付价格
*/
private BigDecimal payPrice;
/**
* 备注
*/
private String remark;
/**
* 推客id
*/
private Long brokerId;
/**
* 推客优惠码
*/
private String promoCode;
/**
* 退款原因
*/
private String refundReason;
/**
* 退款状态0未提出1已通过2待审核
*/
private Integer refundStatus;
/**
* 状态0未支付1已支付2已退款9已取消
*/
private Integer status;
/**
* 订单创建时间
*/
private Date createAt;
/**
* 订单更新时间
*/
private Date updateAt;
/**
* 订单支付时间
*/
private Date payAt;
/**
* 订单取消时间
*/
private Date cancelAt;
/**
* 订单退款时间
*/
private Date refundAt;
}

View File

@ -0,0 +1,93 @@
package com.ycwl.basic.model.pc.order.req;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Authorlongbinbin
* @Date2024/11/29 16:33
*/
@Data
@ApiModel(value = "订单查询对象")
public class OrderReqQuery {
@ApiModelProperty("用户昵称")
private String memberNickname;
@ApiModelProperty("用户真实名称")
private String memberRealName;
/**
* 微信openId
*/
@ApiModelProperty("微信openId")
private Long openId;
/**
* 价格
*/
@ApiModelProperty("价格")
private BigDecimal price;
/**
* 实际支付价格
*/
@ApiModelProperty("实际支付价格")
private BigDecimal payPrice;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
* 推客id
*/
@ApiModelProperty("推客id")
private Long brokerId;
/**
* 推客优惠码
*/
@ApiModelProperty("推客优惠码")
private String promoCode;
/**
* 退款原因
*/
@ApiModelProperty("退款原因")
private String refundReason;
/**
* 退款状态0未提出1已通过2待审核
*/
@ApiModelProperty("退款状态0未提出1已通过2待审核")
private Integer refundStatus;
/**
* 状态0未支付1已支付2已退款9已取消
*/
@ApiModelProperty("状态0未支付1已支付2已退款9已取消")
private Integer status;
/**
* 订单创建时间
*/
@ApiModelProperty("订单创建时间")
private Date startCreateTime;
private Date endCreateTime;
/**
* 订单支付时间
*/
@ApiModelProperty("订单支付时间")
private Date startPayTime;
private Date endPayTime;
/**
* 订单取消时间
*/
@ApiModelProperty("订单取消时间")
private Date startCancelTime;
private Date endCancelTime;
/**
* 订单退款时间
*/
@ApiModelProperty("订单退款时间")
private Date startRefundTime;
private Date endRefundTime;
}

View File

@ -0,0 +1,93 @@
package com.ycwl.basic.model.pc.order.resp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Authorlongbinbin
* @Date2024/11/29 15:59
*/
@Data
@ApiModel("查询订单信息响应参数")
public class OrderRespVO {
private Long id;
private Long memberId;
@ApiModelProperty("用户昵称")
private String memberNickname;
@ApiModelProperty("用户真实名称")
private String memberRealName;
/**
* 微信openId
*/
@ApiModelProperty("微信openId")
private Long openId;
/**
* 价格
*/
@ApiModelProperty("价格")
private BigDecimal price;
/**
* 实际支付价格
*/
@ApiModelProperty("实际支付价格")
private BigDecimal payPrice;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
* 推客id
*/
@ApiModelProperty("推客id")
private Long brokerId;
/**
* 推客优惠码
*/
@ApiModelProperty("推客优惠码")
private String promoCode;
/**
* 退款原因
*/
@ApiModelProperty("退款原因")
private String refundReason;
/**
* 退款状态0未提出1已通过2待审核
*/
@ApiModelProperty("退款状态0未提出1已通过2待审核")
private Integer refundStatus;
/**
* 状态0未支付1已支付2已退款9已取消
*/
@ApiModelProperty("状态0未支付1已支付2已退款9已取消")
private Integer status;
/**
* 订单创建时间
*/
@ApiModelProperty("订单创建时间")
private Date createAt;
/**
* 订单更新时间
*/
@ApiModelProperty("订单更新时间")
private Date updateAt;
/**
* 订单支付时间
*/
@ApiModelProperty("订单支付时间")
private Date payAt;
/**
* 订单取消时间
*/
@ApiModelProperty("订单取消时间")
private Date cancelAt;
/**
* 订单退款时间
*/
@ApiModelProperty("订单退款时间")
private Date refundAt;
}

View File

@ -13,6 +13,36 @@
values
(#{id}, #{parentId}, #{target}, #{name}, #{type}, #{sort}, #{permissionUrl}, #{isRemove}, #{businessType}, #{icon})
</insert>
<update id="update">
update menu
<set>
<if test="parentId!= null ">
parent_id = #{parentId},
</if>
<if test="target!= null and target!= ''">
target = #{target},
</if>
<if test="name!= null and name!= ''">
`name` = #{name},
</if>
<if test="type!= null ">
`type` = #{type},
</if>
<if test="sort!= null ">
sort = #{sort},
</if>
<if test="permissionUrl!= null and permissionUrl!= ''">
permission_url = #{permissionUrl},
</if>
<if test="businessType!= null ">
business_type = #{businessType},
</if>
<if test="icon!= null and icon!= ''">
icon = #{icon},
</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycwl.basic.mapper.pc.OrderMapper">
<insert id="add">
insert into `order`(id, member_id, openid,price, pay_price, remark, broker_id, promo_code)
VALUES (#{id}, #{memberId}, #{openid},#{price}, #{payPrice}, #{remark}, #{brokerId}, #{promoCode})
</insert>
<update id="update">
update `order`
<set>
<if test="price!= null ">
price = #{price},
</if>
<if test="payPrice!= null ">
pay_price = #{payPrice},
</if>
<if test="remark!= null and remark!= ''">
remark = #{remark},
</if>
<if test="refundReason!= null and refundReason!= ''">
refund_reason = #{refundReason},
</if>
<if test="refundStatus!= null ">
refund_status = #{refundStatus},
</if>
<if test="status!= null ">
`status` = #{status},
</if>
<if test="refundAt!= null ">
refund_at = #{refundAt},
</if>
<if test="payAt!= null ">
pay_at = #{payAt},
</if>
<if test="cancelAt!= null ">
cancel_at = #{cancelAt},
</if>
</set>
where id = #{id}
</update>
<delete id="deleteById">
delete from `order` where id = #{id}
</delete>
<select id="list" resultType="com.ycwl.basic.model.pc.order.resp.OrderRespVO">
select o.id, member_id,m.nickname memberNickname,m.real_name memberRealName, o.openid, price, pay_price, remark, o.broker_id, o.promo_code,
refund_reason, refund_status, `status`, refund_at, pay_at, cancel_at
from `order` o
left join member m on o.member_id = m.id
<where>
<if test="id!= null ">
and o.id = #{id}
</if>
<if test="memberNickname!= null and memberNickname!=''">
and m.nickname like concat('%',#{memberNickname},'%')
</if>
<if test="memberRealName!= null and memberRealName!=''">
and m.real_name like concat('%',#{memberRealName},'%')
</if>
<if test="price!= null ">
and price = #{price}
</if>
<if test="payPrice!= null ">
and pay_price = #{payPrice}
</if>
<if test="remark!= null and remark!= ''">
and remark like concat('%',#{remark},'%')
</if>
<if test="brokerId!= null ">
and o.broker_id = #{brokerId}
</if>
<if test="promoCode!= null and promoCode!= ''">
and o.promo_code like concat('%',#{promoCode},'%')
</if>
<if test="refundReason!= null and refundReason!= ''">
and refund_reason like concat('%',#{refundReason},'%')
</if>
<if test="refundStatus!= null ">
and refund_status = #{refundStatus}
</if>
<if test="status!= null ">
and `status` = #{status}
</if>
<if test="startCreateTime!= null ">
and o.create_at >= #{startCreateTime}
</if>
<if test="endCreateTime!= null ">
and o.create_at &lt;= #{endCreateTime}
</if>
<if test="startPayTime!= null ">
and pay_at &gt;= #{startPayTime}
</if>
<if test="endPayTime!= null ">
and pay_at &lt;= #{endPayTime}
</if>
<if test="startRefundTime!= null ">
and refund_at &gt;= #{startRefundTime}
</if>
<if test="endRefundTime!= null ">
and refund_at &lt;= #{endRefundTime}
</if>
<if test="startCancelTime!= null ">
and cancel_at &gt;= #{startCancelTime}
</if>
<if test="endCancelTime!= null ">
and cancel_at &lt;= #{endCancelTime}
</if>
</where>
order by o.create_at desc
</select>
<select id="getById" resultType="com.ycwl.basic.model.pc.order.entity.OrderEntity">
select o.id, o.member_id, o.openid, o.price, o.pay_price, o.remark, o.broker_id, o.promo_code, o.refund_reason,
o.refund_status, o.status, o.create_at, o.update_at, o.pay_at, o.cancel_at, o.refund_at,
m.nickname memberNickname, m.real_name memberRealName
from `order` o
left join member m on m.id = o.member_id
where o.id = #{id}
</select>
</mapper>