服务包订单
This commit is contained in:
parent
687d76095b
commit
4e0dcc087f
|
@ -0,0 +1,12 @@
|
||||||
|
package com.sqx.modules.bl.order.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.sqx.modules.bl.massage.entity.MassagePackage;
|
||||||
|
import com.sqx.modules.bl.order.entity.UserPackage;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface UserPackageDao extends BaseMapper<UserPackage> {
|
||||||
|
|
||||||
|
int insert(UserPackage userPackage);
|
||||||
|
}
|
|
@ -11,4 +11,8 @@ public interface UserPackageDetailDao extends BaseMapper<UserPackageDetail> {
|
||||||
|
|
||||||
List<UserPackageDetail> findDetailUsedQuantity(UserPackageDetail userPackageDetail);
|
List<UserPackageDetail> findDetailUsedQuantity(UserPackageDetail userPackageDetail);
|
||||||
|
|
||||||
|
List<UserPackageDetail> findMassagePackageDetails(UserPackageDetail userPackageDetail);
|
||||||
|
|
||||||
|
int insert(UserPackageDetail userPackageDetail);
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,4 +18,8 @@ public interface UserPackageOrderDao extends BaseMapper<UserPackageOrder> {
|
||||||
|
|
||||||
int refund(UserPackageOrder userPackageOrder);
|
int refund(UserPackageOrder userPackageOrder);
|
||||||
|
|
||||||
|
int insertOrders(UserPackageOrder userPackageOrder);
|
||||||
|
|
||||||
|
int insertCoupon(UserPackageOrder userPackageOrder);
|
||||||
|
|
||||||
}
|
}
|
|
@ -133,6 +133,12 @@ public class UserPackageDetail implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String jianjie;
|
private String jianjie;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 次数
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer serviceCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单id
|
* 订单id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class UserPackageOrder implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 姓名
|
* 姓名
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,6 +128,11 @@ public class UserPackageOrder implements Serializable {
|
||||||
*/
|
*/
|
||||||
private BigDecimal refundMoney;
|
private BigDecimal refundMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户优惠券id
|
||||||
|
*/
|
||||||
|
private Long userCouponId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代金券名称
|
* 代金券名称
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.bl.order.entity.UserPackageDetail;
|
import com.sqx.modules.bl.order.entity.UserPackageDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface UserPackageDetailService extends IService<UserPackageDetail> {
|
public interface UserPackageDetailService extends IService<UserPackageDetail> {
|
||||||
Result findDetailUsedQuantity(UserPackageDetail userPackageDetail);
|
Result findDetailUsedQuantity(UserPackageDetail userPackageDetail);
|
||||||
|
List<UserPackageDetail> findMassagePackageDetails(UserPackageDetail userPackageDetail);
|
||||||
|
int insert(UserPackageDetail userPackageDetail);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,4 +8,6 @@ public interface UserPackageOrderService extends IService<UserPackageOrder> {
|
||||||
Result findPage(UserPackageOrder userPackageOrder);
|
Result findPage(UserPackageOrder userPackageOrder);
|
||||||
Result findCoupon(UserPackageOrder userPackageOrder);
|
Result findCoupon(UserPackageOrder userPackageOrder);
|
||||||
int refund(UserPackageOrder userPackageOrder);
|
int refund(UserPackageOrder userPackageOrder);
|
||||||
|
|
||||||
|
void buy(UserPackageOrder userPackageOrder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.sqx.modules.bl.order.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.sqx.modules.bl.order.entity.UserPackage;
|
||||||
|
|
||||||
|
public interface UserPackageService extends IService<UserPackage> {
|
||||||
|
|
||||||
|
int insert(UserPackage userPackage);
|
||||||
|
}
|
|
@ -7,6 +7,8 @@ import com.sqx.modules.bl.order.entity.UserPackageDetail;
|
||||||
import com.sqx.modules.bl.order.service.UserPackageDetailService;
|
import com.sqx.modules.bl.order.service.UserPackageDetailService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserPackageDetailServiceImpl extends ServiceImpl<UserPackageDetailDao, UserPackageDetail> implements UserPackageDetailService {
|
public class UserPackageDetailServiceImpl extends ServiceImpl<UserPackageDetailDao, UserPackageDetail> implements UserPackageDetailService {
|
||||||
|
|
||||||
|
@ -15,4 +17,14 @@ public class UserPackageDetailServiceImpl extends ServiceImpl<UserPackageDetailD
|
||||||
return Result.success().put("data",baseMapper.findDetailUsedQuantity(userPackageDetail));
|
return Result.success().put("data",baseMapper.findDetailUsedQuantity(userPackageDetail));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserPackageDetail> findMassagePackageDetails(UserPackageDetail userPackageDetail){
|
||||||
|
return baseMapper.findMassagePackageDetails(userPackageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insert(UserPackageDetail userPackageDetail){
|
||||||
|
return baseMapper.insert(userPackageDetail);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,20 +1,56 @@
|
||||||
package com.sqx.modules.bl.order.service.impl;
|
package com.sqx.modules.bl.order.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.sqx.common.utils.PageUtils;
|
import com.sqx.common.utils.PageUtils;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
|
import com.sqx.modules.app.dao.VipDetailsDao;
|
||||||
|
import com.sqx.modules.app.entity.UserVip;
|
||||||
|
import com.sqx.modules.app.entity.VipDetails;
|
||||||
|
import com.sqx.modules.app.service.UserVipService;
|
||||||
|
import com.sqx.modules.bl.massage.entity.MassagePackage;
|
||||||
|
import com.sqx.modules.bl.massage.service.MassagePackageService;
|
||||||
import com.sqx.modules.bl.order.dao.UserPackageOrderDao;
|
import com.sqx.modules.bl.order.dao.UserPackageOrderDao;
|
||||||
|
import com.sqx.modules.bl.order.entity.UserPackage;
|
||||||
|
import com.sqx.modules.bl.order.entity.UserPackageDetail;
|
||||||
import com.sqx.modules.bl.order.entity.UserPackageOrder;
|
import com.sqx.modules.bl.order.entity.UserPackageOrder;
|
||||||
|
import com.sqx.modules.bl.order.service.UserPackageDetailService;
|
||||||
import com.sqx.modules.bl.order.service.UserPackageOrderService;
|
import com.sqx.modules.bl.order.service.UserPackageOrderService;
|
||||||
|
import com.sqx.modules.bl.order.service.UserPackageService;
|
||||||
|
import com.sqx.modules.coupon.entity.CouponUser;
|
||||||
|
import com.sqx.modules.coupon.service.CouponUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserPackageOrderServiceImpl extends ServiceImpl<UserPackageOrderDao, UserPackageOrder> implements UserPackageOrderService {
|
public class UserPackageOrderServiceImpl extends ServiceImpl<UserPackageOrderDao, UserPackageOrder> implements UserPackageOrderService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UserVipService userVipService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
VipDetailsDao vipDetailsDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MassagePackageService massagePackageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CouponUserService couponUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UserPackageService userPackageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UserPackageDetailService userPackageDetailService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result findPage(UserPackageOrder userPackageOrder){
|
public Result findPage(UserPackageOrder userPackageOrder){
|
||||||
Page<UserPackageOrder> pages=new Page<>(userPackageOrder.getPage(),userPackageOrder.getLimit());
|
Page<UserPackageOrder> pages=new Page<>(userPackageOrder.getPage(),userPackageOrder.getLimit());
|
||||||
|
@ -33,4 +69,137 @@ public class UserPackageOrderServiceImpl extends ServiceImpl<UserPackageOrderDao
|
||||||
return baseMapper.refund(userPackageOrder);
|
return baseMapper.refund(userPackageOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buy(UserPackageOrder userPackageOrder){
|
||||||
|
String ordersNo = userPackageOrder.getOrdersNo();
|
||||||
|
Long packageId = userPackageOrder.getPackageId();
|
||||||
|
Long userId = userPackageOrder.getUserId();
|
||||||
|
int quantity = userPackageOrder.getQuantity();
|
||||||
|
BigDecimal payMoney = userPackageOrder.getPayMoney();
|
||||||
|
String couponIds = userPackageOrder.getCouponId();
|
||||||
|
|
||||||
|
//获取用户VIP的优惠信息
|
||||||
|
BigDecimal vipRate = new BigDecimal(100);
|
||||||
|
UserVip userVip = userVipService.selectUserVipByUserId(userId);
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
if (userVip != null) {
|
||||||
|
if(userVip.getIsVip() == 1){
|
||||||
|
//获取用户到期时间
|
||||||
|
Date date = null;
|
||||||
|
try {
|
||||||
|
date = simpleDateFormat.parse(userVip.getEndTime());
|
||||||
|
if (date.getTime() >= System.currentTimeMillis()) {
|
||||||
|
VipDetails vipDetails = vipDetailsDao.selectOne(new QueryWrapper<VipDetails>().eq("vip_name_type", userVip.getVipNameType()));
|
||||||
|
if(vipDetails != null){
|
||||||
|
vipRate = vipDetails.getRate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userPackageOrder.setVipRate(vipRate);
|
||||||
|
|
||||||
|
//获取服务包信息
|
||||||
|
MassagePackage massagePackage = massagePackageService.getById(packageId);
|
||||||
|
BigDecimal price = massagePackage.getPrice();
|
||||||
|
userPackageOrder.setPackageName(massagePackage.getTitle());
|
||||||
|
userPackageOrder.setType(massagePackage.getType());
|
||||||
|
userPackageOrder.setPrice(price);
|
||||||
|
BigDecimal oldSumMoney = (price.multiply(new BigDecimal(quantity)));
|
||||||
|
userPackageOrder.setOldSumMoney(oldSumMoney);
|
||||||
|
BigDecimal sumMoney = oldSumMoney.multiply(vipRate).divide(new BigDecimal(100));
|
||||||
|
userPackageOrder.setSumMoney(sumMoney);
|
||||||
|
|
||||||
|
List<CouponUser> CouponUserList = Lists.newArrayList();
|
||||||
|
if(payMoney != null && payMoney.compareTo(new BigDecimal(0)) > 0){
|
||||||
|
//不做处理
|
||||||
|
}else{
|
||||||
|
//获取代金券,计算
|
||||||
|
if(couponIds.length()>0){
|
||||||
|
String[] couponArr = couponIds.trim().split(",");
|
||||||
|
BigDecimal couponMoney = new BigDecimal(0);
|
||||||
|
int count = 0;
|
||||||
|
for(int i=0;i<couponArr.length;i++){
|
||||||
|
if(couponArr[i]!=null && !couponArr[i].equals("")){
|
||||||
|
Long couponId = Long.valueOf(couponArr[i]);
|
||||||
|
CouponUser couponUser = couponUserService.getById(couponId);
|
||||||
|
CouponUserList.add(couponUser);
|
||||||
|
BigDecimal money= couponUser.getMoney();
|
||||||
|
couponMoney = couponMoney.add(money);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userPackageOrder.setCouponCount(count);
|
||||||
|
userPackageOrder.setCouponMoney(couponMoney);
|
||||||
|
payMoney = sumMoney.subtract(couponMoney);
|
||||||
|
}else{
|
||||||
|
payMoney = sumMoney;
|
||||||
|
}
|
||||||
|
userPackageOrder.setPayMoney(payMoney);
|
||||||
|
}
|
||||||
|
userPackageOrder.setPayTime(simpleDateFormat.format(new Date()));
|
||||||
|
userPackageOrder.setStatus(1);
|
||||||
|
//插入订单表
|
||||||
|
baseMapper.insert(userPackageOrder);
|
||||||
|
Long ordersId = userPackageOrder.getOrdersId();
|
||||||
|
//插入订单代金券表
|
||||||
|
if(CouponUserList.size()>0){
|
||||||
|
for(int i=0;i<CouponUserList.size();i++){
|
||||||
|
CouponUser couponUser = CouponUserList.get(i);
|
||||||
|
UserPackageOrder upo = new UserPackageOrder();
|
||||||
|
upo.setOrdersId(ordersId);
|
||||||
|
upo.setUserCouponId(couponUser.getId());
|
||||||
|
upo.setCouponName(couponUser.getCouponName());
|
||||||
|
upo.setCouponMoney(couponUser.getMoney());
|
||||||
|
baseMapper.insertCoupon(upo);
|
||||||
|
//更新用户代金卷表
|
||||||
|
couponUserService.update(Wrappers.<CouponUser>lambdaUpdate().eq(CouponUser::getId, couponUser.getId()).set(CouponUser::getStatus, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i=0;i<quantity;i++){
|
||||||
|
//拆分插入用户服务包
|
||||||
|
UserPackage userPackage = new UserPackage();
|
||||||
|
userPackage.setUserId(userId);
|
||||||
|
userPackage.setPackageId(massagePackage.getId());
|
||||||
|
userPackage.setOrdersId(ordersId);
|
||||||
|
userPackage.setOrdersNo(ordersNo);
|
||||||
|
userPackage.setCreateTime(simpleDateFormat.format(new Date()));
|
||||||
|
userPackage.setTitle(massagePackage.getTitle());
|
||||||
|
userPackage.setType(massagePackage.getType());
|
||||||
|
userPackage.setOldPrice(massagePackage.getOldPrice());
|
||||||
|
userPackage.setPrice(massagePackage.getPrice());
|
||||||
|
userPackage.setPackageImg(massagePackage.getPackageImg());
|
||||||
|
userPackage.setContent(massagePackage.getContent());
|
||||||
|
userPackage.setContentImg(massagePackage.getContentImg());
|
||||||
|
userPackage.setLabels(massagePackage.getLabels());
|
||||||
|
userPackage.setCity(massagePackage.getCity());
|
||||||
|
userPackageService.insert(userPackage);
|
||||||
|
Long mainId = userPackage.getId();
|
||||||
|
//拆分插入用户服务器项目详情
|
||||||
|
UserPackageDetail userPackageDetail = new UserPackageDetail();
|
||||||
|
userPackageDetail.setMainId(packageId);
|
||||||
|
List<UserPackageDetail> userPackageDetailList = userPackageDetailService.findMassagePackageDetails(userPackageDetail);
|
||||||
|
if(userPackageDetailList.size()>0){
|
||||||
|
for(int j=0;j<userPackageDetailList.size();j++){
|
||||||
|
UserPackageDetail upd = userPackageDetailList.get(j);
|
||||||
|
upd.setMainId(mainId);
|
||||||
|
upd.setCreateTime(simpleDateFormat.format(new Date()));
|
||||||
|
int serviceCount = upd.getServiceCount();
|
||||||
|
for(int k=0;k<serviceCount;k++){
|
||||||
|
userPackageDetailService.insert(upd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改服务包销量
|
||||||
|
int sales = massagePackage.getSales();
|
||||||
|
sales = sales+quantity;
|
||||||
|
massagePackage.setSales(sales);
|
||||||
|
massagePackageService.updateSales(massagePackage);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.sqx.modules.bl.order.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.sqx.modules.bl.order.dao.UserPackageDao;
|
||||||
|
import com.sqx.modules.bl.order.entity.UserPackage;
|
||||||
|
import com.sqx.modules.bl.order.service.UserPackageService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserPackageServiceImpl extends ServiceImpl<UserPackageDao, UserPackage> implements UserPackageService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insert(UserPackage userPackage){
|
||||||
|
return baseMapper.insert(userPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?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.sqx.modules.bl.order.dao.UserPackageDao">
|
||||||
|
|
||||||
|
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.sqx.modules.bl.order.entity.UserPackageOrder">
|
||||||
|
insert into bl_user_package(
|
||||||
|
user_id,
|
||||||
|
package_id,
|
||||||
|
orders_id,
|
||||||
|
orders_no,
|
||||||
|
create_time,
|
||||||
|
title,
|
||||||
|
type,
|
||||||
|
old_price,
|
||||||
|
price,
|
||||||
|
package_img,
|
||||||
|
content,
|
||||||
|
content_img,
|
||||||
|
labels,
|
||||||
|
city
|
||||||
|
)values(
|
||||||
|
#{userId},
|
||||||
|
#{packageId},
|
||||||
|
#{ordersId},
|
||||||
|
#{ordersNo},
|
||||||
|
#{createTime},
|
||||||
|
#{title},
|
||||||
|
#{type},
|
||||||
|
#{oldPrice},
|
||||||
|
#{price},
|
||||||
|
#{packageImg},
|
||||||
|
#{content},
|
||||||
|
#{contentImg},
|
||||||
|
#{labels},
|
||||||
|
#{city}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -18,4 +18,79 @@
|
||||||
order by a.massage_type_id
|
order by a.massage_type_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findMassagePackageDetails" resultType="com.sqx.modules.bl.order.entity.UserPackageDetail">
|
||||||
|
select
|
||||||
|
a.service_count,
|
||||||
|
a.id as package_detail_id,
|
||||||
|
a.massage_type_id,
|
||||||
|
0 as status,
|
||||||
|
a.package_price,
|
||||||
|
a.interval_days,
|
||||||
|
b.title,
|
||||||
|
b.massage_img,
|
||||||
|
b.content,
|
||||||
|
b.old_price,
|
||||||
|
b.price,
|
||||||
|
b.duration,
|
||||||
|
b.is_sex,
|
||||||
|
b.city,
|
||||||
|
b.content_img,
|
||||||
|
b.labels,
|
||||||
|
b.parent_id,
|
||||||
|
b.classify_id,
|
||||||
|
b.apply_people,
|
||||||
|
b.jianjie
|
||||||
|
from bl_massage_package_detail a inner join massage_type b on a.massage_type_id = b.massage_type_id and b.status = 1
|
||||||
|
where a.main_id = #{mainId}
|
||||||
|
order by a.id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.sqx.modules.bl.order.entity.UserPackageDetail">
|
||||||
|
INSERT INTO bl_user_package_detail(
|
||||||
|
main_id,
|
||||||
|
package_detail_id,
|
||||||
|
massage_type_id,
|
||||||
|
status,
|
||||||
|
package_price,
|
||||||
|
interval_days,
|
||||||
|
create_time,
|
||||||
|
title,
|
||||||
|
massage_img,
|
||||||
|
content,
|
||||||
|
old_price,
|
||||||
|
price,
|
||||||
|
duration,
|
||||||
|
is_sex,
|
||||||
|
city,
|
||||||
|
content_img,
|
||||||
|
labels,
|
||||||
|
parent_id,
|
||||||
|
classify_id,
|
||||||
|
apply_people,
|
||||||
|
jianjie
|
||||||
|
)values(
|
||||||
|
#{mainId},
|
||||||
|
#{packageDetailId},
|
||||||
|
#{massageTypeId},
|
||||||
|
#{status},
|
||||||
|
#{packagePrice},
|
||||||
|
#{intervalDays},
|
||||||
|
#{createTime},
|
||||||
|
#{title},
|
||||||
|
#{massageImg},
|
||||||
|
#{content},
|
||||||
|
#{oldPrice},
|
||||||
|
#{price},
|
||||||
|
#{duration},
|
||||||
|
#{isSex},
|
||||||
|
#{city},
|
||||||
|
#{contentImg},
|
||||||
|
#{labels},
|
||||||
|
#{parentId},
|
||||||
|
#{classifyId},
|
||||||
|
#{applyPeople},
|
||||||
|
#{jianjie}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -5,42 +5,42 @@
|
||||||
|
|
||||||
<select id="findPage" resultType="com.sqx.modules.bl.order.entity.UserPackageOrder">
|
<select id="findPage" resultType="com.sqx.modules.bl.order.entity.UserPackageOrder">
|
||||||
select
|
select
|
||||||
orders_id,
|
a.orders_id,
|
||||||
orders_no,
|
a.orders_no,
|
||||||
user_id,
|
a.user_id,
|
||||||
user_name,
|
b.user_name,
|
||||||
package_id,
|
a.package_id,
|
||||||
package_name,
|
a.package_name,
|
||||||
type,
|
a.type,
|
||||||
vip_rate,
|
a.vip_rate,
|
||||||
price,
|
a.price,
|
||||||
quantity,
|
a.quantity,
|
||||||
old_sum_money,
|
a.old_sum_money,
|
||||||
sum_money,
|
a.sum_money,
|
||||||
pay_money,
|
a.pay_money,
|
||||||
pay_time,
|
a.pay_time,
|
||||||
pay_way,
|
a.pay_way,
|
||||||
status,
|
a.status,
|
||||||
coupon_id,
|
a.coupon_id,
|
||||||
coupon_count,
|
a.coupon_count,
|
||||||
coupon_money,
|
a.coupon_money,
|
||||||
refund_time,
|
a.refund_time,
|
||||||
refund_money
|
a.refund_money
|
||||||
from bl_user_package_order
|
from bl_user_package_order a left join tb_user b on a.user_id = b.user_id
|
||||||
where 1=1
|
where 1=1
|
||||||
<if test="params.status!=null and params.status!=0">
|
<if test="params.status!=null and params.status!=0">
|
||||||
and status=#{params.status}
|
and a.status=#{params.status}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.type!=null and params.type!=''">
|
<if test="params.type!=null and params.type!=''">
|
||||||
and type=#{params.type}
|
and a.type=#{params.type}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.ordersNo!=null and params.ordersNo!=''">
|
<if test="params.ordersNo!=null and params.ordersNo!=''">
|
||||||
and orders_no like concat('%',#{params.ordersNo},'%')
|
and a.orders_no like concat('%',#{params.ordersNo},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.packageName!=null and params.packageName!=''">
|
<if test="params.packageName!=null and params.packageName!=''">
|
||||||
and package_name like concat('%',#{params.packageName},'%')
|
and a.package_name like concat('%',#{params.packageName},'%')
|
||||||
</if>
|
</if>
|
||||||
order by orders_id desc
|
order by a.orders_id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findCoupon" resultType="com.sqx.modules.bl.order.entity.UserPackageOrder">
|
<select id="findCoupon" resultType="com.sqx.modules.bl.order.entity.UserPackageOrder">
|
||||||
|
@ -61,4 +61,121 @@
|
||||||
where orders_id = #{ordersId}
|
where orders_id = #{ordersId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertOrders" useGeneratedKeys="true" keyProperty="ordersId" parameterType="com.sqx.modules.bl.order.entity.UserPackageOrder">
|
||||||
|
INSERT INTO bl_user_package_order
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="null != ordersNo and '' != ordersNo">
|
||||||
|
orders_no,
|
||||||
|
</if>
|
||||||
|
<if test="null != userId ">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
|
<if test="null != packageId ">
|
||||||
|
package_id,
|
||||||
|
</if>
|
||||||
|
<if test="null != packageName and '' != packageName ">
|
||||||
|
package_name,
|
||||||
|
</if>
|
||||||
|
<if test="null != type ">
|
||||||
|
type,
|
||||||
|
</if>
|
||||||
|
<if test="null != vipRate ">
|
||||||
|
vip_rate,
|
||||||
|
</if>
|
||||||
|
<if test="null != price ">
|
||||||
|
price,
|
||||||
|
</if>
|
||||||
|
<if test="null != quantity ">
|
||||||
|
quantity,
|
||||||
|
</if>
|
||||||
|
<if test="null != oldSumMoney ">
|
||||||
|
old_sum_money,
|
||||||
|
</if>
|
||||||
|
<if test="null != sumMoney ">
|
||||||
|
sum_money,
|
||||||
|
</if>
|
||||||
|
<if test="null != payMoney ">
|
||||||
|
pay_money,
|
||||||
|
</if>
|
||||||
|
<if test="null != payTime and '' != payTime">
|
||||||
|
pay_time,
|
||||||
|
</if>
|
||||||
|
<if test="null != payWay ">
|
||||||
|
pay_way,
|
||||||
|
</if>
|
||||||
|
<if test="null != status ">
|
||||||
|
status,
|
||||||
|
</if>
|
||||||
|
<if test="null != couponId ">
|
||||||
|
coupon_id,
|
||||||
|
</if>
|
||||||
|
<if test="null != couponCount ">
|
||||||
|
coupon_count,
|
||||||
|
</if>
|
||||||
|
<if test="null != couponMoney ">
|
||||||
|
coupon_money
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="null != ordersNo and '' != ordersNo">
|
||||||
|
#{ordersNo},
|
||||||
|
</if>
|
||||||
|
<if test="null != userId ">
|
||||||
|
#{userId},
|
||||||
|
</if>
|
||||||
|
<if test="null != packageId ">
|
||||||
|
#{packageId},
|
||||||
|
</if>
|
||||||
|
<if test="null != packageName and '' != packageName ">
|
||||||
|
#{packageName},
|
||||||
|
</if>
|
||||||
|
<if test="null != type ">
|
||||||
|
#{type},
|
||||||
|
</if>
|
||||||
|
<if test="null != vipRate ">
|
||||||
|
#{vipRate},
|
||||||
|
</if>
|
||||||
|
<if test="null != price ">
|
||||||
|
#{price},
|
||||||
|
</if>
|
||||||
|
<if test="null != quantity ">
|
||||||
|
#{quantity},
|
||||||
|
</if>
|
||||||
|
<if test="null != oldSumMoney ">
|
||||||
|
#{oldSumMoney},
|
||||||
|
</if>
|
||||||
|
<if test="null != sumMoney ">
|
||||||
|
#{sumMoney},
|
||||||
|
</if>
|
||||||
|
<if test="null != payMoney ">
|
||||||
|
#{payMoney},
|
||||||
|
</if>
|
||||||
|
<if test="null != payTime and '' != payTime">
|
||||||
|
#{payTime},
|
||||||
|
</if>
|
||||||
|
<if test="null != payWay ">
|
||||||
|
#{payWay},
|
||||||
|
</if>
|
||||||
|
<if test="null != status ">
|
||||||
|
#{status},
|
||||||
|
</if>
|
||||||
|
<if test="null != couponId ">
|
||||||
|
#{couponId},
|
||||||
|
</if>
|
||||||
|
<if test="null != couponCount ">
|
||||||
|
#{couponCount},
|
||||||
|
</if>
|
||||||
|
<if test="null != couponMoney ">
|
||||||
|
#{couponMoney}
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertCoupon" parameterType="com.sqx.modules.bl.order.entity.UserPackageOrder">
|
||||||
|
INSERT INTO bl_user_package_order_coupon(orders_id,coupon_id,coupon_name,money)
|
||||||
|
values(#{ordersId},#{userCouponId},#{couponName},#{couponMoney})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue