瀏覽代碼

feat:生成关键字代码

caoliqin 2 月之前
父節點
當前提交
34ce843248

+ 103 - 0
fs-admin/src/main/java/com/fs/sys/controller/SysKeywordController.java

@@ -0,0 +1,103 @@
+package com.fs.sys.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.system.domain.SysKeyword;
+import com.fs.system.service.ISysKeywordService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 系统关键字Controller
+ *
+ * @author fs
+ * @date 2025-05-14
+ */
+@RestController
+@RequestMapping("/system/keyword")
+public class SysKeywordController extends BaseController
+{
+    @Autowired
+    private ISysKeywordService sysKeywordService;
+
+    /**
+     * 查询系统关键字列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:keyword:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(SysKeyword sysKeyword)
+    {
+        startPage();
+        List<SysKeyword> list = sysKeywordService.selectSysKeywordList(sysKeyword);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出系统关键字列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:keyword:export')")
+    @Log(title = "系统关键字", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(SysKeyword sysKeyword)
+    {
+        List<SysKeyword> list = sysKeywordService.selectSysKeywordList(sysKeyword);
+        ExcelUtil<SysKeyword> util = new ExcelUtil<SysKeyword>(SysKeyword.class);
+        return util.exportExcel(list, "系统关键字数据");
+    }
+
+    /**
+     * 获取系统关键字详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:keyword:query')")
+    @GetMapping(value = "/{keywordId}")
+    public AjaxResult getInfo(@PathVariable("keywordId") Long keywordId)
+    {
+        return AjaxResult.success(sysKeywordService.selectSysKeywordById(keywordId));
+    }
+
+    /**
+     * 新增系统关键字
+     */
+    @PreAuthorize("@ss.hasPermi('system:keyword:add')")
+    @Log(title = "系统关键字", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysKeyword sysKeyword)
+    {
+        return toAjax(sysKeywordService.insertSysKeyword(sysKeyword));
+    }
+
+    /**
+     * 修改系统关键字
+     */
+    @PreAuthorize("@ss.hasPermi('system:keyword:edit')")
+    @Log(title = "系统关键字", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysKeyword sysKeyword)
+    {
+        return toAjax(sysKeywordService.updateSysKeyword(sysKeyword));
+    }
+
+    /**
+     * 删除系统关键字
+     */
+    @PreAuthorize("@ss.hasPermi('system:keyword:remove')")
+    @Log(title = "系统关键字", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{keywordIds}")
+    public AjaxResult remove(@PathVariable Long[] keywordIds)
+    {
+        return toAjax(sysKeywordService.deleteSysKeywordByIds(keywordIds));
+    }
+}

+ 35 - 0
fs-service-system/src/main/java/com/fs/system/domain/SysKeyword.java

@@ -0,0 +1,35 @@
+package com.fs.system.domain;
+
+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;
+
+/**
+ * 系统关键字对象 sys_keyword
+ *
+ * @author fs
+ * @date 2025-05-14
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SysKeyword extends BaseEntity{
+
+    /** 关键字id */
+    private Long keywordId;
+
+    /** 关键字 */
+    @Excel(name = "关键字")
+    private String keyword;
+
+    /** 类型:1-看课弹幕; */
+    @Excel(name = "类型:1-看课弹幕;")
+    private Long type;
+
+    /** 所属公司 */
+    @Excel(name = "所属公司")
+    private Long companyId;
+
+
+}

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

