diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateGiveRecordMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateGiveRecordMapper.java new file mode 100644 index 0000000..96709b7 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateGiveRecordMapper.java @@ -0,0 +1,66 @@ +package com.chaozhanggui.system.cashierservice.dao; + +import com.chaozhanggui.system.cashierservice.entity.TbActivateGiveRecord; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 活动商品赠送表(TbActivateGiveRecord)表数据库访问层 + * + * @author ww + * @since 2024-08-20 15:20:43 + */ +public interface TbActivateGiveRecordMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbActivateGiveRecord queryById(Integer id); + + /** + * 查询数据 + * + * @param tbActivateGiveRecord 查询条件 + * @return 对象列表 + */ + List queryAll(TbActivateGiveRecord tbActivateGiveRecord); + + + /** + * 新增数据 + * + * @param tbActivateGiveRecord 实例对象 + * @return 影响行数 + */ + int insert(TbActivateGiveRecord tbActivateGiveRecord); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param tbActivateGiveRecord 实例对象 + * @return 影响行数 + */ + int update(TbActivateGiveRecord tbActivateGiveRecord); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateMapper.java index 2a458b2..34b3888 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateMapper.java @@ -11,19 +11,19 @@ import java.util.List; @Component @Mapper public interface TbActivateMapper { - int deleteByPrimaryKey(Integer id); +// int deleteByPrimaryKey(Integer id); - int insert(TbActivate record); +// int insert(TbActivate record); - int insertSelective(TbActivate record); +// int insertSelective(TbActivate record); TbActivate selectByPrimaryKey(Integer id); - int updateByPrimaryKeySelective(TbActivate record); +// int updateByPrimaryKeySelective(TbActivate record); - int updateByPrimaryKey(TbActivate record); +// int updateByPrimaryKey(TbActivate record); TbActivate selectByAmount(@Param("shopId") String shopId,@Param("amount") BigDecimal amount); - List selectByShpopId(String shopId); + List selectByShopId(String shopId); } \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateProductMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateProductMapper.java new file mode 100644 index 0000000..59077ab --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateProductMapper.java @@ -0,0 +1,67 @@ +package com.chaozhanggui.system.cashierservice.dao; + +import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct; +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + * 活动赠送商品表(TbActivateProduct)表数据库访问层 + * + * @author ww + * @since 2024-08-20 15:14:55 + */ +public interface TbActivateProductMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbActivateProduct queryById(Integer id); + + /** + * 查询数据 + * + * @param tbActivateProduct 查询条件 + * @return 对象列表 + */ + List queryAll(TbActivateProduct tbActivateProduct); + + List queryAllByActivateId(Integer activateId); + + + /** + * 新增数据 + * + * @param tbActivateProduct 实例对象 + * @return 影响行数 + */ + int insert(TbActivateProduct tbActivateProduct); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param tbActivateProduct 实例对象 + * @return 影响行数 + */ + int update(TbActivateProduct tbActivateProduct); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivate.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivate.java index c223bfc..480d9b3 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivate.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivate.java @@ -18,6 +18,9 @@ public class TbActivate implements Serializable { private String isDel; + //是否赠送商品 0否 1是 + private Integer isGiftPro; + private static final long serialVersionUID = 1L; public Integer getId() { @@ -75,4 +78,12 @@ public class TbActivate implements Serializable { public void setIsDel(String isDel) { this.isDel = isDel == null ? null : isDel.trim(); } + + public Integer getIsGiftPro() { + return isGiftPro; + } + + public void setIsGiftPro(Integer isGiftPro) { + this.isGiftPro = isGiftPro; + } } \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateGiveRecord.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateGiveRecord.java new file mode 100644 index 0000000..e643810 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateGiveRecord.java @@ -0,0 +1,126 @@ +package com.chaozhanggui.system.cashierservice.entity; + +import java.util.Date; +import java.io.Serializable; + +/** + * 活动商品赠送表(TbActivateGiveRecord)实体类 + * + * @author ww + * @since 2024-08-20 15:20:43 + */ +public class TbActivateGiveRecord implements Serializable { + private static final long serialVersionUID = -53463432636369401L; + + private Integer id; + /** + * 会员id + */ + private Integer vipUserId; + /** + * 商品id + */ + private Integer proId; + /** + * 赠送数量 + */ + private Integer num; + /** + * 店铺id + */ + private Integer shopId; + private Integer sourceFlowId; + /** + * 来源活动id + */ + private Integer sourceActId; + + private Date createTime; + + private Date updateTime; + + public TbActivateGiveRecord(Integer vipUserId, Integer proId, Integer num, Integer shopId, Integer sourceActId,Integer sourceFlowId) { + this.vipUserId = vipUserId; + this.proId = proId; + this.num = num; + this.shopId = shopId; + this.sourceActId = sourceActId; + this.sourceFlowId = sourceFlowId; + this.createTime=new Date(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getVipUserId() { + return vipUserId; + } + + public void setVipUserId(Integer vipUserId) { + this.vipUserId = vipUserId; + } + + public Integer getProId() { + return proId; + } + + public void setProId(Integer proId) { + this.proId = proId; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Integer getShopId() { + return shopId; + } + + public void setShopId(Integer shopId) { + this.shopId = shopId; + } + + + public Integer getSourceFlowId() { + return sourceFlowId; + } + + public void setSourceFlowId(Integer sourceFlowId) { + this.sourceFlowId = sourceFlowId; + } + + public Integer getSourceActId() { + return sourceActId; + } + + public void setSourceActId(Integer sourceActId) { + this.sourceActId = sourceActId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateProduct.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateProduct.java new file mode 100644 index 0000000..d8383dd --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateProduct.java @@ -0,0 +1,83 @@ +package com.chaozhanggui.system.cashierservice.entity; + +import java.util.Date; +import java.io.Serializable; + +/** + * 活动赠送商品表(TbActivateProduct)实体类 + * + * @author ww + * @since 2024-08-20 15:15:01 + */ +public class TbActivateProduct implements Serializable { + private static final long serialVersionUID = 592370528166603965L; + + private Integer id; +/** + * 活动Id + */ + private Integer activateId; +/** + * 商品id + */ + private Integer productId; +/** + * 数量 + */ + private Integer num; + + private Date createTime; + + private Date updateTime; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getActivateId() { + return activateId; + } + + public void setActivateId(Integer activateId) { + this.activateId = activateId; + } + + public Integer getProductId() { + return productId; + } + + public void setProductId(Integer productId) { + this.productId = productId; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java index cf77531..f765809 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java @@ -71,6 +71,10 @@ public class PayService { @Autowired TbShopPayTypeMapper tbShopPayTypeMapper; + @Autowired + private TbActivateProductMapper actProductMapper; + @Autowired + private TbActivateGiveRecordMapper actGiveRecordMapper; @Autowired private TbShopSongOrderMapper tbShopSongOrderMapper; @@ -982,7 +986,7 @@ public class PayService { public Result getActivate(String shopId, int page, int pageSize) { PageHelper.startPage(page, pageSize); - List list = tbActivateMapper.selectByShpopId(shopId); + List list = tbActivateMapper.selectByShopId(shopId); PageInfo pageInfo = new PageInfo(list); return Result.success(CodeEnum.SUCCESS, pageInfo); } @@ -1079,42 +1083,53 @@ public class PayService { flow.setBalance(tbShopUser.getAmount()); flow.setCreateTime(new Date()); tbShopUserFlowMapper.insert(flow); - TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memberIn.getAmount()); + //会员活动 + giveActivate(tbShopUser,memberIn.getAmount(),flow.getId()); + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("shopId", memberIn.getShopId()); + jsonObject.put("type", "wxMemberIn"); + jsonObject.put("amount", memberIn.getAmount()); + producer.putOrderCollect(jsonObject.toJSONString()); + return "success"; + } + + public void giveActivate(TbShopUser tbShopUser, BigDecimal memAmount,Integer flowId){ + TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memAmount); if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) { + if (activate.getIsGiftPro() != null && activate.getIsGiftPro() == 1) { + List tbActivateProducts = actProductMapper.queryAllByActivateId(activate.getId()); + List actGiveRecords = new ArrayList<>(); + for (TbActivateProduct actPro : tbActivateProducts) { + TbActivateGiveRecord record = new TbActivateGiveRecord(Integer.valueOf(tbShopUser.getId()), actPro.getProductId(), actPro.getNum(), Integer.valueOf(tbShopUser.getShopId()), activate.getId(),flowId); + actGiveRecords.add(record); + } + actGiveRecordMapper.insertBatch(actGiveRecords); + } BigDecimal amount = BigDecimal.ZERO; switch (activate.getHandselType()) { case "GD": amount = activate.getHandselNum(); break; case "RATIO": - amount = memberIn.getAmount().multiply(activate.getHandselNum()); + amount = memAmount.multiply(activate.getHandselNum()); break; } - tbShopUser.setAmount(tbShopUser.getAmount().add(amount)); tbShopUser.setUpdatedAt(System.currentTimeMillis()); tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser); - flow = new TbShopUserFlow(); + TbShopUserFlow flow = new TbShopUserFlow(); flow.setShopUserId(Integer.valueOf(tbShopUser.getId())); flow.setBizCode("scanMemberAwardIn"); - flow.setBizName("会员充值奖励"); + flow.setBizName("充值活动奖励"); flow.setType("+"); flow.setAmount(amount); flow.setBalance(tbShopUser.getAmount()); flow.setCreateTime(new Date()); tbShopUserFlowMapper.insert(flow); - - - JSONObject jsonObject = new JSONObject(); - jsonObject.put("shopId", memberIn.getShopId()); - jsonObject.put("type", "wxMemberIn"); - jsonObject.put("amount", memberIn.getAmount()); - producer.putOrderCollect(jsonObject.toJSONString()); - } - return "success"; } @@ -1161,36 +1176,8 @@ public class PayService { flow.setBalance(tbShopUser.getAmount()); flow.setCreateTime(new Date()); tbShopUserFlowMapper.insert(flow); - - TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memberIn.getAmount()); - if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) { - BigDecimal amount = BigDecimal.ZERO; - switch (activate.getHandselType()) { - case "GD": - amount = activate.getHandselNum(); - break; - case "RATIO": - amount = memberIn.getAmount().multiply(activate.getHandselNum()); - break; - } - - - tbShopUser.setAmount(tbShopUser.getAmount().add(amount)); - tbShopUser.setUpdatedAt(System.currentTimeMillis()); - tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser); - - flow = new TbShopUserFlow(); - flow.setShopUserId(Integer.valueOf(tbShopUser.getId())); - flow.setBizCode("scanMemberAwardIn"); - flow.setType("+"); - flow.setBizName("充值活动奖励"); - flow.setAmount(amount); - flow.setBalance(tbShopUser.getAmount()); - flow.setCreateTime(new Date()); - tbShopUserFlowMapper.insert(flow); - } - - + //会员活动 + giveActivate(tbShopUser,memberIn.getAmount(),flow.getId()); JSONObject jsonObject = new JSONObject(); jsonObject.put("shopId", memberIn.getShopId()); jsonObject.put("type", "wxMemberIn"); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateGiveRecordService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateGiveRecordService.java new file mode 100644 index 0000000..d10894b --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateGiveRecordService.java @@ -0,0 +1,45 @@ +package com.chaozhanggui.system.cashierservice.service; + +import com.chaozhanggui.system.cashierservice.entity.TbActivateGiveRecord; + +/** + * 活动商品赠送表(TbActivateGiveRecord)表服务接口 + * + * @author ww + * @since 2024-08-20 15:20:43 + */ +public interface TbActivateGiveRecordService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbActivateGiveRecord queryById(Integer id); + + /** + * 新增数据 + * + * @param tbActivateGiveRecord 实例对象 + * @return 实例对象 + */ + TbActivateGiveRecord insert(TbActivateGiveRecord tbActivateGiveRecord); + + /** + * 修改数据 + * + * @param tbActivateGiveRecord 实例对象 + * @return 实例对象 + */ + TbActivateGiveRecord update(TbActivateGiveRecord tbActivateGiveRecord); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Integer id); + +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateProductService.java new file mode 100644 index 0000000..675e184 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateProductService.java @@ -0,0 +1,46 @@ +package com.chaozhanggui.system.cashierservice.service; + + +import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct; + +/** + * 活动赠送商品表(TbActivateProduct)表服务接口 + * + * @author ww + * @since 2024-08-20 15:15:01 + */ +public interface TbActivateProductService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbActivateProduct queryById(Integer id); + + /** + * 新增数据 + * + * @param tbActivateProduct 实例对象 + * @return 实例对象 + */ + TbActivateProduct insert(TbActivateProduct tbActivateProduct); + + /** + * 修改数据 + * + * @param tbActivateProduct 实例对象 + * @return 实例对象 + */ + TbActivateProduct update(TbActivateProduct tbActivateProduct); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Integer id); + +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbActivateGiveRecordServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbActivateGiveRecordServiceImpl.java new file mode 100644 index 0000000..1050428 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbActivateGiveRecordServiceImpl.java @@ -0,0 +1,67 @@ +package com.chaozhanggui.system.cashierservice.service.impl; + +import com.chaozhanggui.system.cashierservice.entity.TbActivateGiveRecord; +import com.chaozhanggui.system.cashierservice.dao.TbActivateGiveRecordMapper; +import com.chaozhanggui.system.cashierservice.service.TbActivateGiveRecordService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * 活动商品赠送表(TbActivateGiveRecord)表服务实现类 + * + * @author ww + * @since 2024-08-20 15:20:43 + */ +@Service("tbActivateGiveRecordService") +public class TbActivateGiveRecordServiceImpl implements TbActivateGiveRecordService { + @Resource + private TbActivateGiveRecordMapper tbActivateGiveRecordMapper; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public TbActivateGiveRecord queryById(Integer id) { + return this.tbActivateGiveRecordMapper.queryById(id); + } + + + /** + * 新增数据 + * + * @param tbActivateGiveRecord 实例对象 + * @return 实例对象 + */ + @Override + public TbActivateGiveRecord insert(TbActivateGiveRecord tbActivateGiveRecord) { + this.tbActivateGiveRecordMapper.insert(tbActivateGiveRecord); + return tbActivateGiveRecord; + } + + /** + * 修改数据 + * + * @param tbActivateGiveRecord 实例对象 + * @return 实例对象 + */ + @Override + public TbActivateGiveRecord update(TbActivateGiveRecord tbActivateGiveRecord) { + this.tbActivateGiveRecordMapper.update(tbActivateGiveRecord); + return this.queryById(tbActivateGiveRecord.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer id) { + return this.tbActivateGiveRecordMapper.deleteById(id) > 0; + } +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbActivateProductServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbActivateProductServiceImpl.java new file mode 100644 index 0000000..c06040a --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbActivateProductServiceImpl.java @@ -0,0 +1,67 @@ +package com.chaozhanggui.system.cashierservice.service.impl; + + +import com.chaozhanggui.system.cashierservice.dao.TbActivateProductMapper; +import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct; +import com.chaozhanggui.system.cashierservice.service.TbActivateProductService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * 活动赠送商品表(TbActivateProduct)表服务实现类 + * + * @author ww + * @since 2024-08-20 15:15:02 + */ +@Service("tbActivateProductService") +public class TbActivateProductServiceImpl implements TbActivateProductService { + @Resource + private TbActivateProductMapper tbActivateProductMapper; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public TbActivateProduct queryById(Integer id) { + return this.tbActivateProductMapper.queryById(id); + } + + /** + * 新增数据 + * + * @param tbActivateProduct 实例对象 + * @return 实例对象 + */ + @Override + public TbActivateProduct insert(TbActivateProduct tbActivateProduct) { + this.tbActivateProductMapper.insert(tbActivateProduct); + return tbActivateProduct; + } + + /** + * 修改数据 + * + * @param tbActivateProduct 实例对象 + * @return 实例对象 + */ + @Override + public TbActivateProduct update(TbActivateProduct tbActivateProduct) { + this.tbActivateProductMapper.update(tbActivateProduct); + return this.queryById(tbActivateProduct.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer id) { + return this.tbActivateProductMapper.deleteById(id) > 0; + } +} diff --git a/src/main/resources/mapper/TbActivateGiveRecordMapper.xml b/src/main/resources/mapper/TbActivateGiveRecordMapper.xml new file mode 100644 index 0000000..63320d2 --- /dev/null +++ b/src/main/resources/mapper/TbActivateGiveRecordMapper.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + id + , vip_user_id, pro_id, num, shop_id, source_flow_id,source_act_id, create_time, update_time + + + + + + + + + + + insert into tb_activate_give_record(vip_user_id, pro_id, num, shop_id, source_act_id, source_flow_id, create_time, update_time) + values (#{vipUserId}, #{proId}, #{num}, #{shopId}, #{sourceActId}, #{sourceFlowId}, #{createTime}, #{updateTime}) + + + + insert into tb_activate_give_record(vip_user_id, pro_id, num, shop_id, source_act_id, source_flow_id, create_time, update_time) + values + + (#{entity.vipUserId}, #{entity.proId}, #{entity.num}, #{entity.shopId}, #{entity.sourceActId}, + #{entity.sourceFlowId},#{entity.createTime}, #{entity.updateTime}) + + + + + + update tb_activate_give_record + + + vip_user_id = #{vipUserId}, + + + pro_id = #{proId}, + + + num = #{num}, + + + shop_id = #{shopId}, + + + source_act_id = #{sourceActId}, + + + source_flow_id = #{sourceFlowId}, + + + create_time = #{createTime}, + + + update_time = #{updateTime}, + + + where id = #{id} + + + + + delete + from tb_activate_give_record + where id = #{id} + + + + diff --git a/src/main/resources/mapper/TbActivateMapper.xml b/src/main/resources/mapper/TbActivateMapper.xml index 50d204a..8eb2307 100644 --- a/src/main/resources/mapper/TbActivateMapper.xml +++ b/src/main/resources/mapper/TbActivateMapper.xml @@ -9,9 +9,10 @@ + - id, shop_id, min_num, max_num, handsel_num, handsel_type, is_del + id, shop_id, min_num, max_num, handsel_num, handsel_type, is_del,is_gift_pro - select * from tb_activate where shop_id=#{shopId} and is_del=0 and min_num <= #{amount} and max_num >= #{amount} - + select * + from tb_activate + where shop_id = #{shopId} + and is_del = 0 + and min_num <= #{amount} + and max_num >= #{amount} + order by max_num desc limit 1 + - select * from tb_activate where shop_id=#{shopId} \ No newline at end of file diff --git a/src/main/resources/mapper/TbActivateProductMapper.xml b/src/main/resources/mapper/TbActivateProductMapper.xml new file mode 100644 index 0000000..56eefa7 --- /dev/null +++ b/src/main/resources/mapper/TbActivateProductMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + +id, activate_id, product_id, num, create_time, update_time + + + + + + + + + + + + + insert into tb_activate_product(activate_id, product_id, num, create_time, update_time) + values (#{activateId}, #{productId}, #{num}, #{createTime}, #{updateTime}) + + + + insert into tb_activate_product(activate_id, product_id, num, create_time, update_time) + values + + (#{entity.activateId}, #{entity.productId}, #{entity.num}, #{entity.createTime}, #{entity.updateTime}) + + + + + + update tb_activate_product + + + activate_id = #{activateId}, + + + product_id = #{productId}, + + + num = #{num}, + + + create_time = #{createTime}, + + + update_time = #{updateTime}, + + + where id = #{id} + + + + + delete from tb_activate_product where id = #{id} + + + + diff --git a/src/main/resources/mapper/TbShopUserFlowMapper.xml b/src/main/resources/mapper/TbShopUserFlowMapper.xml index 9d7b16f..013efcf 100644 --- a/src/main/resources/mapper/TbShopUserFlowMapper.xml +++ b/src/main/resources/mapper/TbShopUserFlowMapper.xml @@ -24,7 +24,7 @@ delete from tb_shop_user_flow where id = #{id,jdbcType=INTEGER} - + insert into tb_shop_user_flow (id, shop_user_id, amount, balance, biz_code, biz_name, create_time, type)