Przeglądaj źródła

优惠劵管理

MS-QJVSRANLTYEO\Administrator 4 lat temu
rodzic
commit
e912882661

+ 29 - 0
Yijia-SaaS/yijia-coupon/pom.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>yijia</artifactId>
+        <groupId>com.yijia</groupId>
+        <version>1.0.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>yijia-coupon</artifactId>
+    <description>优惠卷管理模块</description>
+    <dependencies>
+        <!-- 通用工具-->
+        <dependency>
+            <groupId>com.yijia</groupId>
+            <artifactId>yijia-common</artifactId>
+        </dependency>
+        <!--定时任务-->
+        <dependency>
+            <groupId>com.yijia</groupId>
+            <artifactId>yijia-quartz</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.yijia</groupId>
+            <artifactId>yijia-system</artifactId>
+        </dependency>
+    </dependencies>
+</project>

+ 103 - 0
Yijia-SaaS/yijia-coupon/src/main/java/com/yijia/coupon/controller/CouponInfoController.java

@@ -0,0 +1,103 @@
+package com.yijia.coupon.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.yijia.common.annotation.Log;
+import com.yijia.common.core.controller.BaseController;
+import com.yijia.common.core.domain.AjaxResult;
+import com.yijia.common.enums.BusinessType;
+import com.yijia.coupon.domain.CouponInfo;
+import com.yijia.coupon.service.ICouponInfoService;
+import com.yijia.common.utils.poi.ExcelUtil;
+import com.yijia.common.core.page.TableDataInfo;
+
+/**
+ * 优惠劵Controller
+ * 
+ * @author yijia
+ * @date 2021-04-27
+ */
+@RestController
+@RequestMapping("/coupon/info")
+public class CouponInfoController extends BaseController
+{
+    @Autowired
+    private ICouponInfoService couponInfoService;
+
+    /**
+     * 查询优惠劵列表
+     */
+    @PreAuthorize("@ss.hasPermi('coupon:info:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CouponInfo couponInfo)
+    {
+        startPage();
+        List<CouponInfo> list = couponInfoService.selectCouponInfoList(couponInfo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出优惠劵列表
+     */
+    @PreAuthorize("@ss.hasPermi('coupon:info:export')")
+    @Log(title = "优惠劵", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CouponInfo couponInfo)
+    {
+        List<CouponInfo> list = couponInfoService.selectCouponInfoList(couponInfo);
+        ExcelUtil<CouponInfo> util = new ExcelUtil<CouponInfo>(CouponInfo.class);
+        return util.exportExcel(list, "info");
+    }
+
+    /**
+     * 获取优惠劵详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('coupon:info:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Integer id)
+    {
+        return AjaxResult.success(couponInfoService.selectCouponInfoById(id));
+    }
+
+    /**
+     * 新增优惠劵
+     */
+    @PreAuthorize("@ss.hasPermi('coupon:info:add')")
+    @Log(title = "优惠劵", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CouponInfo couponInfo)
+    {
+        return toAjax(couponInfoService.insertCouponInfo(couponInfo));
+    }
+
+    /**
+     * 修改优惠劵
+     */
+    @PreAuthorize("@ss.hasPermi('coupon:info:edit')")
+    @Log(title = "优惠劵", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CouponInfo couponInfo)
+    {
+        return toAjax(couponInfoService.updateCouponInfo(couponInfo));
+    }
+
+    /**
+     * 删除优惠劵
+     */
+    @PreAuthorize("@ss.hasPermi('coupon:info:remove')")
+    @Log(title = "优惠劵", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Integer[] ids)
+    {
+        return toAjax(couponInfoService.deleteCouponInfoByIds(ids));
+    }
+}

+ 270 - 0
Yijia-SaaS/yijia-coupon/src/main/java/com/yijia/coupon/domain/CouponInfo.java

@@ -0,0 +1,270 @@
+package com.yijia.coupon.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.yijia.common.annotation.Excel;
+import com.yijia.common.core.domain.BaseEntity;
+
+/**
+ * 优惠劵对象 coupon_info
+ * 
+ * @author yijia
+ * @date 2021-04-27
+ */
+public class CouponInfo extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Integer id;
+
+    /** 优惠劵ID */
+    @Excel(name = "优惠劵ID")
+    private String couponId;
+
+    /** 优惠劵名称 */
+    @Excel(name = "优惠劵名称")
+    private String couponName;
+
+    /** 优惠劵类型 1现金劵,2折扣券,3兑换券 */
+    @Excel(name = "优惠劵类型 1现金劵,2折扣券,3兑换券")
+    private String couponType;
+
+    /** 优惠劵使用门槛类型。 1.无门槛,2满减劵,3折扣 */
+    @Excel(name = "优惠劵使用门槛类型。 1.无门槛,2满减劵,3折扣")
+    private String useDiscountType;
+
+    /** 油品名称 */
+    @Excel(name = "油品名称")
+    private String oilName;
+
+    /** 1 柴油,2 汽油 */
+    @Excel(name = "1 柴油,2 汽油")
+    private String oilType;
+
+    /** 优惠劵面值,金额 */
+    @Excel(name = "优惠劵面值,金额")
+    private BigDecimal couponAmt;
+
+    /** 优惠劵数量 */
+    @Excel(name = "优惠劵数量")
+    private Long couponNum;
+
+    /** 有效时间类型 1固定时间,2领取后x天内有效 */
+    @Excel(name = "有效时间类型 1固定时间,2领取后x天内有效")
+    private String effectiveTimeType;
+
+    /** 固定时间-有效开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "固定时间-有效开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date effectiveTimeStart;
+
+    /** 固定时间-有效结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "固定时间-有效结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date effectiveTimeEnd;
+
+    /** 有效天数 */
+    @Excel(name = "有效天数")
+    private Integer effectiveDayNum;
+
+    /** 优惠劵领取数量 */
+    @Excel(name = "优惠劵领取数量")
+    private Integer couponReceiveNum;
+
+    /** 发放平台,1.微信 2支付宝 */
+    @Excel(name = "发放平台,1.微信 2支付宝")
+    private String openPlatform;
+
+    /** 发放状态 */
+    @Excel(name = "发放状态")
+    private String grantStatus;
+
+    /** 有效状态,1未生效 */
+    @Excel(name = "有效状态,1未生效")
+    private String status;
+
+    public void setId(Integer id) 
+    {
+        this.id = id;
+    }
+
+    public Integer getId() 
+    {
+        return id;
+    }
+    public void setCouponId(String couponId) 
+    {
+        this.couponId = couponId;
+    }
+
+    public String getCouponId() 
+    {
+        return couponId;
+    }
+    public void setCouponName(String couponName) 
+    {
+        this.couponName = couponName;
+    }
+
+    public String getCouponName() 
+    {
+        return couponName;
+    }
+    public void setCouponType(String couponType) 
+    {
+        this.couponType = couponType;
+    }
+
+    public String getCouponType() 
+    {
+        return couponType;
+    }
+    public void setUseDiscountType(String useDiscountType) 
+    {
+        this.useDiscountType = useDiscountType;
+    }
+
+    public String getUseDiscountType() 
+    {
+        return useDiscountType;
+    }
+    public void setOilName(String oilName) 
+    {
+        this.oilName = oilName;
+    }
+
+    public String getOilName() 
+    {
+        return oilName;
+    }
+    public void setOilType(String oilType) 
+    {
+        this.oilType = oilType;
+    }
+
+    public String getOilType() 
+    {
+        return oilType;
+    }
+    public void setCouponAmt(BigDecimal couponAmt) 
+    {
+        this.couponAmt = couponAmt;
+    }
+
+    public BigDecimal getCouponAmt() 
+    {
+        return couponAmt;
+    }
+    public void setCouponNum(Long couponNum) 
+    {
+        this.couponNum = couponNum;
+    }
+
+    public Long getCouponNum() 
+    {
+        return couponNum;
+    }
+    public void setEffectiveTimeType(String effectiveTimeType) 
+    {
+        this.effectiveTimeType = effectiveTimeType;
+    }
+
+    public String getEffectiveTimeType() 
+    {
+        return effectiveTimeType;
+    }
+    public void setEffectiveTimeStart(Date effectiveTimeStart) 
+    {
+        this.effectiveTimeStart = effectiveTimeStart;
+    }
+
+    public Date getEffectiveTimeStart() 
+    {
+        return effectiveTimeStart;
+    }
+    public void setEffectiveTimeEnd(Date effectiveTimeEnd) 
+    {
+        this.effectiveTimeEnd = effectiveTimeEnd;
+    }
+
+    public Date getEffectiveTimeEnd() 
+    {
+        return effectiveTimeEnd;
+    }
+    public void setEffectiveDayNum(Integer effectiveDayNum) 
+    {
+        this.effectiveDayNum = effectiveDayNum;
+    }
+
+    public Integer getEffectiveDayNum() 
+    {
+        return effectiveDayNum;
+    }
+    public void setCouponReceiveNum(Integer couponReceiveNum) 
+    {
+        this.couponReceiveNum = couponReceiveNum;
+    }
+
+    public Integer getCouponReceiveNum() 
+    {
+        return couponReceiveNum;
+    }
+    public void setOpenPlatform(String openPlatform) 
+    {
+        this.openPlatform = openPlatform;
+    }
+
+    public String getOpenPlatform() 
+    {
+        return openPlatform;
+    }
+    public void setGrantStatus(String grantStatus) 
+    {
+        this.grantStatus = grantStatus;
+    }
+
+    public String getGrantStatus() 
+    {
+        return grantStatus;
+    }
+    public void setStatus(String status) 
+    {
+        this.status = status;
+    }
+
+    public String getStatus() 
+    {
+        return status;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("couponId", getCouponId())
+            .append("couponName", getCouponName())
+            .append("couponType", getCouponType())
+            .append("useDiscountType", getUseDiscountType())
+            .append("oilName", getOilName())
+            .append("oilType", getOilType())
+            .append("couponAmt", getCouponAmt())
+            .append("couponNum", getCouponNum())
+            .append("effectiveTimeType", getEffectiveTimeType())
+            .append("effectiveTimeStart", getEffectiveTimeStart())
+            .append("effectiveTimeEnd", getEffectiveTimeEnd())
+            .append("effectiveDayNum", getEffectiveDayNum())
+            .append("couponReceiveNum", getCouponReceiveNum())
+            .append("openPlatform", getOpenPlatform())
+            .append("grantStatus", getGrantStatus())
+            .append("status", getStatus())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 61 - 0
Yijia-SaaS/yijia-coupon/src/main/java/com/yijia/coupon/mapper/CouponInfoMapper.java

@@ -0,0 +1,61 @@
+package com.yijia.coupon.mapper;
+
+import java.util.List;
+import com.yijia.coupon.domain.CouponInfo;
+
+/**
+ * 优惠劵Mapper接口
+ * 
+ * @author yijia
+ * @date 2021-04-27
+ */
+public interface CouponInfoMapper 
+{
+    /**
+     * 查询优惠劵
+     * 
+     * @param id 优惠劵ID
+     * @return 优惠劵
+     */
+    public CouponInfo selectCouponInfoById(Integer id);
+
+    /**
+     * 查询优惠劵列表
+     * 
+     * @param couponInfo 优惠劵
+     * @return 优惠劵集合
+     */
+    public List<CouponInfo> selectCouponInfoList(CouponInfo couponInfo);
+
+    /**
+     * 新增优惠劵
+     * 
+     * @param couponInfo 优惠劵
+     * @return 结果
+     */
+    public int insertCouponInfo(CouponInfo couponInfo);
+
+    /**
+     * 修改优惠劵
+     * 
+     * @param couponInfo 优惠劵
+     * @return 结果
+     */
+    public int updateCouponInfo(CouponInfo couponInfo);
+
+    /**
+     * 删除优惠劵
+     * 
+     * @param id 优惠劵ID
+     * @return 结果
+     */
+    public int deleteCouponInfoById(Integer id);
+
+    /**
+     * 批量删除优惠劵
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteCouponInfoByIds(Integer[] ids);
+}

+ 61 - 0
Yijia-SaaS/yijia-coupon/src/main/java/com/yijia/coupon/service/ICouponInfoService.java

@@ -0,0 +1,61 @@
+package com.yijia.coupon.service;
+
+import java.util.List;
+import com.yijia.coupon.domain.CouponInfo;
+
+/**
+ * 优惠劵Service接口
+ * 
+ * @author yijia
+ * @date 2021-04-27
+ */
+public interface ICouponInfoService 
+{
+    /**
+     * 查询优惠劵
+     * 
+     * @param id 优惠劵ID
+     * @return 优惠劵
+     */
+    public CouponInfo selectCouponInfoById(Integer id);
+
+    /**
+     * 查询优惠劵列表
+     * 
+     * @param couponInfo 优惠劵
+     * @return 优惠劵集合
+     */
+    public List<CouponInfo> selectCouponInfoList(CouponInfo couponInfo);
+
+    /**
+     * 新增优惠劵
+     * 
+     * @param couponInfo 优惠劵
+     * @return 结果
+     */
+    public int insertCouponInfo(CouponInfo couponInfo);
+
+    /**
+     * 修改优惠劵
+     * 
+     * @param couponInfo 优惠劵
+     * @return 结果
+     */
+    public int updateCouponInfo(CouponInfo couponInfo);
+
+    /**
+     * 批量删除优惠劵
+     * 
+     * @param ids 需要删除的优惠劵ID
+     * @return 结果
+     */
+    public int deleteCouponInfoByIds(Integer[] ids);
+
+    /**
+     * 删除优惠劵信息
+     * 
+     * @param id 优惠劵ID
+     * @return 结果
+     */
+    public int deleteCouponInfoById(Integer id);
+}

+ 96 - 0
Yijia-SaaS/yijia-coupon/src/main/java/com/yijia/coupon/service/impl/CouponInfoServiceImpl.java

@@ -0,0 +1,96 @@
+package com.yijia.coupon.service.impl;
+
+import java.util.List;
+import com.yijia.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.yijia.coupon.mapper.CouponInfoMapper;
+import com.yijia.coupon.domain.CouponInfo;
+import com.yijia.coupon.service.ICouponInfoService;
+
+/**
+ * 优惠劵Service业务层处理
+ * 
+ * @author yijia
+ * @date 2021-04-27
+ */
+@Service
+public class CouponInfoServiceImpl implements ICouponInfoService 
+{
+    @Autowired
+    private CouponInfoMapper couponInfoMapper;
+
+    /**
+     * 查询优惠劵
+     * 
+     * @param id 优惠劵ID
+     * @return 优惠劵
+     */
+    @Override
+    public CouponInfo selectCouponInfoById(Integer id)
+    {
+        return couponInfoMapper.selectCouponInfoById(id);
+    }
+
+    /**
+     * 查询优惠劵列表
+     * 
+     * @param couponInfo 优惠劵
+     * @return 优惠劵
+     */
+    @Override
+    public List<CouponInfo> selectCouponInfoList(CouponInfo couponInfo)
+    {
+        return couponInfoMapper.selectCouponInfoList(couponInfo);
+    }
+
+    /**
+     * 新增优惠劵
+     * 
+     * @param couponInfo 优惠劵
+     * @return 结果
+     */
+    @Override
+    public int insertCouponInfo(CouponInfo couponInfo)
+    {
+        couponInfo.setCreateTime(DateUtils.getNowDate());
+        return couponInfoMapper.insertCouponInfo(couponInfo);
+    }
+
+    /**
+     * 修改优惠劵
+     * 
+     * @param couponInfo 优惠劵
+     * @return 结果
+     */
+    @Override
+    public int updateCouponInfo(CouponInfo couponInfo)
+    {
+        couponInfo.setUpdateTime(DateUtils.getNowDate());
+        return couponInfoMapper.updateCouponInfo(couponInfo);
+    }
+
+    /**
+     * 批量删除优惠劵
+     * 
+     * @param ids 需要删除的优惠劵ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCouponInfoByIds(Integer[] ids)
+    {
+        return couponInfoMapper.deleteCouponInfoByIds(ids);
+    }
+
+    /**
+     * 删除优惠劵信息
+     * 
+     * @param id 优惠劵ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCouponInfoById(Integer id)
+    {
+        return couponInfoMapper.deleteCouponInfoById(id);
+    }
+}

+ 13 - 0
Yijia-SaaS/yijia-coupon/src/main/main.iml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="main6" />
+    <orderEntry type="module" module-name="main5" />
+  </component>
+</module>

+ 148 - 0
Yijia-SaaS/yijia-coupon/src/main/resources/mapper/coupon/CouponInfoMapper.xml

@@ -0,0 +1,148 @@
+<?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.yijia.coupon.mapper.CouponInfoMapper">
+    
+    <resultMap type="CouponInfo" id="CouponInfoResult">
+        <result property="id"    column="id"    />
+        <result property="couponId"    column="coupon_id"    />
+        <result property="couponName"    column="coupon_name"    />
+        <result property="couponType"    column="coupon_type"    />
+        <result property="useDiscountType"    column="use_discount_type"    />
+        <result property="oilName"    column="oil_name"    />
+        <result property="oilType"    column="oil_type"    />
+        <result property="couponAmt"    column="coupon_amt"    />
+        <result property="couponNum"    column="coupon_num"    />
+        <result property="effectiveTimeType"    column="effective_time_type"    />
+        <result property="effectiveTimeStart"    column="effective_time_start"    />
+        <result property="effectiveTimeEnd"    column="effective_time_end"    />
+        <result property="effectiveDayNum"    column="effective_day_num"    />
+        <result property="couponReceiveNum"    column="coupon_receive_num"    />
+        <result property="openPlatform"    column="open_platform"    />
+        <result property="grantStatus"    column="grant_status"    />
+        <result property="status"    column="status"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectCouponInfoVo">
+        select id, coupon_id, coupon_name, coupon_type, use_discount_type, oil_name, oil_type, coupon_amt, coupon_num, effective_time_type, effective_time_start, effective_time_end, effective_day_num, coupon_receive_num, open_platform, grant_status, status, create_by, create_time, update_by, update_time from coupon_info
+    </sql>
+
+    <select id="selectCouponInfoList" parameterType="CouponInfo" resultMap="CouponInfoResult">
+        <include refid="selectCouponInfoVo"/>
+        <where>  
+            <if test="couponId != null  and couponId != ''"> and coupon_id = #{couponId}</if>
+            <if test="couponName != null  and couponName != ''"> and coupon_name like concat('%', #{couponName}, '%')</if>
+            <if test="couponType != null  and couponType != ''"> and coupon_type = #{couponType}</if>
+            <if test="useDiscountType != null  and useDiscountType != ''"> and use_discount_type = #{useDiscountType}</if>
+            <if test="oilName != null  and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
+            <if test="oilType != null  and oilType != ''"> and oil_type = #{oilType}</if>
+            <if test="couponAmt != null "> and coupon_amt = #{couponAmt}</if>
+            <if test="couponNum != null "> and coupon_num = #{couponNum}</if>
+            <if test="effectiveTimeType != null  and effectiveTimeType != ''"> and effective_time_type = #{effectiveTimeType}</if>
+            <if test="effectiveTimeStart != null "> and effective_time_start = #{effectiveTimeStart}</if>
+            <if test="effectiveTimeEnd != null "> and effective_time_end = #{effectiveTimeEnd}</if>
+            <if test="effectiveDayNum != null "> and effective_day_num = #{effectiveDayNum}</if>
+            <if test="couponReceiveNum != null "> and coupon_receive_num = #{couponReceiveNum}</if>
+            <if test="openPlatform != null  and openPlatform != ''"> and open_platform = #{openPlatform}</if>
+            <if test="grantStatus != null  and grantStatus != ''"> and grant_status = #{grantStatus}</if>
+            <if test="status != null  and status != ''"> and status = #{status}</if>
+        </where>
+    </select>
+    
+    <select id="selectCouponInfoById" parameterType="Integer" resultMap="CouponInfoResult">
+        <include refid="selectCouponInfoVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertCouponInfo" parameterType="CouponInfo" useGeneratedKeys="true" keyProperty="id">
+        insert into coupon_info
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="couponId != null">coupon_id,</if>
+            <if test="couponName != null">coupon_name,</if>
+            <if test="couponType != null">coupon_type,</if>
+            <if test="useDiscountType != null">use_discount_type,</if>
+            <if test="oilName != null">oil_name,</if>
+            <if test="oilType != null">oil_type,</if>
+            <if test="couponAmt != null">coupon_amt,</if>
+            <if test="couponNum != null">coupon_num,</if>
+            <if test="effectiveTimeType != null">effective_time_type,</if>
+            <if test="effectiveTimeStart != null">effective_time_start,</if>
+            <if test="effectiveTimeEnd != null">effective_time_end,</if>
+            <if test="effectiveDayNum != null">effective_day_num,</if>
+            <if test="couponReceiveNum != null">coupon_receive_num,</if>
+            <if test="openPlatform != null">open_platform,</if>
+            <if test="grantStatus != null">grant_status,</if>
+            <if test="status != null">status,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="couponId != null">#{couponId},</if>
+            <if test="couponName != null">#{couponName},</if>
+            <if test="couponType != null">#{couponType},</if>
+            <if test="useDiscountType != null">#{useDiscountType},</if>
+            <if test="oilName != null">#{oilName},</if>
+            <if test="oilType != null">#{oilType},</if>
+            <if test="couponAmt != null">#{couponAmt},</if>
+            <if test="couponNum != null">#{couponNum},</if>
+            <if test="effectiveTimeType != null">#{effectiveTimeType},</if>
+            <if test="effectiveTimeStart != null">#{effectiveTimeStart},</if>
+            <if test="effectiveTimeEnd != null">#{effectiveTimeEnd},</if>
+            <if test="effectiveDayNum != null">#{effectiveDayNum},</if>
+            <if test="couponReceiveNum != null">#{couponReceiveNum},</if>
+            <if test="openPlatform != null">#{openPlatform},</if>
+            <if test="grantStatus != null">#{grantStatus},</if>
+            <if test="status != null">#{status},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCouponInfo" parameterType="CouponInfo">
+        update coupon_info
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="couponId != null">coupon_id = #{couponId},</if>
+            <if test="couponName != null">coupon_name = #{couponName},</if>
+            <if test="couponType != null">coupon_type = #{couponType},</if>
+            <if test="useDiscountType != null">use_discount_type = #{useDiscountType},</if>
+            <if test="oilName != null">oil_name = #{oilName},</if>
+            <if test="oilType != null">oil_type = #{oilType},</if>
+            <if test="couponAmt != null">coupon_amt = #{couponAmt},</if>
+            <if test="couponNum != null">coupon_num = #{couponNum},</if>
+            <if test="effectiveTimeType != null">effective_time_type = #{effectiveTimeType},</if>
+            <if test="effectiveTimeStart != null">effective_time_start = #{effectiveTimeStart},</if>
+            <if test="effectiveTimeEnd != null">effective_time_end = #{effectiveTimeEnd},</if>
+            <if test="effectiveDayNum != null">effective_day_num = #{effectiveDayNum},</if>
+            <if test="couponReceiveNum != null">coupon_receive_num = #{couponReceiveNum},</if>
+            <if test="openPlatform != null">open_platform = #{openPlatform},</if>
+            <if test="grantStatus != null">grant_status = #{grantStatus},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCouponInfoById" parameterType="Integer">
+        delete from coupon_info where id = #{id}
+    </delete>
+
+    <delete id="deleteCouponInfoByIds" parameterType="String">
+        delete from coupon_info where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    
+</mapper>