Bläddra i källkod

feat:生成会员营期代码

caoliqin 1 månad sedan
förälder
incheckning
9677c8aaf1

+ 112 - 0
fs-service-system/src/main/java/com/fs/course/domain/FsUserCoursePeriod.java

@@ -0,0 +1,112 @@
+package com.fs.course.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 会员营期对象 fs_user_course_period
+ *
+ * @author fs
+ * @date 2025-04-11
+ */
+public class FsUserCoursePeriod extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 营期id */
+    private Long periodId;
+
+    /** 营期名称 */
+    @Excel(name = "营期名称")
+    private String periodName;
+
+    /** 公司id */
+    @Excel(name = "公司id")
+    private Long companyId;
+
+    /** 课程id */
+    @Excel(name = "课程id")
+    private Long courseId;
+
+    /** 视频id */
+    @Excel(name = "视频id")
+    private Long videoId;
+
+    /** 开课时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "开课时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date startingTime;
+
+    public void setPeriodId(Long periodId)
+    {
+        this.periodId = periodId;
+    }
+
+    public Long getPeriodId()
+    {
+        return periodId;
+    }
+    public void setPeriodName(String periodName)
+    {
+        this.periodName = periodName;
+    }
+
+    public String getPeriodName()
+    {
+        return periodName;
+    }
+    public void setCompanyId(Long companyId)
+    {
+        this.companyId = companyId;
+    }
+
+    public Long getCompanyId()
+    {
+        return companyId;
+    }
+    public void setCourseId(Long courseId)
+    {
+        this.courseId = courseId;
+    }
+
+    public Long getCourseId()
+    {
+        return courseId;
+    }
+    public void setVideoId(Long videoId)
+    {
+        this.videoId = videoId;
+    }
+
+    public Long getVideoId()
+    {
+        return videoId;
+    }
+    public void setStartingTime(Date startingTime)
+    {
+        this.startingTime = startingTime;
+    }
+
+    public Date getStartingTime()
+    {
+        return startingTime;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+            .append("periodId", getPeriodId())
+            .append("periodName", getPeriodName())
+            .append("companyId", getCompanyId())
+            .append("courseId", getCourseId())
+            .append("videoId", getVideoId())
+            .append("startingTime", getStartingTime())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 61 - 0
fs-service-system/src/main/java/com/fs/course/mapper/FsUserCoursePeriodMapper.java

@@ -0,0 +1,61 @@
+package com.fs.course.mapper;
+
+import java.util.List;
+import com.fs.course.domain.FsUserCoursePeriod;
+
+/**
+ * 会员营期Mapper接口
+ * 
+ * @author fs
+ * @date 2025-04-11
+ */
+public interface FsUserCoursePeriodMapper 
+{
+    /**
+     * 查询会员营期
+     * 
+     * @param periodId 会员营期ID
+     * @return 会员营期
+     */
+    public FsUserCoursePeriod selectFsUserCoursePeriodById(Long periodId);
+
+    /**
+     * 查询会员营期列表
+     * 
+     * @param fsUserCoursePeriod 会员营期
+     * @return 会员营期集合
+     */
+    public List<FsUserCoursePeriod> selectFsUserCoursePeriodList(FsUserCoursePeriod fsUserCoursePeriod);
+
+    /**
+     * 新增会员营期
+     * 
+     * @param fsUserCoursePeriod 会员营期
+     * @return 结果
+     */
+    public int insertFsUserCoursePeriod(FsUserCoursePeriod fsUserCoursePeriod);
+
+    /**
+     * 修改会员营期
+     * 
+     * @param fsUserCoursePeriod 会员营期
+     * @return 结果
+     */
+    public int updateFsUserCoursePeriod(FsUserCoursePeriod fsUserCoursePeriod);
+
+    /**
+     * 删除会员营期
+     * 
+     * @param periodId 会员营期ID
+     * @return 结果
+     */
+    public int deleteFsUserCoursePeriodById(Long periodId);
+
+    /**
+     * 批量删除会员营期
+     * 
+     * @param periodIds 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteFsUserCoursePeriodByIds(Long[] periodIds);
+}

+ 61 - 0
fs-service-system/src/main/java/com/fs/course/service/IFsUserCoursePeriodService.java

@@ -0,0 +1,61 @@
+package com.fs.course.service;
+
+import java.util.List;
+import com.fs.course.domain.FsUserCoursePeriod;
+
+/**
+ * 会员营期Service接口
+ * 
+ * @author fs
+ * @date 2025-04-11
+ */
+public interface IFsUserCoursePeriodService 
+{
+    /**
+     * 查询会员营期
+     * 
+     * @param periodId 会员营期ID
+     * @return 会员营期
+     */
+    public FsUserCoursePeriod selectFsUserCoursePeriodById(Long periodId);
+
+    /**
+     * 查询会员营期列表
+     * 
+     * @param fsUserCoursePeriod 会员营期
+     * @return 会员营期集合
+     */
+    public List<FsUserCoursePeriod> selectFsUserCoursePeriodList(FsUserCoursePeriod fsUserCoursePeriod);
+
+    /**
+     * 新增会员营期
+     * 
+     * @param fsUserCoursePeriod 会员营期
+     * @return 结果
+     */
+    public int insertFsUserCoursePeriod(FsUserCoursePeriod fsUserCoursePeriod);
+
+    /**
+     * 修改会员营期
+     * 
+     * @param fsUserCoursePeriod 会员营期
+     * @return 结果
+     */
+    public int updateFsUserCoursePeriod(FsUserCoursePeriod fsUserCoursePeriod);
+
+    /**
+     * 批量删除会员营期
+     * 
+     * @param periodIds 需要删除的会员营期ID
+     * @return 结果
+     */
+    public int deleteFsUserCoursePeriodByIds(Long[] periodIds);
+
+    /**
+     * 删除会员营期信息
+     * 
+     * @param periodId 会员营期ID
+     * @return 结果
+     */
+    public int deleteFsUserCoursePeriodById(Long periodId);
+}

+ 96 - 0
fs-service-system/src/main/java/com/fs/course/service/impl/FsUserCoursePeriodServiceImpl.java

@@ -0,0 +1,96 @@
+package com.fs.course.service.impl;
+
+import java.util.List;
+import com.fs.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.fs.course.mapper.FsUserCoursePeriodMapper;
+import com.fs.course.domain.FsUserCoursePeriod;
+import com.fs.course.service.IFsUserCoursePeriodService;
+
+/**
+ * 会员营期Service业务层处理
+ * 
+ * @author fs
+ * @date 2025-04-11
+ */
+@Service
+public class FsUserCoursePeriodServiceImpl implements IFsUserCoursePeriodService 
+{
+    @Autowired
+    private FsUserCoursePeriodMapper fsUserCoursePeriodMapper;
+
+    /**
+     * 查询会员营期
+     * 
+     * @param periodId 会员营期ID
+     * @return 会员营期
+     */
+    @Override
+    public FsUserCoursePeriod selectFsUserCoursePeriodById(Long periodId)
+    {
+        return fsUserCoursePeriodMapper.selectFsUserCoursePeriodById(periodId);
+    }
+
+    /**
+     * 查询会员营期列表
+     * 
+     * @param fsUserCoursePeriod 会员营期
+     * @return 会员营期
+     */
+    @Override
+    public List<FsUserCoursePeriod> selectFsUserCoursePeriodList(FsUserCoursePeriod fsUserCoursePeriod)
+    {
+        return fsUserCoursePeriodMapper.selectFsUserCoursePeriodList(fsUserCoursePeriod);
+    }
+
+    /**
+     * 新增会员营期
+     * 
+     * @param fsUserCoursePeriod 会员营期
+     * @return 结果
+     */
+    @Override
+    public int insertFsUserCoursePeriod(FsUserCoursePeriod fsUserCoursePeriod)
+    {
+        fsUserCoursePeriod.setCreateTime(DateUtils.getNowDate());
+        return fsUserCoursePeriodMapper.insertFsUserCoursePeriod(fsUserCoursePeriod);
+    }
+
+    /**
+     * 修改会员营期
+     * 
+     * @param fsUserCoursePeriod 会员营期
+     * @return 结果
+     */
+    @Override
+    public int updateFsUserCoursePeriod(FsUserCoursePeriod fsUserCoursePeriod)
+    {
+        fsUserCoursePeriod.setUpdateTime(DateUtils.getNowDate());
+        return fsUserCoursePeriodMapper.updateFsUserCoursePeriod(fsUserCoursePeriod);
+    }
+
+    /**
+     * 批量删除会员营期
+     * 
+     * @param periodIds 需要删除的会员营期ID
+     * @return 结果
+     */
+    @Override
+    public int deleteFsUserCoursePeriodByIds(Long[] periodIds)
+    {
+        return fsUserCoursePeriodMapper.deleteFsUserCoursePeriodByIds(periodIds);
+    }
+
+    /**
+     * 删除会员营期信息
+     * 
+     * @param periodId 会员营期ID
+     * @return 结果
+     */
+    @Override
+    public int deleteFsUserCoursePeriodById(Long periodId)
+    {
+        return fsUserCoursePeriodMapper.deleteFsUserCoursePeriodById(periodId);
+    }
+}

+ 87 - 0
fs-service-system/src/main/resources/mapper/course/FsUserCoursePeriodMapper.xml

@@ -0,0 +1,87 @@
+<?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.course.mapper.FsUserCoursePeriodMapper">
+    
+    <resultMap type="FsUserCoursePeriod" id="FsUserCoursePeriodResult">
+        <result property="periodId"    column="period_id"    />
+        <result property="periodName"    column="period_name"    />
+        <result property="companyId"    column="company_id"    />
+        <result property="courseId"    column="course_id"    />
+        <result property="videoId"    column="video_id"    />
+        <result property="startingTime"    column="starting_time"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectFsUserCoursePeriodVo">
+        select period_id, period_name, company_id, course_id, video_id, starting_time, create_time, update_time from fs_user_course_period
+    </sql>
+
+    <select id="selectFsUserCoursePeriodList" parameterType="FsUserCoursePeriod" resultMap="FsUserCoursePeriodResult">
+        <include refid="selectFsUserCoursePeriodVo"/>
+        <where>  
+            <if test="periodName != null  and periodName != ''"> and period_name like concat('%', #{periodName}, '%')</if>
+            <if test="companyId != null "> and company_id = #{companyId}</if>
+            <if test="courseId != null "> and course_id = #{courseId}</if>
+            <if test="videoId != null "> and video_id = #{videoId}</if>
+            <if test="startingTime != null "> and starting_time = #{startingTime}</if>
+        </where>
+    </select>
+    
+    <select id="selectFsUserCoursePeriodById" parameterType="Long" resultMap="FsUserCoursePeriodResult">
+        <include refid="selectFsUserCoursePeriodVo"/>
+        where period_id = #{periodId}
+    </select>
+        
+    <insert id="insertFsUserCoursePeriod" parameterType="FsUserCoursePeriod">
+        insert into fs_user_course_period
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="periodId != null">period_id,</if>
+            <if test="periodName != null">period_name,</if>
+            <if test="companyId != null">company_id,</if>
+            <if test="courseId != null">course_id,</if>
+            <if test="videoId != null">video_id,</if>
+            <if test="startingTime != null">starting_time,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="periodId != null">#{periodId},</if>
+            <if test="periodName != null">#{periodName},</if>
+            <if test="companyId != null">#{companyId},</if>
+            <if test="courseId != null">#{courseId},</if>
+            <if test="videoId != null">#{videoId},</if>
+            <if test="startingTime != null">#{startingTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFsUserCoursePeriod" parameterType="FsUserCoursePeriod">
+        update fs_user_course_period
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="periodName != null">period_name = #{periodName},</if>
+            <if test="companyId != null">company_id = #{companyId},</if>
+            <if test="courseId != null">course_id = #{courseId},</if>
+            <if test="videoId != null">video_id = #{videoId},</if>
+            <if test="startingTime != null">starting_time = #{startingTime},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where period_id = #{periodId}
+    </update>
+
+    <delete id="deleteFsUserCoursePeriodById" parameterType="Long">
+        delete from fs_user_course_period where period_id = #{periodId}
+    </delete>
+
+    <delete id="deleteFsUserCoursePeriodByIds" parameterType="String">
+        delete from fs_user_course_period where period_id in 
+        <foreach item="periodId" collection="array" open="(" separator="," close=")">
+            #{periodId}
+        </foreach>
+    </delete>
+    
+</mapper>

+ 103 - 0
fs-user-app/src/main/java/com/fs/app/controller/FsUserCoursePeriodController.java

@@ -0,0 +1,103 @@
+package com.fs.app.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.course.domain.FsUserCoursePeriod;
+import com.fs.course.service.IFsUserCoursePeriodService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 会员营期Controller
+ *
+ * @author fs
+ * @date 2025-04-11
+ */
+@RestController
+@RequestMapping("/course/userCoursePeriod")
+public class FsUserCoursePeriodController extends BaseController
+{
+    @Autowired
+    private IFsUserCoursePeriodService fsUserCoursePeriodService;
+
+    /**
+     * 查询会员营期列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:userCoursePeriod:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsUserCoursePeriod fsUserCoursePeriod)
+    {
+        startPage();
+        List<FsUserCoursePeriod> list = fsUserCoursePeriodService.selectFsUserCoursePeriodList(fsUserCoursePeriod);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出会员营期列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:userCoursePeriod:export')")
+    @Log(title = "会员营期", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsUserCoursePeriod fsUserCoursePeriod)
+    {
+        List<FsUserCoursePeriod> list = fsUserCoursePeriodService.selectFsUserCoursePeriodList(fsUserCoursePeriod);
+        ExcelUtil<FsUserCoursePeriod> util = new ExcelUtil<FsUserCoursePeriod>(FsUserCoursePeriod.class);
+        return util.exportExcel(list, "userCoursePeriod");
+    }
+
+    /**
+     * 获取会员营期详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('course:userCoursePeriod:query')")
+    @GetMapping(value = "/{periodId}")
+    public AjaxResult getInfo(@PathVariable("periodId") Long periodId)
+    {
+        return AjaxResult.success(fsUserCoursePeriodService.selectFsUserCoursePeriodById(periodId));
+    }
+
+    /**
+     * 新增会员营期
+     */
+    @PreAuthorize("@ss.hasPermi('course:userCoursePeriod:add')")
+    @Log(title = "会员营期", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsUserCoursePeriod fsUserCoursePeriod)
+    {
+        return toAjax(fsUserCoursePeriodService.insertFsUserCoursePeriod(fsUserCoursePeriod));
+    }
+
+    /**
+     * 修改会员营期
+     */
+    @PreAuthorize("@ss.hasPermi('course:userCoursePeriod:edit')")
+    @Log(title = "会员营期", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsUserCoursePeriod fsUserCoursePeriod)
+    {
+        return toAjax(fsUserCoursePeriodService.updateFsUserCoursePeriod(fsUserCoursePeriod));
+    }
+
+    /**
+     * 删除会员营期
+     */
+    @PreAuthorize("@ss.hasPermi('course:userCoursePeriod:remove')")
+    @Log(title = "会员营期", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{periodIds}")
+    public AjaxResult remove(@PathVariable Long[] periodIds)
+    {
+        return toAjax(fsUserCoursePeriodService.deleteFsUserCoursePeriodByIds(periodIds));
+    }
+}