@@ -0,0 +1,61 @@
+package com.fs.system.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.system.domain.SysKeyword;
+
+/**
+ * 系统关键字Mapper接口
+ * 
+ * @author fs
+ * @date 2025-05-14
+ */
+public interface SysKeywordMapper extends BaseMapper<SysKeyword>{
+    /**
+     * 查询系统关键字
+     * 
+     * @param keywordId 系统关键字主键
+     * @return 系统关键字
+     */
+    SysKeyword selectSysKeywordById(Long keywordId);
+
+    /**
+     * 查询系统关键字列表
+     * 
+     * @param sysKeyword 系统关键字
+     * @return 系统关键字集合
+     */
+    List<SysKeyword> selectSysKeywordList(SysKeyword sysKeyword);
+
+    /**
+     * 新增系统关键字
+     * 
+     * @param sysKeyword 系统关键字
+     * @return 结果
+     */
+    int insertSysKeyword(SysKeyword sysKeyword);
+
+    /**
+     * 修改系统关键字
+     * 
+     * @param sysKeyword 系统关键字
+     * @return 结果
+     */
+    int updateSysKeyword(SysKeyword sysKeyword);
+
+    /**
+     * 删除系统关键字
+     * 
+     * @param keywordId 系统关键字主键
+     * @return 结果
+     */
+    int deleteSysKeywordById(Long keywordId);
+
+    /**
+     * 批量删除系统关键字
+     * 
+     * @param keywordIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteSysKeywordByIds(Long[] keywordIds);
+}

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

@@ -0,0 +1,61 @@
+package com.fs.system.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.system.domain.SysKeyword;
+
+/**
+ * 系统关键字Service接口
+ * 
+ * @author fs
+ * @date 2025-05-14
+ */
+public interface ISysKeywordService extends IService<SysKeyword>{
+    /**
+     * 查询系统关键字
+     * 
+     * @param keywordId 系统关键字主键
+     * @return 系统关键字
+     */
+    SysKeyword selectSysKeywordById(Long keywordId);
+
+    /**
+     * 查询系统关键字列表
+     * 
+     * @param sysKeyword 系统关键字
+     * @return 系统关键字集合
+     */
+    List<SysKeyword> selectSysKeywordList(SysKeyword sysKeyword);
+
+    /**
+     * 新增系统关键字
+     * 
+     * @param sysKeyword 系统关键字
+     * @return 结果
+     */
+    int insertSysKeyword(SysKeyword sysKeyword);
+
+    /**
+     * 修改系统关键字
+     * 
+     * @param sysKeyword 系统关键字
+     * @return 结果
+     */
+    int updateSysKeyword(SysKeyword sysKeyword);
+
+    /**
+     * 批量删除系统关键字
+     * 
+     * @param keywordIds 需要删除的系统关键字主键集合
+     * @return 结果
+     */
+    int deleteSysKeywordByIds(Long[] keywordIds);
+
+    /**
+     * 删除系统关键字信息
+     * 
+     * @param keywordId 系统关键字主键
+     * @return 结果
+     */
+    int deleteSysKeywordById(Long keywordId);
+}

+ 94 - 0
fs-service-system/src/main/java/com/fs/system/service/impl/SysKeywordServiceImpl.java

@@ -0,0 +1,94 @@
+package com.fs.system.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.system.mapper.SysKeywordMapper;
+import com.fs.system.domain.SysKeyword;
+import com.fs.system.service.ISysKeywordService;
+
+/**
+ * 系统关键字Service业务层处理
+ * 
+ * @author fs
+ * @date 2025-05-14
+ */
+@Service
+public class SysKeywordServiceImpl extends ServiceImpl<SysKeywordMapper, SysKeyword> implements ISysKeywordService {
+
+    /**
+     * 查询系统关键字
+     * 
+     * @param keywordId 系统关键字主键
+     * @return 系统关键字
+     */
+    @Override
+    public SysKeyword selectSysKeywordById(Long keywordId)
+    {
+        return baseMapper.selectSysKeywordById(keywordId);
+    }
+
+    /**
+     * 查询系统关键字列表
+     * 
+     * @param sysKeyword 系统关键字
+     * @return 系统关键字
+     */
+    @Override
+    public List<SysKeyword> selectSysKeywordList(SysKeyword sysKeyword)
+    {
+        return baseMapper.selectSysKeywordList(sysKeyword);
+    }
+
+    /**
+     * 新增系统关键字
+     * 
+     * @param sysKeyword 系统关键字
+     * @return 结果
+     */
+    @Override
+    public int insertSysKeyword(SysKeyword sysKeyword)
+    {
+        sysKeyword.setCreateTime(DateUtils.getNowDate());
+        return baseMapper.insertSysKeyword(sysKeyword);
+    }
+
+    /**
+     * 修改系统关键字
+     * 
+     * @param sysKeyword 系统关键字
+     * @return 结果
+     */
+    @Override
+    public int updateSysKeyword(SysKeyword sysKeyword)
+    {
+        sysKeyword.setUpdateTime(DateUtils.getNowDate());
+        return baseMapper.updateSysKeyword(sysKeyword);
+    }
+
+    /**
+     * 批量删除系统关键字
+     * 
+     * @param keywordIds 需要删除的系统关键字主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysKeywordByIds(Long[] keywordIds)
+    {
+        return baseMapper.deleteSysKeywordByIds(keywordIds);
+    }
+
+    /**
+     * 删除系统关键字信息
+     * 
+     * @param keywordId 系统关键字主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysKeywordById(Long keywordId)
+    {
+        return baseMapper.deleteSysKeywordById(keywordId);
+    }
+}

+ 74 - 0
fs-service-system/src/main/resources/mapper/system/SysKeywordMapper.xml

@@ -0,0 +1,74 @@
+<?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.system.mapper.SysKeywordMapper">
+    
+    <resultMap type="SysKeyword" id="SysKeywordResult">
+        <result property="keywordId"    column="keyword_id"    />
+        <result property="keyword"    column="keyword"    />
+        <result property="type"    column="type"    />
+        <result property="companyId"    column="company_id"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectSysKeywordVo">
+        select keyword_id, keyword, type, company_id, create_time, update_time from sys_keyword
+    </sql>
+
+    <select id="selectSysKeywordList" parameterType="SysKeyword" resultMap="SysKeywordResult">
+        <include refid="selectSysKeywordVo"/>
+        <where>  
+            <if test="keyword != null  and keyword != ''"> and keyword = #{keyword}</if>
+            <if test="type != null "> and type = #{type}</if>
+            <if test="companyId != null "> and company_id = #{companyId}</if>
+        </where>
+    </select>
+    
+    <select id="selectSysKeywordById" parameterType="Long" resultMap="SysKeywordResult">
+        <include refid="selectSysKeywordVo"/>
+        where keyword_id = #{keywordId}
+    </select>
+        
+    <insert id="insertSysKeyword" parameterType="SysKeyword" useGeneratedKeys="true" keyProperty="keywordId">
+        insert into sys_keyword
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="keyword != null">keyword,</if>
+            <if test="type != null">type,</if>
+            <if test="companyId != null">company_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="keyword != null">#{keyword},</if>
+            <if test="type != null">#{type},</if>
+            <if test="companyId != null">#{companyId},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateSysKeyword" parameterType="SysKeyword">
+        update sys_keyword
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="keyword != null">keyword = #{keyword},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="companyId != null">company_id = #{companyId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where keyword_id = #{keywordId}
+    </update>
+
+    <delete id="deleteSysKeywordById" parameterType="Long">
+        delete from sys_keyword where keyword_id = #{keywordId}
+    </delete>
+
+    <delete id="deleteSysKeywordByIds" parameterType="String">
+        delete from sys_keyword where keyword_id in 
+        <foreach item="keywordId" collection="array" open="(" separator="," close=")">
+            #{keywordId}
+        </foreach>
+    </delete>
+</mapper>