新增常见问题功能
All checks were successful
Build and Push to Target Registry / 构建并推送镜像到目标仓库 (push) Successful in 6m24s
All checks were successful
Build and Push to Target Registry / 构建并推送镜像到目标仓库 (push) Successful in 6m24s
This commit is contained in:
parent
187763e0e5
commit
50ddc1e954
4
pom.xml
4
pom.xml
@ -91,8 +91,8 @@
|
||||
<properties>
|
||||
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||
<profiles.active>dev</profiles.active>
|
||||
<nacos.server>10.20.1.60:8848</nacos.server>
|
||||
<logstash.address>10.20.1.60:4560</logstash.address>
|
||||
<nacos.server>127.0.0.1:8848</nacos.server>
|
||||
<logstash.address>127.0.0.1:4560</logstash.address>
|
||||
<nacos.discovery.group>DEFAULT_GROUP</nacos.discovery.group>
|
||||
<nacos.config.group>DEFAULT_GROUP</nacos.config.group>
|
||||
<nacos.username>nacos</nacos.username>
|
||||
|
@ -0,0 +1,106 @@
|
||||
package org.dromara.property.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.property.domain.vo.FaqManagementVo;
|
||||
import org.dromara.property.domain.bo.FaqManagementBo;
|
||||
import org.dromara.property.service.IFaqManagementService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 常见问题管理
|
||||
* 前端访问路由地址为:/property/faqManagement
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-08-18
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/faqManagement")
|
||||
public class FaqManagementController extends BaseController {
|
||||
|
||||
private final IFaqManagementService faqManagementService;
|
||||
|
||||
/**
|
||||
* 查询常见问题管理列表
|
||||
*/
|
||||
@SaCheckPermission("property:faqManagement:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<FaqManagementVo> list(FaqManagementBo bo, PageQuery pageQuery) {
|
||||
return faqManagementService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出常见问题管理列表
|
||||
*/
|
||||
@SaCheckPermission("property:faqManagement:export")
|
||||
@Log(title = "常见问题管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(FaqManagementBo bo, HttpServletResponse response) {
|
||||
List<FaqManagementVo> list = faqManagementService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "常见问题管理", FaqManagementVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常见问题管理详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("property:faqManagement:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<FaqManagementVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(faqManagementService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常见问题管理
|
||||
*/
|
||||
@SaCheckPermission("property:faqManagement:add")
|
||||
@Log(title = "常见问题管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody FaqManagementBo bo) {
|
||||
return toAjax(faqManagementService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常见问题管理
|
||||
*/
|
||||
@SaCheckPermission("property:faqManagement:edit")
|
||||
@Log(title = "常见问题管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody FaqManagementBo bo) {
|
||||
return toAjax(faqManagementService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除常见问题管理
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("property:faqManagement:remove")
|
||||
@Log(title = "常见问题管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(faqManagementService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package org.dromara.property.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 常见问题管理对象 faq_management
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-08-18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("faq_management")
|
||||
public class FaqManagement extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String head;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
private Long pageView;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String contents;
|
||||
|
||||
/**
|
||||
* 状态(1草稿 2已发布)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package org.dromara.property.domain.bo;
|
||||
|
||||
import org.dromara.property.domain.FaqManagement;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 常见问题管理业务对象 faq_management
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-08-18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = FaqManagement.class, reverseConvertGenerate = false)
|
||||
public class FaqManagementBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@NotBlank(message = "标题不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String head;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@NotBlank(message = "分类不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
private Long pageView;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@NotBlank(message = "内容不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String contents;
|
||||
|
||||
/**
|
||||
* 状态(1草稿 2已发布)
|
||||
*/
|
||||
@NotBlank(message = "状态(1草稿 2已发布)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import org.dromara.property.domain.FaqManagement;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 常见问题管理视图对象 faq_management
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-08-18
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = FaqManagement.class)
|
||||
public class FaqManagementVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@ExcelProperty(value = "标题")
|
||||
private String head;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@ExcelProperty(value = "分类")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
@ExcelProperty(value = "浏览量")
|
||||
private Long pageView;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@ExcelProperty(value = "内容")
|
||||
private String contents;
|
||||
|
||||
/**
|
||||
* 状态(1草稿 2已发布)
|
||||
*/
|
||||
@ExcelProperty(value = "状态(1草稿 2已发布)")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
@ExcelProperty(value = "搜索值")
|
||||
private String searchValue;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package org.dromara.property.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.property.domain.FaqManagement;
|
||||
import org.dromara.property.domain.vo.FaqManagementVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 常见问题管理Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-08-18
|
||||
*/
|
||||
@Mapper
|
||||
public interface FaqManagementMapper extends BaseMapperPlus<FaqManagement, FaqManagementVo> {
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.dromara.property.service;
|
||||
|
||||
import org.dromara.property.domain.FaqManagement;
|
||||
import org.dromara.property.domain.vo.FaqManagementVo;
|
||||
import org.dromara.property.domain.bo.FaqManagementBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 常见问题管理Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-08-18
|
||||
*/
|
||||
public interface IFaqManagementService {
|
||||
|
||||
/**
|
||||
* 查询常见问题管理
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 常见问题管理
|
||||
*/
|
||||
FaqManagementVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询常见问题管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 常见问题管理分页列表
|
||||
*/
|
||||
TableDataInfo<FaqManagementVo> queryPageList(FaqManagementBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的常见问题管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 常见问题管理列表
|
||||
*/
|
||||
List<FaqManagementVo> queryList(FaqManagementBo bo);
|
||||
|
||||
/**
|
||||
* 新增常见问题管理
|
||||
*
|
||||
* @param bo 常见问题管理
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(FaqManagementBo bo);
|
||||
|
||||
/**
|
||||
* 修改常见问题管理
|
||||
*
|
||||
* @param bo 常见问题管理
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(FaqManagementBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除常见问题管理信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.FaqManagementBo;
|
||||
import org.dromara.property.domain.vo.FaqManagementVo;
|
||||
import org.dromara.property.domain.FaqManagement;
|
||||
import org.dromara.property.mapper.FaqManagementMapper;
|
||||
import org.dromara.property.service.IFaqManagementService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 常见问题管理Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-08-18
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class FaqManagementServiceImpl implements IFaqManagementService {
|
||||
|
||||
private final FaqManagementMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询常见问题管理
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 常见问题管理
|
||||
*/
|
||||
@Override
|
||||
public FaqManagementVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询常见问题管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 常见问题管理分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<FaqManagementVo> queryPageList(FaqManagementBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<FaqManagement> lqw = buildQueryWrapper(bo);
|
||||
Page<FaqManagementVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的常见问题管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 常见问题管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<FaqManagementVo> queryList(FaqManagementBo bo) {
|
||||
LambdaQueryWrapper<FaqManagement> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<FaqManagement> buildQueryWrapper(FaqManagementBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<FaqManagement> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(FaqManagement::getId);
|
||||
lqw.like(StringUtils.isNotBlank(bo.getHead()), FaqManagement::getHead, bo.getHead());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getType()), FaqManagement::getType, bo.getType());
|
||||
lqw.eq(bo.getPageView() != null, FaqManagement::getPageView, bo.getPageView());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getContents()), FaqManagement::getContents, bo.getContents());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), FaqManagement::getStatus, bo.getStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSearchValue()), FaqManagement::getSearchValue, bo.getSearchValue());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增常见问题管理
|
||||
*
|
||||
* @param bo 常见问题管理
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(FaqManagementBo bo) {
|
||||
FaqManagement add = MapstructUtils.convert(bo, FaqManagement.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改常见问题管理
|
||||
*
|
||||
* @param bo 常见问题管理
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(FaqManagementBo bo) {
|
||||
FaqManagement update = MapstructUtils.convert(bo, FaqManagement.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(FaqManagement entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除常见问题管理信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.property.mapper.FaqManagementMapper">
|
||||
|
||||
</mapper>
|
@ -90,7 +90,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
@Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
||||
// @Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
||||
@Override
|
||||
public List<SysDictDataVo> selectDictDataByType(String dictType) {
|
||||
List<SysDictDataVo> dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||
|
@ -40,9 +40,9 @@ spring.sql.init.platform=mysql
|
||||
db.num=1
|
||||
|
||||
### Connect URL of DB:
|
||||
db.url.0=jdbc:mysql://10.20.1.65:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||
db.url.0=jdbc:mysql://127.0.0.1:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||
db.user.0=root
|
||||
db.password.0=By@2025!
|
||||
db.password.0=123456
|
||||
|
||||
### the maximum retry times for push
|
||||
nacos.config.push.maxRetryTime=50
|
||||
|
Loading…
Reference in New Issue
Block a user