修改优惠“卷”为优惠“券”,用户信息返回积分总数和可用优惠券数量

This commit is contained in:
谭凯凯
2024-11-13 17:08:49 +08:00
committed by Tankaikai
parent 99e9aae70a
commit 9a7a358f70
23 changed files with 107 additions and 52 deletions

View File

@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
/** /**
* 团购订单 * 团购订单
* *
* @author ww * @author ww
* @since 2024-04-27 16:15:08 * @since 2024-04-27 16:15:08
@@ -42,7 +42,7 @@ public class GroupOrderInfoController {
} }
/** /**
* 通过id查询 * 通过id查询
*/ */
@RequestMapping("getCoupon") @RequestMapping("getCoupon")
public Result queryCouponById(Integer id) { public Result queryCouponById(Integer id) {
@@ -50,7 +50,7 @@ public class GroupOrderInfoController {
} }
/** /**
* 团购 下单 * 团购 下单
* @param token * @param token
* @param param * @param param
* @return * @return

View File

@@ -131,7 +131,7 @@ public class NotifyController {
@RequestMapping("notifyCallBackGroupYsk") @RequestMapping("notifyCallBackGroupYsk")
public String notifyCallBackGroupYsk(HttpServletRequest request) { public String notifyCallBackGroupYsk(HttpServletRequest request) {
Map<String, Object> map = getParameterMap(request); Map<String, Object> map = getParameterMap(request);
log.info("团购回调返回信息:{}", JSONUtil.toJsonStr(map)); log.info("团购回调返回信息:{}", JSONUtil.toJsonStr(map));
if (ObjectUtil.isNotEmpty(map) && map.containsKey("code") && "200".equals(map.get("code") + "")) { if (ObjectUtil.isNotEmpty(map) && map.containsKey("code") && "200".equals(map.get("code") + "")) {
JSONObject object = JSONUtil.parseObj(map.get("data")); JSONObject object = JSONUtil.parseObj(map.get("data"));
if (ObjectUtil.isNotEmpty(object) && object.containsKey("status") && "1".equals(object.getStr("status"))) { if (ObjectUtil.isNotEmpty(object) && object.containsKey("status") && "1".equals(object.getStr("status"))) {
@@ -146,7 +146,7 @@ public class NotifyController {
@RequestMapping("notifyCallBackGroup") @RequestMapping("notifyCallBackGroup")
public String notifyCallBackGroup(HttpServletRequest request) { public String notifyCallBackGroup(HttpServletRequest request) {
Map<String, Object> map = getParameterMap(request); Map<String, Object> map = getParameterMap(request);
log.info("团购回调返回信息:{}", JSONUtil.toJsonStr(map)); log.info("团购回调返回信息:{}", JSONUtil.toJsonStr(map));
if (ObjectUtil.isNotEmpty(map) && map.containsKey("code") && "000000".equals(map.get("code") + "")) { if (ObjectUtil.isNotEmpty(map) && map.containsKey("code") && "000000".equals(map.get("code") + "")) {
JSONObject object = JSONUtil.parseObj(map.get("bizData")); JSONObject object = JSONUtil.parseObj(map.get("bizData"));
if (ObjectUtil.isNotEmpty(object) && object.containsKey("state") && "TRADE_SUCCESS".equals(object.getStr("state"))) { if (ObjectUtil.isNotEmpty(object) && object.containsKey("state") && "TRADE_SUCCESS".equals(object.getStr("state"))) {

View File

@@ -1,8 +1,10 @@
package com.chaozhanggui.system.cashierservice.controller; package com.chaozhanggui.system.cashierservice.controller;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.chaozhanggui.system.cashierservice.dao.TbActivateInRecordMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper; import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper; import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper;
import com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper; import com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper;
@@ -36,6 +38,8 @@ public class UserContoller {
private TbShopInfoMapper shopInfoMapper; private TbShopInfoMapper shopInfoMapper;
@Autowired @Autowired
private TbUserInfoMapper userInfoMapper; private TbUserInfoMapper userInfoMapper;
@Autowired
private TbActivateInRecordMapper activateInRecordMapper;
@PostMapping("/openMember") @PostMapping("/openMember")
public Result openMember(@RequestBody OpenMemberVo memberVo){ public Result openMember(@RequestBody OpenMemberVo memberVo){
@@ -86,6 +90,7 @@ public class UserContoller {
shopUser.setShopId(shopId); shopUser.setShopId(shopId);
shopUser.setUserId(userId); shopUser.setUserId(userId);
shopUser.setMiniOpenId(openId); shopUser.setMiniOpenId(openId);
shopUser.setAccountPoints(0);
shopUser.setCreatedAt(System.currentTimeMillis()); shopUser.setCreatedAt(System.currentTimeMillis());
shopUser.setUpdatedAt(System.currentTimeMillis()); shopUser.setUpdatedAt(System.currentTimeMillis());
shopUserMapper.insert(shopUser); shopUserMapper.insert(shopUser);
@@ -109,6 +114,8 @@ public class UserContoller {
shopUser.setAddress(tbShopInfo.getAddress()); shopUser.setAddress(tbShopInfo.getAddress());
shopUser.setIsUser(tbShopInfo.getIsCustom()); shopUser.setIsUser(tbShopInfo.getIsCustom());
} }
int couponNum = activateInRecordMapper.countCouponNumByShopId(Convert.toInt(shopUser.getUserId()),Convert.toInt(shopUser.getShopId()));
shopUser.setCouponNum(couponNum);
return Result.success(CodeEnum.SUCCESS, shopUser); return Result.success(CodeEnum.SUCCESS, shopUser);
} }

View File

@@ -37,6 +37,7 @@ public interface TbActivateInRecordMapper {
int countCouponNum(@Param("userId") Integer userId); int countCouponNum(@Param("userId") Integer userId);
int countCouponNumByShopId(@Param("userId") Integer userId, @Param("shopId") Integer shopId);
/** /**
* 新增数据 * 新增数据

View File

@@ -2,7 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbCouponCategory; import com.chaozhanggui.system.cashierservice.entity.TbCouponCategory;
/** /**
* 团购分类(TbCouponCategory)表数据库访问层 * 团购分类(TbCouponCategory)表数据库访问层
* *
* @author ww * @author ww
* @since 2024-04-24 14:09:16 * @since 2024-04-24 14:09:16

View File

@@ -7,7 +7,7 @@ import org.springframework.data.domain.Pageable;
import java.util.List; import java.util.List;
/** /**
* 团购卷 卷码表(TbGroupOrderCoupon)表数据库访问层 * 团购券 券码表(TbGroupOrderCoupon)表数据库访问层
* *
* @author ww * @author ww
* @since 2024-05-06 14:39:59 * @since 2024-05-06 14:39:59

View File

@@ -3,13 +3,12 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo; import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto; import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo; import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
* 团购订单(TbGroupOrderInfo)表数据库访问层 * 团购订单(TbGroupOrderInfo)表数据库访问层
* *
* @author ww * @author ww
* @since 2024-04-27 16:15:08 * @since 2024-04-27 16:15:08

View File

@@ -29,15 +29,15 @@ public class TbActivate implements Serializable {
*/ */
private Integer giftPoints; private Integer giftPoints;
/** /**
* 是否使用优惠 0否 1是 * 是否使用优惠 0否 1是
*/ */
private Integer isUseCoupon; private Integer isUseCoupon;
/** /**
* 优惠id * 优惠id
*/ */
private Integer couponId; private Integer couponId;
/** /**
* 优惠数量 * 优惠数量
*/ */
private Integer num; private Integer num;

View File

@@ -1,8 +1,8 @@
package com.chaozhanggui.system.cashierservice.entity; package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.io.Serializable;
/** /**
* 活动商品赠送记录表(TbActivateInRecord)实体类 * 活动商品赠送记录表(TbActivateInRecord)实体类
@@ -19,11 +19,11 @@ public class TbActivateInRecord implements Serializable {
*/ */
private Integer vipUserId; private Integer vipUserId;
/** /**
* Id (校验是否可用) * Id (校验是否可用)
*/ */
private Integer couponId; private Integer couponId;
/** /**
* 描述 满10减2/商品 * 描述 满10减2/商品
*/ */
private String name; private String name;
/** /**

View File

@@ -1,10 +1,10 @@
package com.chaozhanggui.system.cashierservice.entity; package com.chaozhanggui.system.cashierservice.entity;
import java.util.Date;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 团购分类(TbCouponCategory)实体类 * 团购分类(TbCouponCategory)实体类
* *
* @author ww * @author ww
* @since 2024-04-24 14:09:16 * @since 2024-04-24 14:09:16

View File

@@ -4,7 +4,7 @@ import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* 团购卷 卷码表(TbGroupOrderCoupon)实体类 * 团购券 券码表(TbGroupOrderCoupon)实体类
* *
* @author ww * @author ww
* @since 2024-05-06 14:39:59 * @since 2024-05-06 14:39:59
@@ -18,7 +18,7 @@ public class TbGroupOrderCoupon implements Serializable {
*/ */
private Integer orderId; private Integer orderId;
/** /**
* 团购 * 团购
*/ */
private String couponNo; private String couponNo;
/** /**

View File

@@ -2,9 +2,9 @@ package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.io.Serializable;
@Data @Data
public class TbGroupOrderInfo implements Serializable { public class TbGroupOrderInfo implements Serializable {
@@ -39,7 +39,7 @@ public class TbGroupOrderInfo implements Serializable {
*/ */
private String proName; private String proName;
/** /**
* 团购到期日期 * 团购到期日期
*/ */
private Date expDate; private Date expDate;
/** /**
@@ -98,7 +98,7 @@ public class TbGroupOrderInfo implements Serializable {
*/ */
private Date createTime; private Date createTime;
/** /**
* 码核销员 * 码核销员
*/ */
private String verifier; private String verifier;
/** /**

View File

@@ -15,7 +15,7 @@ public class TbPurchaseNotice implements Serializable {
*/ */
private Integer id; private Integer id;
/** /**
* 商户Id * 商户Id
*/ */
private Integer couponId; private Integer couponId;
/** /**

View File

@@ -7,6 +7,7 @@ import org.springframework.data.annotation.Transient;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date;
@Data @Data
public class TbShopUser implements Serializable { public class TbShopUser implements Serializable {
@@ -83,6 +84,13 @@ public class TbShopUser implements Serializable {
private String isUser; private String isUser;
private Timestamp joinTime; private Timestamp joinTime;
private Integer accountPoints;
private Date lastPointsChangeTime;
private Integer lastFloatPoints;
@Transient
@TableField(exist = false)
private Integer couponNum;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -102,7 +102,7 @@ public class TbUserInfo implements Serializable {
private String pwd; private String pwd;
private String custPhone = "400-6666-389"; private String custPhone = "400-6666-389";
//优惠数量 //优惠数量
private Integer couponAll = 0; private Integer couponAll = 0;
//储值数量 //储值数量
private BigDecimal balanceAll = BigDecimal.ZERO; private BigDecimal balanceAll = BigDecimal.ZERO;

View File

@@ -19,7 +19,7 @@ public class GroupOrderDetailsVo {
*/ */
private String proName; private String proName;
/** /**
* 商品图片 * 商品图片
*/ */
private String proImg; private String proImg;
/** /**

View File

@@ -4,7 +4,7 @@ import lombok.Data;
/** /**
* @author ww * @author ww
* 店铺团购vo * 店铺团购vo
*/ */
@Data @Data
public class ShopGroupInfoVo { public class ShopGroupInfoVo {

View File

@@ -1,14 +1,14 @@
package com.chaozhanggui.system.cashierservice.service; package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon;
import com.chaozhanggui.system.cashierservice.dao.TbGroupOrderCouponMapper; import com.chaozhanggui.system.cashierservice.dao.TbGroupOrderCouponMapper;
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
* 团购卷 卷码表(TbGroupOrderCoupon)表服务实现类 * 团购券 券码表(TbGroupOrderCoupon)表服务实现类
* *
* @author ww * @author ww
* @since 2024-05-06 14:39:59 * @since 2024-05-06 14:39:59

View File

@@ -731,7 +731,7 @@ public class PayService {
flow.setShopUserId(Integer.valueOf(user.getId())); flow.setShopUserId(Integer.valueOf(user.getId()));
flow.setBizCode("accountGroupPay"); flow.setBizCode("accountGroupPay");
flow.setType("-"); flow.setType("-");
flow.setBizName("会员储值卡支付团购"); flow.setBizName("会员储值卡支付团购");
flow.setAmount(orderInfo.getOrderAmount()); flow.setAmount(orderInfo.getOrderAmount());
flow.setBalance(user.getAmount()); flow.setBalance(user.getAmount());
flow.setCreateTime(new Date()); flow.setCreateTime(new Date());
@@ -827,14 +827,14 @@ public class PayService {
} else if (payType.equals("aliPay")) { } else if (payType.equals("aliPay")) {
req.setPayWay("ZFBZF"); req.setPayWay("ZFBZF");
} }
req.setSubject("零点八零:团购"); req.setSubject("零点八零:团购");
req.setUserId(userId); req.setUserId(userId);
Map<String, Object> map = BeanUtil.transBeanMap(req); Map<String, Object> map = BeanUtil.transBeanMap(req);
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true)); req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("trans/pay"), req, String.class); ResponseEntity<String> response = restTemplate.postForEntity(url.concat("trans/pay"), req, String.class);
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) { if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
JSONObject object = JSONObject.parseObject(response.getBody()); JSONObject object = JSONObject.parseObject(response.getBody());
log.info("团购支付响应:{}", object); log.info("团购支付响应:{}", object);
if (object.get("code").equals("0")) { if (object.get("code").equals("0")) {
payment.setTradeNumber(object.getJSONObject("data").get("orderNumber").toString()); payment.setTradeNumber(object.getJSONObject("data").get("orderNumber").toString());
payment.setUpdatedAt(System.currentTimeMillis()); payment.setUpdatedAt(System.currentTimeMillis());
@@ -1548,13 +1548,13 @@ public class PayService {
record.setCouponJson(activateInRecordService.getCouponJson(activate, tbShopCoupon, null)); record.setCouponJson(activateInRecordService.getCouponJson(activate, tbShopCoupon, null));
actGiveRecords.add(record); actGiveRecords.add(record);
} else if (tbShopCoupon.getType() == 2) { } else if (tbShopCoupon.getType() == 2) {
//商品 //商品
List<TbCouponProduct> tbCouponProducts = couProductMapper.queryAllByCouponId(tbShopCoupon.getId()); List<TbCouponProduct> tbCouponProducts = couProductMapper.queryAllByCouponId(tbShopCoupon.getId());
for (TbCouponProduct actPro : tbCouponProducts) { for (TbCouponProduct actPro : tbCouponProducts) {
TbActivateInRecord record = new TbActivateInRecord(); TbActivateInRecord record = new TbActivateInRecord();
record.setVipUserId(Integer.valueOf(tbShopUser.getId())); record.setVipUserId(Integer.valueOf(tbShopUser.getId()));
record.setCouponId(tbShopCoupon.getId()); record.setCouponId(tbShopCoupon.getId());
record.setName("商品"); record.setName("商品");
record.setType(2); record.setType(2);
record.setProId(actPro.getProductId()); record.setProId(actPro.getProductId());
record.setNum(actPro.getNum() * tbShopCoupon.getNumber()); record.setNum(actPro.getNum() * tbShopCoupon.getNumber());

View File

@@ -12,10 +12,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chaozhanggui.system.cashierservice.constant.TableConstant; import com.chaozhanggui.system.cashierservice.constant.TableConstant;
import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.Enum.OrderUseTypeEnum; import com.chaozhanggui.system.cashierservice.entity.Enum.OrderUseTypeEnum;
import com.chaozhanggui.system.cashierservice.entity.Enum.PlatformTypeEnum; import com.chaozhanggui.system.cashierservice.entity.Enum.PlatformTypeEnum;
import com.chaozhanggui.system.cashierservice.entity.Enum.ShopInfoEatModelEnum; import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.dto.*; import com.chaozhanggui.system.cashierservice.entity.dto.*;
import com.chaozhanggui.system.cashierservice.entity.vo.*; import com.chaozhanggui.system.cashierservice.entity.vo.*;
import com.chaozhanggui.system.cashierservice.exception.MsgException; import com.chaozhanggui.system.cashierservice.exception.MsgException;
@@ -31,7 +30,6 @@ import com.chaozhanggui.system.cashierservice.util.*;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.google.common.util.concurrent.AtomicDouble; import com.google.common.util.concurrent.AtomicDouble;
import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -720,9 +718,9 @@ public class ProductService {
/** /**
* 团购详情 * 团购详情
* *
* @param productId 团购Id * @param productId 团购Id
* @return * @return
* @throws Exception * @throws Exception
*/ */

View File

@@ -2,12 +2,10 @@ package com.chaozhanggui.system.cashierservice.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*; import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.service.TbShopShareRecordService; import com.chaozhanggui.system.cashierservice.service.TbShopShareRecordService;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result; import com.chaozhanggui.system.cashierservice.sign.Result;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@@ -15,11 +13,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
@@ -268,13 +262,13 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService {
record.setSource("invited"); record.setSource("invited");
actGiveRecords.add(record); actGiveRecords.add(record);
} else if (tbShopCoupon.getType() == 2) { } else if (tbShopCoupon.getType() == 2) {
//商品 //商品
List<TbCouponProduct> tbCouponProducts = couProductMapper.queryAllByCouponId(tbShopCoupon.getId()); List<TbCouponProduct> tbCouponProducts = couProductMapper.queryAllByCouponId(tbShopCoupon.getId());
for (TbCouponProduct actPro : tbCouponProducts) { for (TbCouponProduct actPro : tbCouponProducts) {
TbActivateInRecord record = new TbActivateInRecord(); TbActivateInRecord record = new TbActivateInRecord();
record.setVipUserId(Integer.valueOf(tbShopUser.getId())); record.setVipUserId(Integer.valueOf(tbShopUser.getId()));
record.setCouponId(tbShopCoupon.getId()); record.setCouponId(tbShopCoupon.getId());
record.setName("商品"); record.setName("商品");
record.setType(2); record.setType(2);
record.setProId(actPro.getProductId()); record.setProId(actPro.getProductId());
record.setNum(actPro.getNum() * tbShopCoupon.getNumber()); record.setNum(actPro.getNum() * tbShopCoupon.getNumber());

View File

@@ -101,7 +101,7 @@ id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, nu
order by inRecord.use_end_time asc order by inRecord.use_end_time asc
</select> </select>
<!--查询剩余商品优惠数量--> <!--查询剩余商品优惠数量-->
<select id="countCouponNum" resultType="INTEGER"> <select id="countCouponNum" resultType="INTEGER">
SELECT SELECT
ifnull(sum(over_num), 0) ifnull(sum(over_num), 0)
@@ -110,6 +110,15 @@ id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, nu
INNER JOIN tb_shop_user vip ON record.vip_user_id = vip.id AND vip.user_id = #{userId} INNER JOIN tb_shop_user vip ON record.vip_user_id = vip.id AND vip.user_id = #{userId}
</select> </select>
<!--查询剩余商品优惠券数量-->
<select id="countCouponNumByShopId" resultType="INTEGER">
SELECT
ifnull(sum(over_num), 0)
FROM
tb_activate_in_record record
INNER JOIN tb_shop_user vip ON record.vip_user_id = vip.id AND vip.user_id = #{userId} AND vip.shop_id = #{shopId}
</select>
<!--查询指定行数据--> <!--查询指定行数据-->
<select id="queryAll" resultMap="TbActivateInRecordMap"> <select id="queryAll" resultMap="TbActivateInRecordMap">
select select

View File

@@ -32,12 +32,15 @@
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" /> <result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
<result column="mini_open_id" jdbcType="VARCHAR" property="miniOpenId" /> <result column="mini_open_id" jdbcType="VARCHAR" property="miniOpenId" />
<result column="join_time" jdbcType="VARCHAR" property="joinTime" /> <result column="join_time" jdbcType="VARCHAR" property="joinTime" />
<result column="account_points" jdbcType="INTEGER" property="accountPoints" />
<result column="last_points_change_time" jdbcType="DATE" property="lastPointsChangeTime" />
<result column="last_float_points" jdbcType="INTEGER" property="lastFloatPoints" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, amount, credit_amount, consume_amount, consume_number, level_consume, status, id, amount, credit_amount, consume_amount, consume_number, level_consume, status,
merchant_id, shop_id, user_id, parent_id, parent_level, name, head_img, sex, birth_day, merchant_id, shop_id, user_id, parent_id, parent_level, name, head_img, sex, birth_day,
telephone, is_vip, code, is_attention, attention_at, is_shareholder, level, distribute_type, telephone, is_vip, code, is_attention, attention_at, is_shareholder, level, distribute_type,
sort, created_at, updated_at, mini_open_id,dynamic_code,join_time sort, created_at, updated_at, mini_open_id,dynamic_code,join_time,account_points,last_points_change_time,last_float_points
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select select
@@ -75,7 +78,9 @@
code, is_attention, attention_at, code, is_attention, attention_at,
is_shareholder, level, distribute_type, is_shareholder, level, distribute_type,
sort, created_at, updated_at, sort, created_at, updated_at,
mini_open_id,join_time) mini_open_id,join_time,
account_points,last_points_change_time,last_float_points
)
values (#{id,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, #{creditAmount,jdbcType=DECIMAL}, values (#{id,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, #{creditAmount,jdbcType=DECIMAL},
#{consumeAmount,jdbcType=DECIMAL}, #{consumeNumber,jdbcType=INTEGER}, #{levelConsume,jdbcType=DECIMAL}, #{consumeAmount,jdbcType=DECIMAL}, #{consumeNumber,jdbcType=INTEGER}, #{levelConsume,jdbcType=DECIMAL},
#{status,jdbcType=TINYINT}, #{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR},
@@ -85,7 +90,11 @@
#{code,jdbcType=VARCHAR}, #{isAttention,jdbcType=TINYINT}, #{attentionAt,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{isAttention,jdbcType=TINYINT}, #{attentionAt,jdbcType=INTEGER},
#{isShareholder,jdbcType=TINYINT}, #{level,jdbcType=TINYINT}, #{distributeType,jdbcType=VARCHAR}, #{isShareholder,jdbcType=TINYINT}, #{level,jdbcType=TINYINT}, #{distributeType,jdbcType=VARCHAR},
#{sort,jdbcType=INTEGER}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{sort,jdbcType=INTEGER}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
#{miniOpenId,jdbcType=VARCHAR},#{joinTime,jdbcType=TIMESTAMP}) #{miniOpenId,jdbcType=VARCHAR},#{joinTime,jdbcType=TIMESTAMP},
#{accountPoints,jdbcType=INTEGER},
#{lastPointsChangeTime,jdbcType=TIMESTAMP},
#{lastFloatPoints,jdbcType=INTEGER}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUser"> <insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUser">
insert into tb_shop_user insert into tb_shop_user
@@ -177,6 +186,15 @@
<if test="joinTime != null"> <if test="joinTime != null">
join_time, join_time,
</if> </if>
<if test="accountPoints != null">
account_points,
</if>
<if test="lastPointsChangeTime != null">
last_points_change_time,
</if>
<if test="lastFloatPoints != null">
last_float_points,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@@ -266,6 +284,15 @@
<if test="joinTime != null"> <if test="joinTime != null">
#{joinTime,jdbcType=TIMESTAMP}, #{joinTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="accountPoints != null">
#{accountPoints,jdbcType=INTEGER},
</if>
<if test="lastPointsChangeTime != null">
#{lastPointsChangeTime,jdbcType=TIMESTAMP},
</if>
<if test="lastFloatPoints != null">
#{lastFloatPoints,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUser"> <update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUser">
@@ -364,6 +391,15 @@
<if test="joinTime != null"> <if test="joinTime != null">
join_time = #{joinTime,jdbcType=TIMESTAMP}, join_time = #{joinTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="accountPoints != null">
account_points = #{accountPoints,jdbcType=INTEGER},
</if>
<if test="lastPointsChangeTime != null">
last_points_change_time = #{lastPointsChangeTime,jdbcType=TIMESTAMP},
</if>
<if test="lastFloatPoints != null">
last_float_points = #{lastFloatPoints,jdbcType=INTEGER},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@@ -395,8 +431,11 @@
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=BIGINT}, created_at = #{createdAt,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=BIGINT}, updated_at = #{updatedAt,jdbcType=BIGINT},
join_time = #{joinTime,jdbcType=TIMESTAMP}, join_time = #{joinTime,jdbcType=TIMESTAMP},
mini_open_id = #{miniOpenId,jdbcType=VARCHAR} mini_open_id = #{miniOpenId,jdbcType=VARCHAR},
account_points = #{accountPoints,jdbcType=INTEGER},
last_points_change_time = #{lastPointsChangeTime,jdbcType=TIMESTAMP},
last_float_points = #{lastFloatPoints,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>