分享好友
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopShareService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 店铺分享(TbShopShare)表控制层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-07 14:36:27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("tbShopShare")
|
||||
public class TbShopShareController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private TbShopShareService tbShopShareService;
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param shopId 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("getByShopId")
|
||||
public Result queryById(@RequestParam Integer shopId) {
|
||||
return Result.successWithData(tbShopShareService.queryByShopId(shopId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopShare;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺分享(TbShopShare)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-07 14:36:27
|
||||
*/
|
||||
public interface TbShopShareMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbShopShare queryById(Integer id);
|
||||
TbShopShare queryByShopId(Integer shopId);
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param tbShopShare 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbShopShare> queryAll(TbShopShare tbShopShare, @Param("pageable") Pageable pageable);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbShopShare 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbShopShare tbShopShare);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbShopShare> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbShopShare> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbShopShare 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbShopShare tbShopShare);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺分享(TbShopShare)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-07 14:36:27
|
||||
*/
|
||||
@Data
|
||||
public class TbShopShare implements Serializable {
|
||||
private static final long serialVersionUID = 955264376724636315L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 分享封面图
|
||||
*/
|
||||
private String shareImg;
|
||||
/**
|
||||
* 邀请顶部图
|
||||
*/
|
||||
private String invitedImg;
|
||||
/**
|
||||
* 被邀顶部图
|
||||
*/
|
||||
private String beInvitedImg;
|
||||
/**
|
||||
* 活动开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 新用户获得券
|
||||
*/
|
||||
private String newCoupon;
|
||||
/**
|
||||
* 邀请人数
|
||||
*/
|
||||
private Integer invitedNum;
|
||||
/**
|
||||
* 奖励券
|
||||
*/
|
||||
private String rewardCoupon;
|
||||
/**
|
||||
* 获取方法 get-新用户领取获得 use-新用户使用获得
|
||||
*/
|
||||
private String getMethod;
|
||||
/**
|
||||
* 0 关闭 1 开启
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ShareCoupons> newCoupons;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ShareCoupons> rewardCoupons;
|
||||
|
||||
public void setNewCoupon(String newCoupon) {
|
||||
this.newCoupon = newCoupon;
|
||||
if(StringUtils.isNotBlank(newCoupon)){
|
||||
this.newCoupons = JSONUtil.parseListTNewList(newCoupon,ShareCoupons.class);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRewardCoupon(String rewardCoupon) {
|
||||
this.rewardCoupon = rewardCoupon;
|
||||
if(StringUtils.isNotBlank(rewardCoupon)){
|
||||
this.rewardCoupons = JSONUtil.parseListTNewList(rewardCoupon,ShareCoupons.class);
|
||||
}
|
||||
}
|
||||
|
||||
public void setNewCoupons(List<ShareCoupons> newCoupons) {
|
||||
this.newCoupons = newCoupons;
|
||||
if(CollectionUtil.isNotEmpty(newCoupons)){
|
||||
this.newCoupon = JSONUtil.toJSONString(newCoupons);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRewardCoupons(List<ShareCoupons> rewardCoupons) {
|
||||
this.rewardCoupons = rewardCoupons;
|
||||
if(CollectionUtil.isNotEmpty(rewardCoupons)){
|
||||
this.rewardCoupon = JSONUtil.toJSONString(rewardCoupons);
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ShareCoupons {
|
||||
//优惠券Id
|
||||
private Integer couponId;
|
||||
//优惠券名称
|
||||
private String couponName;
|
||||
//优惠券数量
|
||||
private Integer couponNum;
|
||||
//1 满减 2 商品
|
||||
private Integer type;
|
||||
//满多少金额
|
||||
private Integer fullAmount;
|
||||
//优惠多少金额
|
||||
private Integer discountAmount;
|
||||
//使用描述
|
||||
private String useDetail;
|
||||
//商品描述
|
||||
private List<String> gives;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopShare;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
/**
|
||||
* 店铺分享(TbShopShare)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-07 14:36:27
|
||||
*/
|
||||
public interface TbShopShareService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param shopId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbShopShare queryByShopId(Integer shopId);
|
||||
|
||||
|
||||
}
|
||||
@@ -74,42 +74,42 @@ public class TbShopCouponServiceImpl implements TbShopCouponService {
|
||||
return canUseCoupon;
|
||||
}
|
||||
|
||||
private void setCouponInfo( Map<Integer, JsonObject> coupons, TbUserCouponVo tbUserCouponVo, BigDecimal amount, String week, LocalTime now, DateTimeFormatter formatter) {
|
||||
JsonObject json = new JsonObject();
|
||||
boolean isUse = true;
|
||||
TbShopCoupon tbShopCoupon = couponMapper.queryById(tbUserCouponVo.getCouponId());
|
||||
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||
if (tbShopCoupon.getType().equals(1)) {
|
||||
if (amount.compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) {
|
||||
isUse = false;
|
||||
}
|
||||
private void setCouponInfo(Map<Integer, JsonObject> coupons, TbUserCouponVo tbUserCouponVo, BigDecimal amount, String week, LocalTime now, DateTimeFormatter formatter) {
|
||||
JsonObject json = new JsonObject();
|
||||
boolean isUse = true;
|
||||
TbShopCoupon tbShopCoupon = couponMapper.queryById(tbUserCouponVo.getCouponId());
|
||||
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||
if (tbShopCoupon.getType().equals(1)) {
|
||||
if (amount.compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) {
|
||||
isUse = false;
|
||||
}
|
||||
if (StringUtils.isNotBlank(tbShopCoupon.getUserDays())) {
|
||||
String[] split = tbShopCoupon.getUserDays().split(",");
|
||||
if (split.length != 7) {
|
||||
useRestrictions = new StringBuilder(tbShopCoupon.getUserDays() + " ");
|
||||
}
|
||||
if (!tbShopCoupon.getUserDays().contains(week)) {
|
||||
isUse = false;
|
||||
}
|
||||
}
|
||||
if (tbShopCoupon.getUseTimeType().equals("custom")) {
|
||||
if (now.isBefore(tbShopCoupon.getUseStartTime()) || now.isAfter(tbShopCoupon.getUseEndTime())) {
|
||||
isUse = false;
|
||||
}
|
||||
useRestrictions.append(
|
||||
tbShopCoupon.getUseStartTime().format(formatter)
|
||||
+ "-"
|
||||
+ tbShopCoupon.getUseEndTime().format(formatter));
|
||||
} else {
|
||||
useRestrictions.append("全时段");
|
||||
}
|
||||
useRestrictions.append(" 可用");
|
||||
json.addProperty("isUse", isUse);
|
||||
json.addProperty("useRestrictions", useRestrictions.toString());
|
||||
|
||||
coupons.put(tbUserCouponVo.getCouponId(), json);
|
||||
}
|
||||
if (StringUtils.isNotBlank(tbShopCoupon.getUserDays())) {
|
||||
String[] split = tbShopCoupon.getUserDays().split(",");
|
||||
if (split.length != 7) {
|
||||
useRestrictions = new StringBuilder(tbShopCoupon.getUserDays() + " ");
|
||||
}
|
||||
if (!tbShopCoupon.getUserDays().contains(week)) {
|
||||
isUse = false;
|
||||
}
|
||||
}
|
||||
if (tbShopCoupon.getUseTimeType().equals("custom")) {
|
||||
if (now.isBefore(tbShopCoupon.getUseStartTime()) || now.isAfter(tbShopCoupon.getUseEndTime())) {
|
||||
isUse = false;
|
||||
}
|
||||
useRestrictions.append(
|
||||
tbShopCoupon.getUseStartTime().format(formatter)
|
||||
+ "-"
|
||||
+ tbShopCoupon.getUseEndTime().format(formatter));
|
||||
} else {
|
||||
useRestrictions.append("全时段");
|
||||
}
|
||||
useRestrictions.append(" 可用");
|
||||
json.addProperty("isUse", isUse);
|
||||
json.addProperty("useRestrictions", useRestrictions.toString());
|
||||
|
||||
coupons.put(tbUserCouponVo.getCouponId(), json);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbCouponProductMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopCouponMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopShareMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopCoupon;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopShare;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopShareService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 店铺分享(TbShopShare)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-07 14:36:27
|
||||
*/
|
||||
@Service("tbShopShareService")
|
||||
public class TbShopShareServiceImpl implements TbShopShareService {
|
||||
@Resource
|
||||
private TbShopShareMapper tbShopShareMapper;
|
||||
@Autowired
|
||||
private TbShopCouponMapper couponMapper;
|
||||
@Autowired
|
||||
private TbCouponProductMapper couProductMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbShopShare queryByShopId(Integer id) {
|
||||
TbShopShare tbShopShare = tbShopShareMapper.queryByShopId(id);
|
||||
if (tbShopShare != null) {
|
||||
if(CollectionUtil.isNotEmpty(tbShopShare.getNewCoupons())){
|
||||
for (TbShopShare.ShareCoupons newCoupon : tbShopShare.getNewCoupons()) {
|
||||
TbShopCoupon coupon = couponMapper.queryById(newCoupon.getCouponId());
|
||||
if (coupon != null) {
|
||||
if (coupon.getType() == 1) {
|
||||
//满减
|
||||
newCoupon.setType(1);
|
||||
newCoupon.setFullAmount(coupon.getFullAmount());
|
||||
newCoupon.setDiscountAmount(coupon.getDiscountAmount());
|
||||
newCoupon.setUseDetail(setCouponInfo(coupon));
|
||||
} else if (coupon.getType() == 2) {
|
||||
//商品
|
||||
newCoupon.setType(2);
|
||||
newCoupon.setUseDetail(setCouponInfo(coupon));
|
||||
newCoupon.setGives(couProductMapper.queryProsByActivateId(coupon.getId(), newCoupon.getCouponNum()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(tbShopShare.getRewardCoupons())){
|
||||
for (TbShopShare.ShareCoupons rewardCoupon : tbShopShare.getRewardCoupons()) {
|
||||
TbShopCoupon coupon = couponMapper.queryById(rewardCoupon.getCouponId());
|
||||
if (coupon != null) {
|
||||
if (coupon.getType() == 1) {
|
||||
//满减
|
||||
rewardCoupon.setType(1);
|
||||
rewardCoupon.setFullAmount(coupon.getFullAmount());
|
||||
rewardCoupon.setDiscountAmount(coupon.getDiscountAmount());
|
||||
rewardCoupon.setUseDetail(setCouponInfo(coupon));
|
||||
} else if (coupon.getType() == 2) {
|
||||
//商品
|
||||
rewardCoupon.setType(2);
|
||||
rewardCoupon.setUseDetail(setCouponInfo(coupon));
|
||||
rewardCoupon.setGives(couProductMapper.queryProsByActivateId(coupon.getId(), rewardCoupon.getCouponNum()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return tbShopShare;
|
||||
}
|
||||
|
||||
private String setCouponInfo(TbShopCoupon tbShopCoupon) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||
if (StringUtils.isNotBlank(tbShopCoupon.getUserDays())) {
|
||||
String[] split = tbShopCoupon.getUserDays().split(",");
|
||||
if (split.length != 7) {
|
||||
useRestrictions = new StringBuilder(tbShopCoupon.getUserDays() + " ");
|
||||
}
|
||||
|
||||
}
|
||||
if (tbShopCoupon.getUseTimeType().equals("custom")) {
|
||||
useRestrictions.append(
|
||||
tbShopCoupon.getUseStartTime().format(formatter)
|
||||
+ "-"
|
||||
+ tbShopCoupon.getUseEndTime().format(formatter));
|
||||
} else {
|
||||
useRestrictions.append("全时段");
|
||||
}
|
||||
useRestrictions.append(" 可用");
|
||||
|
||||
return useRestrictions.toString();
|
||||
}
|
||||
|
||||
}
|
||||
164
src/main/resources/mapper/TbShopShareMapper.xml
Normal file
164
src/main/resources/mapper/TbShopShareMapper.xml
Normal file
@@ -0,0 +1,164 @@
|
||||
<?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.chaozhanggui.system.cashierservice.dao.TbShopShareMapper">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbShopShare" id="TbShopShareMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="title" column="title" jdbcType="VARCHAR"/>
|
||||
<result property="shareImg" column="share_img" jdbcType="VARCHAR"/>
|
||||
<result property="invitedImg" column="invited_img" jdbcType="VARCHAR"/>
|
||||
<result property="beInvitedImg" column="be_invited_img" jdbcType="VARCHAR"/>
|
||||
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="newCoupon" column="new_coupon" jdbcType="VARCHAR"/>
|
||||
<result property="invitedNum" column="invited_num" jdbcType="INTEGER"/>
|
||||
<result property="rewardCoupon" column="reward_coupon" jdbcType="VARCHAR"/>
|
||||
<result property="getMethod" column="get_method" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, shop_id, title, share_img, invited_img, be_invited_img, start_time, end_time, new_coupon, invited_num, reward_coupon, get_method, status </sql>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbShopShareMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_shop_share
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryByShopId" resultMap="TbShopShareMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_shop_share
|
||||
where shop_id = #{shopId}
|
||||
and status = 1
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAll" resultMap="TbShopShareMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_shop_share
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
and shop_id = #{shopId}
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
and title = #{title}
|
||||
</if>
|
||||
<if test="shareImg != null and shareImg != ''">
|
||||
and share_img = #{shareImg}
|
||||
</if>
|
||||
<if test="invitedImg != null and invitedImg != ''">
|
||||
and invited_img = #{invitedImg}
|
||||
</if>
|
||||
<if test="beInvitedImg != null and beInvitedImg != ''">
|
||||
and be_invited_img = #{beInvitedImg}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and start_time = #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and end_time = #{endTime}
|
||||
</if>
|
||||
<if test="newCoupon != null and newCoupon != ''">
|
||||
and new_coupon = #{newCoupon}
|
||||
</if>
|
||||
<if test="invitedNum != null">
|
||||
and invited_num = #{invitedNum}
|
||||
</if>
|
||||
<if test="rewardCoupon != null and rewardCoupon != ''">
|
||||
and reward_coupon = #{rewardCoupon}
|
||||
</if>
|
||||
<if test="getMethod != null and getMethod != ''">
|
||||
and get_method = #{getMethod}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_shop_share(shop_id, title, share_img, invited_img, be_invited_img, start_time, end_time,
|
||||
new_coupon, invited_num, reward_coupon, get_method, status)
|
||||
values (#{shopId}, #{title}, #{shareImg}, #{invitedImg}, #{beInvitedImg}, #{startTime}, #{endTime},
|
||||
#{newCoupon}, #{invitedNum}, #{rewardCoupon}, #{getMethod}, #{status})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_shop_share(shop_id, title, share_img, invited_img, be_invited_img, start_time, end_time,
|
||||
new_coupon, invited_num, reward_coupon, get_method, status)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.shopId}, #{entity.title}, #{entity.shareImg}, #{entity.invitedImg}, #{entity.beInvitedImg},
|
||||
#{entity.startTime}, #{entity.endTime}, #{entity.newCoupon}, #{entity.invitedNum}, #{entity.rewardCoupon},
|
||||
#{entity.getMethod}, #{entity.status})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_shop_share
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId},
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
title = #{title},
|
||||
</if>
|
||||
<if test="shareImg != null and shareImg != ''">
|
||||
share_img = #{shareImg},
|
||||
</if>
|
||||
<if test="invitedImg != null and invitedImg != ''">
|
||||
invited_img = #{invitedImg},
|
||||
</if>
|
||||
<if test="beInvitedImg != null and beInvitedImg != ''">
|
||||
be_invited_img = #{beInvitedImg},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time = #{startTime},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time = #{endTime},
|
||||
</if>
|
||||
<if test="newCoupon != null and newCoupon != ''">
|
||||
new_coupon = #{newCoupon},
|
||||
</if>
|
||||
<if test="invitedNum != null">
|
||||
invited_num = #{invitedNum},
|
||||
</if>
|
||||
<if test="rewardCoupon != null and rewardCoupon != ''">
|
||||
reward_coupon = #{rewardCoupon},
|
||||
</if>
|
||||
<if test="getMethod != null and getMethod != ''">
|
||||
get_method = #{getMethod},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from tb_shop_share
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user