常见问题功能

This commit is contained in:
zjf committed 2025-04-07 17:58:37 +08:00
1 parent 4406e44cab
commit 2b261a4bbe
13 files changed
+615

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
-- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 父节点-1 , 默认租户 1
--常见问题分类
-- 菜单SQL
-- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 父节点-1 , 默认租户 1
-- 菜单SQL
-- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 父节点-1 , 默认租户 1
-- 菜单SQL
insert into sys_menu ( menu_id,parent_id, path, permission, menu_type, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015467528, '-1', '/integrated/faqCategory/index', '', '0', 'icon-bangzhushouji', '0', null , '8', null , '常见问题分类表管理', 1);
-- 菜单对应按钮SQL
insert into sys_menu ( menu_id,parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015467529,1744015467528, 'integrated_faqCategory_view', '1', null, '1', '0', null, '0', null, '常见问题分类表查看', 1);
insert into sys_menu ( menu_id,parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015467530,1744015467528, 'integrated_faqCategory_add', '1', null, '1', '0', null, '1', null, '常见问题分类表新增', 1);
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015467531,1744015467528, 'integrated_faqCategory_edit', '1', null, '1', '0', null, '2', null, '常见问题分类表修改', 1);
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015467532,1744015467528, 'integrated_faqCategory_del', '1', null, '1', '0', null, '3', null, '常见问题分类表删除', 1);
insert into sys_menu ( menu_id,parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015467533,1744015467528, 'integrated_faqCategory_export', '1', null, '1', '0', null, '3', null, '导入导出', 1);
-- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 父节点-1 , 默认租户 1
-- 菜单SQL
insert into sys_menu ( menu_id,parent_id, path, permission, menu_type, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015545424, '-1', '/integrated/faqInfo/index', '', '0', 'icon-bangzhushouji', '0', null , '8', null , '常见问题内容表管理', 1);
-- 菜单对应按钮SQL
insert into sys_menu ( menu_id,parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015545425,1744015545424, 'integrated_faqInfo_view', '1', null, '1', '0', null, '0', null, '常见问题内容表查看', 1);
insert into sys_menu ( menu_id,parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015545426,1744015545424, 'integrated_faqInfo_add', '1', null, '1', '0', null, '1', null, '常见问题内容表新增', 1);
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015545427,1744015545424, 'integrated_faqInfo_edit', '1', null, '1', '0', null, '2', null, '常见问题内容表修改', 1);
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015545428,1744015545424, 'integrated_faqInfo_del', '1', null, '1', '0', null, '3', null, '常见问题内容表删除', 1);
insert into sys_menu ( menu_id,parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
values (1744015545429,1744015545424, 'integrated_faqInfo_export', '1', null, '1', '0', null, '3', null, '导入导出', 1);
@@ -0,0 +1,119 @@
package com.bsd.pjcloud.integrated.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.integrated.entity.FaqCategoryEntity;
import com.bsd.pjcloud.integrated.service.FaqCategoryService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 常见问题分类表
*
* @author zjf
* @date 2025-04-07 16:44:27
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/faqCategory" )
@Tag(description = "faqCategory" , name = "常见问题分类表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class FaqCategoryController {
private final FaqCategoryService faqCategoryService;
/**
* 分页查询
* @param page 分页对象
* @param faqCategory 常见问题分类表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('integrated_faqCategory_view')" )
public R getFaqCategoryPage(@ParameterObject Page page, @ParameterObject FaqCategoryEntity faqCategory) {
LambdaQueryWrapper<FaqCategoryEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(faqCategoryService.page(page, wrapper));
}
/**
* 通过id查询常见问题分类表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('integrated_faqCategory_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(faqCategoryService.getById(id));
}
/**
* 新增常见问题分类表
* @param faqCategory 常见问题分类表
* @return R
*/
@Operation(summary = "新增常见问题分类表" , description = "新增常见问题分类表" )
@SysLog("新增常见问题分类表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('integrated_faqCategory_add')" )
public R save(@RequestBody FaqCategoryEntity faqCategory) {
return R.ok(faqCategoryService.save(faqCategory));
}
/**
* 修改常见问题分类表
* @param faqCategory 常见问题分类表
* @return R
*/
@Operation(summary = "修改常见问题分类表" , description = "修改常见问题分类表" )
@SysLog("修改常见问题分类表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('integrated_faqCategory_edit')" )
public R updateById(@RequestBody FaqCategoryEntity faqCategory) {
return R.ok(faqCategoryService.updateById(faqCategory));
}
/**
* 通过id删除常见问题分类表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除常见问题分类表" , description = "通过id删除常见问题分类表" )
@SysLog("通过id删除常见问题分类表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('integrated_faqCategory_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(faqCategoryService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param faqCategory 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('integrated_faqCategory_export')" )
public List<FaqCategoryEntity> export(FaqCategoryEntity faqCategory,Long[] ids) {
return faqCategoryService.list(Wrappers.lambdaQuery(faqCategory).in(ArrayUtil.isNotEmpty(ids), FaqCategoryEntity::getId, ids));
}
}
@@ -0,0 +1,119 @@
package com.bsd.pjcloud.integrated.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.integrated.entity.FaqInfoEntity;
import com.bsd.pjcloud.integrated.service.FaqInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 常见问题内容表
*
* @author zjf
* @date 2025-04-07 16:45:43
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/faqInfo" )
@Tag(description = "faqInfo" , name = "常见问题内容表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class FaqInfoController {
private final FaqInfoService faqInfoService;
/**
* 分页查询
* @param page 分页对象
* @param faqInfo 常见问题内容表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('integrated_faqInfo_view')" )
public R getFaqInfoPage(@ParameterObject Page page, @ParameterObject FaqInfoEntity faqInfo) {
LambdaQueryWrapper<FaqInfoEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(faqInfoService.page(page, wrapper));
}
/**
* 通过id查询常见问题内容表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('integrated_faqInfo_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(faqInfoService.getById(id));
}
/**
* 新增常见问题内容表
* @param faqInfo 常见问题内容表
* @return R
*/
@Operation(summary = "新增常见问题内容表" , description = "新增常见问题内容表" )
@SysLog("新增常见问题内容表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('integrated_faqInfo_add')" )
public R save(@RequestBody FaqInfoEntity faqInfo) {
return R.ok(faqInfoService.save(faqInfo));
}
/**
* 修改常见问题内容表
* @param faqInfo 常见问题内容表
* @return R
*/
@Operation(summary = "修改常见问题内容表" , description = "修改常见问题内容表" )
@SysLog("修改常见问题内容表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('integrated_faqInfo_edit')" )
public R updateById(@RequestBody FaqInfoEntity faqInfo) {
return R.ok(faqInfoService.updateById(faqInfo));
}
/**
* 通过id删除常见问题内容表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除常见问题内容表" , description = "通过id删除常见问题内容表" )
@SysLog("通过id删除常见问题内容表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('integrated_faqInfo_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(faqInfoService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param faqInfo 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('integrated_faqInfo_export')" )
public List<FaqInfoEntity> export(FaqInfoEntity faqInfo,Long[] ids) {
return faqInfoService.list(Wrappers.lambdaQuery(faqInfo).in(ArrayUtil.isNotEmpty(ids), FaqInfoEntity::getId, ids));
}
}
@@ -0,0 +1,97 @@
package com.bsd.pjcloud.integrated.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 常见问题分类表
*
* @author zjf
* @date 2025-04-07 16:44:27
*/
@Data
@TenantTable
@TableName("faq_category")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "常见问题分类表")
public class FaqCategoryEntity extends Model<FaqCategoryEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 分类名称
*/
@Schema(description="分类名称")
private String name;
/**
* 排序
*/
@Schema(description="排序")
private Integer sort;
/**
* 状态
*/
@Schema(description="状态")
private String status;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建者")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新者")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
}
@@ -0,0 +1,115 @@
package com.bsd.pjcloud.integrated.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 常见问题内容表
*
* @author zjf
* @date 2025-04-07 16:45:43
*/
@Data
@TenantTable
@TableName("faq_info")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "常见问题内容表")
public class FaqInfoEntity extends Model<FaqInfoEntity> {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="id")
private Long id;
/**
* 名称
*/
@Schema(description="名称")
private String name;
/**
* 排序
*/
@Schema(description="排序")
private Integer sort;
/**
* 状态
*/
@Schema(description="状态")
private String status;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 分类id
*/
@Schema(description="分类id")
private Long categoryId;
/**
* 标题
*/
@Schema(description="标题")
private String questionText;
/**
* 内容
*/
@Schema(description="内容")
private String answerText;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建者")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 更新者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新者")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="更新时间")
private LocalDateTime updateTime;
/**
* 是否删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="是否删除")
private String delFlag;
/**
* 租户编号
*/
@Schema(description="租户编号")
private Long tenantId;
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.integrated.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.integrated.entity.FaqCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FaqCategoryMapper extends PjcloudBaseMapper<FaqCategoryEntity> {
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.integrated.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.integrated.entity.FaqInfoEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FaqInfoMapper extends PjcloudBaseMapper<FaqInfoEntity> {
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.integrated.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.integrated.entity.FaqCategoryEntity;
public interface FaqCategoryService extends IService<FaqCategoryEntity> {
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.integrated.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.integrated.entity.FaqInfoEntity;
public interface FaqInfoService extends IService<FaqInfoEntity> {
}
@@ -0,0 +1,16 @@
package com.bsd.pjcloud.integrated.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.integrated.entity.FaqCategoryEntity;
import com.bsd.pjcloud.integrated.mapper.FaqCategoryMapper;
import com.bsd.pjcloud.integrated.service.FaqCategoryService;
import org.springframework.stereotype.Service;
/**
* 常见问题分类表
*
* @author zjf
* @date 2025-04-07 16:44:27
*/
@Service
public class FaqCategoryServiceImpl extends ServiceImpl<FaqCategoryMapper, FaqCategoryEntity> implements FaqCategoryService {
}
@@ -0,0 +1,16 @@
package com.bsd.pjcloud.integrated.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.integrated.entity.FaqInfoEntity;
import com.bsd.pjcloud.integrated.mapper.FaqInfoMapper;
import com.bsd.pjcloud.integrated.service.FaqInfoService;
import org.springframework.stereotype.Service;
/**
* 常见问题内容表
*
* @author zjf
* @date 2025-04-07 16:45:43
*/
@Service
public class FaqInfoServiceImpl extends ServiceImpl<FaqInfoMapper, FaqInfoEntity> implements FaqInfoService {
}
@@ -0,0 +1,19 @@
<?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.bsd.pjcloud.integrated.mapper.FaqCategoryMapper">
<resultMap id="faqCategoryMap" type="com.bsd.pjcloud.integrated.entity.FaqCategoryEntity">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="sort" column="sort"/>
<result property="status" column="status"/>
<result property="deptId" column="dept_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>
@@ -0,0 +1,22 @@
<?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.bsd.pjcloud.integrated.mapper.FaqInfoMapper">
<resultMap id="faqInfoMap" type="com.bsd.pjcloud.integrated.entity.FaqInfoEntity">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="sort" column="sort"/>
<result property="status" column="status"/>
<result property="deptId" column="dept_id"/>
<result property="categoryId" column="category_id"/>
<result property="questionText" column="question_text"/>
<result property="answerText" column="answer_text"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>