会员 充值活动 奖励 赠送商品
This commit is contained in:
@@ -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<TbActivateGiveRecord> queryAll(TbActivateGiveRecord tbActivateGiveRecord);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateGiveRecord 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbActivateGiveRecord tbActivateGiveRecord);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbActivateGiveRecord> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbActivateGiveRecord> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateGiveRecord 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbActivateGiveRecord tbActivateGiveRecord);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -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<TbActivate> selectByShpopId(String shopId);
|
||||
List<TbActivate> selectByShopId(String shopId);
|
||||
}
|
||||
@@ -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<TbActivateProduct> queryAll(TbActivateProduct tbActivateProduct);
|
||||
|
||||
List<TbActivateProduct> queryAllByActivateId(Integer activateId);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateProduct 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbActivateProduct tbActivateProduct);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbActivateProduct> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbActivateProduct> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateProduct 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbActivateProduct tbActivateProduct);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<TbActivate> list = tbActivateMapper.selectByShpopId(shopId);
|
||||
List<TbActivate> 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<TbActivateProduct> tbActivateProducts = actProductMapper.queryAllByActivateId(activate.getId());
|
||||
List<TbActivateGiveRecord> 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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user