Explorar o código

鸿森堂---1.课程优惠券 2.用户课程优惠券

wjj hai 3 semanas
pai
achega
5b50ac514e

+ 111 - 0
fs-admin/src/main/java/com/fs/his/controller/FsCourseCouponController.java

@@ -0,0 +1,111 @@
+package com.fs.his.controller;
+
+import java.util.List;
+
+import com.fs.common.exception.CustomException;
+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.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.his.domain.FsCourseCoupon;
+import com.fs.his.service.IFsCourseCouponService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 课程优惠券Controller
+ * 
+ * @author fs
+ * @date 2026-05-13
+ */
+@RestController
+@RequestMapping("/his/courserCoupon")
+public class FsCourseCouponController extends BaseController
+{
+    @Autowired
+    private IFsCourseCouponService fsCourseCouponService;
+
+    /**
+     * 查询课程优惠券列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:courserCoupon:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsCourseCoupon fsCourseCoupon)
+    {
+        startPage();
+        List<FsCourseCoupon> list = fsCourseCouponService.selectFsCourseCouponList(fsCourseCoupon);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出课程优惠券列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:courserCoupon:export')")
+    @Log(title = "课程优惠券", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsCourseCoupon fsCourseCoupon)
+    {
+        List<FsCourseCoupon> list = fsCourseCouponService.selectFsCourseCouponList(fsCourseCoupon);
+        ExcelUtil<FsCourseCoupon> util = new ExcelUtil<FsCourseCoupon>(FsCourseCoupon.class);
+        return util.exportExcel(list, "课程优惠券数据");
+    }
+
+    /**
+     * 获取课程优惠券详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('his:courserCoupon:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(fsCourseCouponService.selectFsCourseCouponById(id));
+    }
+
+    /**
+     * 新增课程优惠券
+     */
+    @PreAuthorize("@ss.hasPermi('his:courserCoupon:add')")
+    @Log(title = "课程优惠券", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsCourseCoupon fsCourseCoupon)
+    {
+        return toAjax(fsCourseCouponService.insertFsCourseCoupon(fsCourseCoupon));
+    }
+
+    /**
+     * 修改课程优惠券
+     */
+    @PreAuthorize("@ss.hasPermi('his:courserCoupon:edit')")
+    @Log(title = "课程优惠券", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsCourseCoupon fsCourseCoupon)
+    {
+        FsCourseCoupon c = fsCourseCouponService.selectFsCourseCouponById(fsCourseCoupon.getId());
+        long l = c.getRemainNumber() + fsCourseCoupon.getNumber() - c.getNumber();
+        if (l < 0) {
+            throw new CustomException("剩余卷不足");
+        }
+        fsCourseCoupon.setRemainNumber(l);
+        return toAjax(fsCourseCouponService.updateFsCourseCoupon(fsCourseCoupon));
+    }
+
+    /**
+     * 删除课程优惠券
+     */
+    @PreAuthorize("@ss.hasPermi('his:courserCoupon:remove')")
+    @Log(title = "课程优惠券", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(fsCourseCouponService.deleteFsCourseCouponByIds(ids));
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/his/controller/FsCourseCouponUserController.java

@@ -0,0 +1,103 @@
+package com.fs.his.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.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.his.domain.FsCourseCouponUser;
+import com.fs.his.service.IFsCourseCouponUserService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 用户看课优惠券Controller
+ * 
+ * @author fs
+ * @date 2026-05-13
+ */
+@RestController
+@RequestMapping("/his/courseCouponUser")
+public class FsCourseCouponUserController extends BaseController
+{
+    @Autowired
+    private IFsCourseCouponUserService fsCourseCouponUserService;
+
+    /**
+     * 查询用户看课优惠券列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:courseCouponUser:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsCourseCouponUser fsCourseCouponUser)
+    {
+        startPage();
+        List<FsCourseCouponUser> list = fsCourseCouponUserService.selectFsCourseCouponUserList(fsCourseCouponUser);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出用户看课优惠券列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:courseCouponUser:export')")
+    @Log(title = "用户看课优惠券", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsCourseCouponUser fsCourseCouponUser)
+    {
+        List<FsCourseCouponUser> list = fsCourseCouponUserService.selectFsCourseCouponUserList(fsCourseCouponUser);
+        ExcelUtil<FsCourseCouponUser> util = new ExcelUtil<FsCourseCouponUser>(FsCourseCouponUser.class);
+        return util.exportExcel(list, "用户看课优惠券数据");
+    }
+
+    /**
+     * 获取用户看课优惠券详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('his:courseCouponUser:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(fsCourseCouponUserService.selectFsCourseCouponUserById(id));
+    }
+
+    /**
+     * 新增用户看课优惠券
+     */
+    @PreAuthorize("@ss.hasPermi('his:courseCouponUser:add')")
+    @Log(title = "用户看课优惠券", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsCourseCouponUser fsCourseCouponUser)
+    {
+        return toAjax(fsCourseCouponUserService.insertFsCourseCouponUser(fsCourseCouponUser));
+    }
+
+    /**
+     * 修改用户看课优惠券
+     */
+    @PreAuthorize("@ss.hasPermi('his:courseCouponUser:edit')")
+    @Log(title = "用户看课优惠券", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsCourseCouponUser fsCourseCouponUser)
+    {
+        return toAjax(fsCourseCouponUserService.updateFsCourseCouponUser(fsCourseCouponUser));
+    }
+
+    /**
+     * 删除用户看课优惠券
+     */
+    @PreAuthorize("@ss.hasPermi('his:courseCouponUser:remove')")
+    @Log(title = "用户看课优惠券", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(fsCourseCouponUserService.deleteFsCourseCouponUserByIds(ids));
+    }
+}

+ 58 - 0
fs-service/src/main/java/com/fs/his/domain/FsCourseCoupon.java

@@ -0,0 +1,58 @@
+package com.fs.his.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 课程优惠券对象 fs_course_coupon
+ *
+ * @author fs
+ * @date 2026-05-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsCourseCoupon extends BaseEntity{
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 有效期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date limitTime;
+
+    /** 数量 */
+    @Excel(name = "数量")
+    private Long number;
+
+    /** 剩余数量 */
+    @Excel(name = "剩余数量")
+    private Long remainNumber;
+
+    /** 状态 */
+    @Excel(name = "状态")
+    private Long status;
+
+    /** 领取后有效期 */
+    @Excel(name = "领取后有效期")
+    private Long limitDay;
+
+    /** 有效期类别 1 过期时间 2 领取后有效期 */
+    @Excel(name = "有效期类别 1 过期时间 2 领取后有效期")
+    private Long limitType;
+
+    /** 每人可领取数量 */
+    @Excel(name = "每人可领取数量")
+    private Long limitCount;
+
+    /** 标题 */
+    @Excel(name = "标题")
+    private String title;
+
+
+}

+ 47 - 0
fs-service/src/main/java/com/fs/his/domain/FsCourseCouponUser.java

@@ -0,0 +1,47 @@
+package com.fs.his.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 用户看课优惠券对象 fs_course_coupon_user
+ *
+ * @author fs
+ * @date 2026-05-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsCourseCouponUser extends BaseEntity{
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 优惠券id */
+    @Excel(name = "优惠券id")
+    private Long couponId;
+
+    /** 用户id */
+    @Excel(name = "用户id")
+    private Long userId;
+
+    /** 有效期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date limitTime;
+
+    /** 开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date startTime;
+
+    /** 核销状态 0-未核销 1-已核销 */
+    @Excel(name = "核销状态 0-未核销 1-已核销")
+    private Integer status;
+
+
+}

+ 61 - 0
fs-service/src/main/java/com/fs/his/mapper/FsCourseCouponMapper.java

@@ -0,0 +1,61 @@
+package com.fs.his.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.his.domain.FsCourseCoupon;
+
+/**
+ * 课程优惠券Mapper接口
+ * 
+ * @author fs
+ * @date 2026-05-13
+ */
+public interface FsCourseCouponMapper extends BaseMapper<FsCourseCoupon>{
+    /**
+     * 查询课程优惠券
+     * 
+     * @param id 课程优惠券主键
+     * @return 课程优惠券
+     */
+    FsCourseCoupon selectFsCourseCouponById(Long id);
+
+    /**
+     * 查询课程优惠券列表
+     * 
+     * @param fsCourseCoupon 课程优惠券
+     * @return 课程优惠券集合
+     */
+    List<FsCourseCoupon> selectFsCourseCouponList(FsCourseCoupon fsCourseCoupon);
+
+    /**
+     * 新增课程优惠券
+     * 
+     * @param fsCourseCoupon 课程优惠券
+     * @return 结果
+     */
+    int insertFsCourseCoupon(FsCourseCoupon fsCourseCoupon);
+
+    /**
+     * 修改课程优惠券
+     * 
+     * @param fsCourseCoupon 课程优惠券
+     * @return 结果
+     */
+    int updateFsCourseCoupon(FsCourseCoupon fsCourseCoupon);
+
+    /**
+     * 删除课程优惠券
+     * 
+     * @param id 课程优惠券主键
+     * @return 结果
+     */
+    int deleteFsCourseCouponById(Long id);
+
+    /**
+     * 批量删除课程优惠券
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteFsCourseCouponByIds(Long[] ids);
+}

+ 61 - 0
fs-service/src/main/java/com/fs/his/mapper/FsCourseCouponUserMapper.java

@@ -0,0 +1,61 @@
+package com.fs.his.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.his.domain.FsCourseCouponUser;
+
+/**
+ * 用户看课优惠券Mapper接口
+ * 
+ * @author fs
+ * @date 2026-05-13
+ */
+public interface FsCourseCouponUserMapper extends BaseMapper<FsCourseCouponUser>{
+    /**
+     * 查询用户看课优惠券
+     * 
+     * @param id 用户看课优惠券主键
+     * @return 用户看课优惠券
+     */
+    FsCourseCouponUser selectFsCourseCouponUserById(Long id);
+
+    /**
+     * 查询用户看课优惠券列表
+     * 
+     * @param fsCourseCouponUser 用户看课优惠券
+     * @return 用户看课优惠券集合
+     */
+    List<FsCourseCouponUser> selectFsCourseCouponUserList(FsCourseCouponUser fsCourseCouponUser);
+
+    /**
+     * 新增用户看课优惠券
+     * 
+     * @param fsCourseCouponUser 用户看课优惠券
+     * @return 结果
+     */
+    int insertFsCourseCouponUser(FsCourseCouponUser fsCourseCouponUser);
+
+    /**
+     * 修改用户看课优惠券
+     * 
+     * @param fsCourseCouponUser 用户看课优惠券
+     * @return 结果
+     */
+    int updateFsCourseCouponUser(FsCourseCouponUser fsCourseCouponUser);
+
+    /**
+     * 删除用户看课优惠券
+     * 
+     * @param id 用户看课优惠券主键
+     * @return 结果
+     */
+    int deleteFsCourseCouponUserById(Long id);
+
+    /**
+     * 批量删除用户看课优惠券
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteFsCourseCouponUserByIds(Long[] ids);
+}

+ 61 - 0
fs-service/src/main/java/com/fs/his/service/IFsCourseCouponService.java

@@ -0,0 +1,61 @@
+package com.fs.his.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.his.domain.FsCourseCoupon;
+
+/**
+ * 课程优惠券Service接口
+ * 
+ * @author fs
+ * @date 2026-05-13
+ */
+public interface IFsCourseCouponService extends IService<FsCourseCoupon>{
+    /**
+     * 查询课程优惠券
+     * 
+     * @param id 课程优惠券主键
+     * @return 课程优惠券
+     */
+    FsCourseCoupon selectFsCourseCouponById(Long id);
+
+    /**
+     * 查询课程优惠券列表
+     * 
+     * @param fsCourseCoupon 课程优惠券
+     * @return 课程优惠券集合
+     */
+    List<FsCourseCoupon> selectFsCourseCouponList(FsCourseCoupon fsCourseCoupon);
+
+    /**
+     * 新增课程优惠券
+     * 
+     * @param fsCourseCoupon 课程优惠券
+     * @return 结果
+     */
+    int insertFsCourseCoupon(FsCourseCoupon fsCourseCoupon);
+
+    /**
+     * 修改课程优惠券
+     * 
+     * @param fsCourseCoupon 课程优惠券
+     * @return 结果
+     */
+    int updateFsCourseCoupon(FsCourseCoupon fsCourseCoupon);
+
+    /**
+     * 批量删除课程优惠券
+     * 
+     * @param ids 需要删除的课程优惠券主键集合
+     * @return 结果
+     */
+    int deleteFsCourseCouponByIds(Long[] ids);
+
+    /**
+     * 删除课程优惠券信息
+     * 
+     * @param id 课程优惠券主键
+     * @return 结果
+     */
+    int deleteFsCourseCouponById(Long id);
+}

+ 61 - 0
fs-service/src/main/java/com/fs/his/service/IFsCourseCouponUserService.java

@@ -0,0 +1,61 @@
+package com.fs.his.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.his.domain.FsCourseCouponUser;
+
+/**
+ * 用户看课优惠券Service接口
+ * 
+ * @author fs
+ * @date 2026-05-13
+ */
+public interface IFsCourseCouponUserService extends IService<FsCourseCouponUser>{
+    /**
+     * 查询用户看课优惠券
+     * 
+     * @param id 用户看课优惠券主键
+     * @return 用户看课优惠券
+     */
+    FsCourseCouponUser selectFsCourseCouponUserById(Long id);
+
+    /**
+     * 查询用户看课优惠券列表
+     * 
+     * @param fsCourseCouponUser 用户看课优惠券
+     * @return 用户看课优惠券集合
+     */
+    List<FsCourseCouponUser> selectFsCourseCouponUserList(FsCourseCouponUser fsCourseCouponUser);
+
+    /**
+     * 新增用户看课优惠券
+     * 
+     * @param fsCourseCouponUser 用户看课优惠券
+     * @return 结果
+     */
+    int insertFsCourseCouponUser(FsCourseCouponUser fsCourseCouponUser);
+
+    /**
+     * 修改用户看课优惠券
+     * 
+     * @param fsCourseCouponUser 用户看课优惠券
+     * @return 结果
+     */
+    int updateFsCourseCouponUser(FsCourseCouponUser fsCourseCouponUser);
+
+    /**
+     * 批量删除用户看课优惠券
+     * 
+     * @param ids 需要删除的用户看课优惠券主键集合
+     * @return 结果
+     */
+    int deleteFsCourseCouponUserByIds(Long[] ids);
+
+    /**
+     * 删除用户看课优惠券信息
+     * 
+     * @param id 用户看课优惠券主键
+     * @return 结果
+     */
+    int deleteFsCourseCouponUserById(Long id);
+}

+ 95 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsCourseCouponServiceImpl.java

@@ -0,0 +1,95 @@
+package com.fs.his.service.impl;
+
+import java.util.List;
+import com.fs.common.utils.DateUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.fs.his.mapper.FsCourseCouponMapper;
+import com.fs.his.domain.FsCourseCoupon;
+import com.fs.his.service.IFsCourseCouponService;
+
+/**
+ * 课程优惠券Service业务层处理
+ * 
+ * @author fs
+ * @date 2026-05-13
+ */
+@Service
+public class FsCourseCouponServiceImpl extends ServiceImpl<FsCourseCouponMapper, FsCourseCoupon> implements IFsCourseCouponService {
+
+    /**
+     * 查询课程优惠券
+     * 
+     * @param id 课程优惠券主键
+     * @return 课程优惠券
+     */
+    @Override
+    public FsCourseCoupon selectFsCourseCouponById(Long id)
+    {
+        return baseMapper.selectFsCourseCouponById(id);
+    }
+
+    /**
+     * 查询课程优惠券列表
+     * 
+     * @param fsCourseCoupon 课程优惠券
+     * @return 课程优惠券
+     */
+    @Override
+    public List<FsCourseCoupon> selectFsCourseCouponList(FsCourseCoupon fsCourseCoupon)
+    {
+        return baseMapper.selectFsCourseCouponList(fsCourseCoupon);
+    }
+
+    /**
+     * 新增课程优惠券
+     * 
+     * @param fsCourseCoupon 课程优惠券
+     * @return 结果
+     */
+    @Override
+    public int insertFsCourseCoupon(FsCourseCoupon fsCourseCoupon)
+    {
+        fsCourseCoupon.setCreateTime(DateUtils.getNowDate());
+        fsCourseCoupon.setRemainNumber(fsCourseCoupon.getNumber());
+        return baseMapper.insertFsCourseCoupon(fsCourseCoupon);
+    }
+
+    /**
+     * 修改课程优惠券
+     * 
+     * @param fsCourseCoupon 课程优惠券
+     * @return 结果
+     */
+    @Override
+    public int updateFsCourseCoupon(FsCourseCoupon fsCourseCoupon)
+    {
+        fsCourseCoupon.setUpdateTime(DateUtils.getNowDate());
+        return baseMapper.updateFsCourseCoupon(fsCourseCoupon);
+    }
+
+    /**
+     * 批量删除课程优惠券
+     * 
+     * @param ids 需要删除的课程优惠券主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsCourseCouponByIds(Long[] ids)
+    {
+        return baseMapper.deleteFsCourseCouponByIds(ids);
+    }
+
+    /**
+     * 删除课程优惠券信息
+     * 
+     * @param id 课程优惠券主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsCourseCouponById(Long id)
+    {
+        return baseMapper.deleteFsCourseCouponById(id);
+    }
+}

+ 94 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsCourseCouponUserServiceImpl.java

@@ -0,0 +1,94 @@
+package com.fs.his.service.impl;
+
+import java.util.List;
+import com.fs.common.utils.DateUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.fs.his.mapper.FsCourseCouponUserMapper;
+import com.fs.his.domain.FsCourseCouponUser;
+import com.fs.his.service.IFsCourseCouponUserService;
+
+/**
+ * 用户看课优惠券Service业务层处理
+ * 
+ * @author fs
+ * @date 2026-05-13
+ */
+@Service
+public class FsCourseCouponUserServiceImpl extends ServiceImpl<FsCourseCouponUserMapper, FsCourseCouponUser> implements IFsCourseCouponUserService {
+
+    /**
+     * 查询用户看课优惠券
+     * 
+     * @param id 用户看课优惠券主键
+     * @return 用户看课优惠券
+     */
+    @Override
+    public FsCourseCouponUser selectFsCourseCouponUserById(Long id)
+    {
+        return baseMapper.selectFsCourseCouponUserById(id);
+    }
+
+    /**
+     * 查询用户看课优惠券列表
+     * 
+     * @param fsCourseCouponUser 用户看课优惠券
+     * @return 用户看课优惠券
+     */
+    @Override
+    public List<FsCourseCouponUser> selectFsCourseCouponUserList(FsCourseCouponUser fsCourseCouponUser)
+    {
+        return baseMapper.selectFsCourseCouponUserList(fsCourseCouponUser);
+    }
+
+    /**
+     * 新增用户看课优惠券
+     * 
+     * @param fsCourseCouponUser 用户看课优惠券
+     * @return 结果
+     */
+    @Override
+    public int insertFsCourseCouponUser(FsCourseCouponUser fsCourseCouponUser)
+    {
+        fsCourseCouponUser.setCreateTime(DateUtils.getNowDate());
+        return baseMapper.insertFsCourseCouponUser(fsCourseCouponUser);
+    }
+
+    /**
+     * 修改用户看课优惠券
+     * 
+     * @param fsCourseCouponUser 用户看课优惠券
+     * @return 结果
+     */
+    @Override
+    public int updateFsCourseCouponUser(FsCourseCouponUser fsCourseCouponUser)
+    {
+        fsCourseCouponUser.setUpdateTime(DateUtils.getNowDate());
+        return baseMapper.updateFsCourseCouponUser(fsCourseCouponUser);
+    }
+
+    /**
+     * 批量删除用户看课优惠券
+     * 
+     * @param ids 需要删除的用户看课优惠券主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsCourseCouponUserByIds(Long[] ids)
+    {
+        return baseMapper.deleteFsCourseCouponUserByIds(ids);
+    }
+
+    /**
+     * 删除用户看课优惠券信息
+     * 
+     * @param id 用户看课优惠券主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsCourseCouponUserById(Long id)
+    {
+        return baseMapper.deleteFsCourseCouponUserById(id);
+    }
+}

+ 99 - 0
fs-service/src/main/resources/mapper/his/FsCourseCouponMapper.xml

@@ -0,0 +1,99 @@
+<?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.fs.his.mapper.FsCourseCouponMapper">
+    
+    <resultMap type="FsCourseCoupon" id="FsCourseCouponResult">
+        <result property="id"    column="id"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="limitTime"    column="limit_time"    />
+        <result property="number"    column="number"    />
+        <result property="remainNumber"    column="remain_number"    />
+        <result property="status"    column="status"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="limitDay"    column="limit_day"    />
+        <result property="limitType"    column="limit_type"    />
+        <result property="limitCount"    column="limit_count"    />
+        <result property="title"    column="title"    />
+    </resultMap>
+
+    <sql id="selectFsCourseCouponVo">
+        select id, create_time, limit_time, number, remain_number, status, update_time, limit_day, limit_type, limit_count, title from fs_course_coupon
+    </sql>
+
+    <select id="selectFsCourseCouponList" parameterType="FsCourseCoupon" resultMap="FsCourseCouponResult">
+        <include refid="selectFsCourseCouponVo"/>
+        <where>  
+            <if test="limitTime != null "> and limit_time = #{limitTime}</if>
+            <if test="number != null "> and number = #{number}</if>
+            <if test="remainNumber != null "> and remain_number = #{remainNumber}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="limitDay != null "> and limit_day = #{limitDay}</if>
+            <if test="limitType != null "> and limit_type = #{limitType}</if>
+            <if test="limitCount != null "> and limit_count = #{limitCount}</if>
+            <if test="title != null  and title != ''"> and title = #{title}</if>
+        </where>
+    </select>
+    
+    <select id="selectFsCourseCouponById" parameterType="Long" resultMap="FsCourseCouponResult">
+        <include refid="selectFsCourseCouponVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertFsCourseCoupon" parameterType="FsCourseCoupon" useGeneratedKeys="true" keyProperty="id">
+        insert into fs_course_coupon
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="createTime != null">create_time,</if>
+            <if test="limitTime != null">limit_time,</if>
+            <if test="number != null">number,</if>
+            <if test="remainNumber != null">remain_number,</if>
+            <if test="status != null">status,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="limitDay != null">limit_day,</if>
+            <if test="limitType != null">limit_type,</if>
+            <if test="limitCount != null">limit_count,</if>
+            <if test="title != null">title,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="createTime != null">#{createTime},</if>
+            <if test="limitTime != null">#{limitTime},</if>
+            <if test="number != null">#{number},</if>
+            <if test="remainNumber != null">#{remainNumber},</if>
+            <if test="status != null">#{status},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="limitDay != null">#{limitDay},</if>
+            <if test="limitType != null">#{limitType},</if>
+            <if test="limitCount != null">#{limitCount},</if>
+            <if test="title != null">#{title},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFsCourseCoupon" parameterType="FsCourseCoupon">
+        update fs_course_coupon
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="limitTime != null">limit_time = #{limitTime},</if>
+            <if test="number != null">number = #{number},</if>
+            <if test="remainNumber != null">remain_number = #{remainNumber},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="limitDay != null">limit_day = #{limitDay},</if>
+            <if test="limitType != null">limit_type = #{limitType},</if>
+            <if test="limitCount != null">limit_count = #{limitCount},</if>
+            <if test="title != null">title = #{title},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteFsCourseCouponById" parameterType="Long">
+        delete from fs_course_coupon where id = #{id}
+    </delete>
+
+    <delete id="deleteFsCourseCouponByIds" parameterType="String">
+        delete from fs_course_coupon where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 84 - 0
fs-service/src/main/resources/mapper/his/FsCourseCouponUserMapper.xml

@@ -0,0 +1,84 @@
+<?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.fs.his.mapper.FsCourseCouponUserMapper">
+    
+    <resultMap type="FsCourseCouponUser" id="FsCourseCouponUserResult">
+        <result property="id"    column="id"    />
+        <result property="couponId"    column="coupon_id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="limitTime"    column="limit_time"    />
+        <result property="startTime"    column="start_time"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="status"    column="status"    />
+    </resultMap>
+
+    <sql id="selectFsCourseCouponUserVo">
+        select id, coupon_id, user_id, limit_time, start_time, create_time, update_time, status from fs_course_coupon_user
+    </sql>
+
+    <select id="selectFsCourseCouponUserList" parameterType="FsCourseCouponUser" resultMap="FsCourseCouponUserResult">
+        <include refid="selectFsCourseCouponUserVo"/>
+        <where>  
+            <if test="couponId != null "> and coupon_id = #{couponId}</if>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="limitTime != null "> and limit_time = #{limitTime}</if>
+            <if test="startTime != null "> and start_time = #{startTime}</if>
+            <if test="status != null "> and status = #{status}</if>
+        </where>
+    </select>
+    
+    <select id="selectFsCourseCouponUserById" parameterType="Long" resultMap="FsCourseCouponUserResult">
+        <include refid="selectFsCourseCouponUserVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertFsCourseCouponUser" parameterType="FsCourseCouponUser" useGeneratedKeys="true" keyProperty="id">
+        insert into fs_course_coupon_user
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="couponId != null">coupon_id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="limitTime != null">limit_time,</if>
+            <if test="startTime != null">start_time,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="status != null">status,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="couponId != null">#{couponId},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="limitTime != null">#{limitTime},</if>
+            <if test="startTime != null">#{startTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="status != null">#{status},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFsCourseCouponUser" parameterType="FsCourseCouponUser">
+        update fs_course_coupon_user
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="couponId != null">coupon_id = #{couponId},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="limitTime != null">limit_time = #{limitTime},</if>
+            <if test="startTime != null">start_time = #{startTime},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="status != null">status = #{status},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteFsCourseCouponUserById" parameterType="Long">
+        delete from fs_course_coupon_user where id = #{id}
+    </delete>
+
+    <delete id="deleteFsCourseCouponUserByIds" parameterType="String">
+        delete from fs_course_coupon_user where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>