Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d6fd8768af | |||
| 9a9febb0e2 |
@@ -0,0 +1,118 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Protocol;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.param.ProtocolParam;
|
||||
import com.gxwebsoft.common.system.service.ProtocolService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 协议管理控制器
|
||||
*
|
||||
* @author xm
|
||||
* @since 2026-05-06 08:20:48
|
||||
*/
|
||||
@Api(tags = "协议管理管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/protocol")
|
||||
public class ProtocolController extends BaseController {
|
||||
@Resource
|
||||
private ProtocolService protocolService;
|
||||
|
||||
// @PreAuthorize("hasAuthority('common.system:protocol:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("分页查询协议管理")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Protocol>> page(ProtocolParam param) {
|
||||
// 使用关联查询
|
||||
return success(protocolService.pageRel(param));
|
||||
}
|
||||
|
||||
// @PreAuthorize("hasAuthority('common.system:protocol:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部协议管理")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Protocol>> list(ProtocolParam param) {
|
||||
// 使用关联查询
|
||||
return success(protocolService.listRel(param));
|
||||
}
|
||||
|
||||
// @PreAuthorize("hasAuthority('common.system:protocol:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询协议管理")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Protocol> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(protocolService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("通过端口及协议类型获取协议")
|
||||
@GetMapping("/getInfo")
|
||||
@Parameters({
|
||||
@Parameter(name = "clientType", description = "适用客户端 1-用户端 2-其他", required = true, example = "1"),
|
||||
@Parameter(name = "protocolType", description = "协议类型 1-用户协议 2-隐私策略 3-理赔说明 4-个人信息处理授权书", required = true, example = "1")
|
||||
})
|
||||
public ApiResult<Protocol> getInfo(@RequestParam("clientType") Integer clientType, @RequestParam("protocolType") Integer protocolType) {
|
||||
// 使用关联查询
|
||||
return success(protocolService.getInfo(clientType, protocolType));
|
||||
}
|
||||
|
||||
// @PreAuthorize("hasAuthority('common.system:protocol:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("添加协议管理")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@Valid @RequestBody Protocol protocol) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
protocol.setCreator(loginUser.getUserId());
|
||||
}
|
||||
protocol.setCreateTime(LocalDateTime.now());
|
||||
if (protocolService.save(protocol)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
// @PreAuthorize("hasAuthority('common.system:protocol:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改协议管理")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Protocol protocol) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
protocol.setUpdater(loginUser.getUserId());
|
||||
}
|
||||
protocol.setUpdateTime(LocalDateTime.now());
|
||||
if (protocolService.updateById(protocol)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
// @PreAuthorize("hasAuthority('common.system:protocol:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除协议管理")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (protocolService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.gxwebsoft.common.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 协议管理
|
||||
*
|
||||
* @author xm
|
||||
* @since 2026-05-06 08:20:47
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Protocol对象", description = "协议管理")
|
||||
@TableName("sys_protocol")
|
||||
public class Protocol implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "适用客户端 1-用户端 2-其他")
|
||||
private Integer clientType;
|
||||
|
||||
@ApiModelProperty(value = "协议类型 1-用户协议 2-隐私策略 3-理赔说明 4-个人信息处理授权书")
|
||||
private Integer protocolType;
|
||||
|
||||
@ApiModelProperty(value = "协议内容")
|
||||
private String protocolContent;
|
||||
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private Integer creator;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private Integer updater;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty(value = "是否删除 0-未删 1-已删")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.common.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.common.system.entity.Protocol;
|
||||
import com.gxwebsoft.common.system.param.ProtocolParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 协议管理Mapper
|
||||
*
|
||||
* @author xm
|
||||
* @since 2026-05-06 08:20:47
|
||||
*/
|
||||
public interface ProtocolMapper extends BaseMapper<Protocol> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<Protocol>
|
||||
*/
|
||||
List<Protocol> selectPageRel(@Param("page") IPage<Protocol> page,
|
||||
@Param("param") ProtocolParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<Protocol> selectListRel(@Param("param") ProtocolParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?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.gxwebsoft.common.system.mapper.ProtocolMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM sys_protocol a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.protocolType != null">
|
||||
AND a.protocol_type = #{param.protocolType}
|
||||
</if>
|
||||
<if test="param.clientType != null">
|
||||
AND a.client_type = #{param.clientType}
|
||||
</if>
|
||||
<if test="param.protocolContent != null">
|
||||
AND a.protocol_content LIKE CONCAT('%', #{param.protocolContent}, '%')
|
||||
</if>
|
||||
<if test="param.creator != null">
|
||||
AND a.creator = #{param.creator}
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.updater != null">
|
||||
AND a.updater = #{param.updater}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
<if test="param.deleted == null">
|
||||
AND a.deleted = 0
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.Protocol">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.Protocol">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.gxwebsoft.common.system.param;
|
||||
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 协议管理查询参数
|
||||
*
|
||||
* @author xm
|
||||
* @since 2026-05-06 08:20:47
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "ProtocolParam对象", description = "协议管理查询参数")
|
||||
public class ProtocolParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "协议类型 1-用户协议 2-隐私策略 3-理赔说明 4-个人信息处理授权书")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer protocolType;
|
||||
|
||||
@ApiModelProperty(value = "适用客户端 1-用户端 2-其他")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer clientType;
|
||||
|
||||
@ApiModelProperty(value = "协议内容")
|
||||
private String protocolContent;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer creator;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer updater;
|
||||
|
||||
@ApiModelProperty(value = "是否删除 0-未删 1-已删")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gxwebsoft.common.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Protocol;
|
||||
import com.gxwebsoft.common.system.param.ProtocolParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 协议管理Service
|
||||
*
|
||||
* @author xm
|
||||
* @since 2026-05-06 08:20:47
|
||||
*/
|
||||
public interface ProtocolService extends IService<Protocol> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<Protocol>
|
||||
*/
|
||||
PageResult<Protocol> pageRel(ProtocolParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<Protocol>
|
||||
*/
|
||||
List<Protocol> listRel(ProtocolParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id 主键ID
|
||||
* @return Protocol
|
||||
*/
|
||||
Protocol getByIdRel(Integer id);
|
||||
|
||||
/**
|
||||
* 通过端口及协议类型获取协议
|
||||
* @param clientType 端口
|
||||
* @param protocolType 协议类型
|
||||
* @return
|
||||
*/
|
||||
Protocol getInfo(Integer clientType, Integer protocolType);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.system.mapper.ProtocolMapper;
|
||||
import com.gxwebsoft.common.system.service.ProtocolService;
|
||||
import com.gxwebsoft.common.system.entity.Protocol;
|
||||
import com.gxwebsoft.common.system.param.ProtocolParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 协议管理Service实现
|
||||
*
|
||||
* @author xm
|
||||
* @since 2026-05-06 08:20:47
|
||||
*/
|
||||
@Service
|
||||
public class ProtocolServiceImpl extends ServiceImpl<ProtocolMapper, Protocol> implements ProtocolService {
|
||||
|
||||
@Override
|
||||
public PageResult<Protocol> pageRel(ProtocolParam param) {
|
||||
PageParam<Protocol, ProtocolParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<Protocol> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Protocol> listRel(ProtocolParam param) {
|
||||
List<Protocol> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Protocol, ProtocolParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Protocol getByIdRel(Integer id) {
|
||||
ProtocolParam param = new ProtocolParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Protocol getInfo(Integer clientType, Integer protocolType) {
|
||||
List<Protocol> list = lambdaQuery().eq(Protocol::getClientType, clientType).eq(Protocol::getProtocolType, protocolType).list();
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
return list.get(0);
|
||||
}else {
|
||||
throw new RuntimeException("暂无相关协议!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,17 +6,17 @@ spring:
|
||||
allow-circular-references: true
|
||||
allow-bean-definition-overriding: true # 允许bean定义覆盖,解决RabbitMQConfig中的objectMapper bean冲突
|
||||
datasource:
|
||||
url: jdbc:mysql://8.134.55.105:13306/gxwebsoft_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://1Panel-mysql-XsWW:3306/gxwebsoft_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: gxwebsoft_core
|
||||
password: ZXT5FkBREBJQPiAs
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
redis:
|
||||
database: 0
|
||||
host: 8.134.55.105
|
||||
port: 16379
|
||||
password: redis_t74P8C
|
||||
redis:
|
||||
database: 0
|
||||
host: 1Panel-redis-GmNr
|
||||
port: 6379
|
||||
password: redis_t74P8C
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
|
||||
36
src/main/resources/application-local.yml
Normal file
36
src/main/resources/application-local.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
# 开发环境配置
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
allow-bean-definition-overriding: true # 允许bean定义覆盖,解决RabbitMQConfig中的objectMapper bean冲突
|
||||
datasource:
|
||||
url: jdbc:mysql://47.107.249.41:13306/gxwebsoft_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: gxwebsoft_core
|
||||
password: ZXT5FkBREBJQPiAs
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
redis:
|
||||
database: 0
|
||||
host: localhost
|
||||
port: 6379
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.gxwebsoft: DEBUG
|
||||
com.baomidou.mybatisplus: DEBUG
|
||||
|
||||
socketio:
|
||||
host: localhost #IP地址
|
||||
|
||||
# 框架配置
|
||||
config:
|
||||
# 开发环境接口
|
||||
server-url: http://127.0.0.1:9090/api
|
||||
upload-path: /Users/gxwebsoft/Documents/uploads
|
||||
|
||||
#swagger:
|
||||
#host: https://server.websoft.top/swagger-ui/index.html
|
||||
@@ -8,6 +8,7 @@ socketio:
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
# active: local
|
||||
|
||||
application:
|
||||
name: server
|
||||
@@ -56,23 +57,23 @@ spring:
|
||||
multipart:
|
||||
max-file-size: 500MB
|
||||
max-request-size: 500MB
|
||||
redis:
|
||||
database: 0
|
||||
host: 1Panel-redis-GmNr
|
||||
port: 6379
|
||||
password: redis_t74P8C
|
||||
# redis:
|
||||
# database: 0
|
||||
# host: 1Panel-redis-GmNr
|
||||
# port: 6379
|
||||
# password: redis_t74P8C
|
||||
|
||||
# RabbitMQ 配置
|
||||
rabbitmq:
|
||||
host: 1Panel-rabbitmq-kvHZ
|
||||
port: 5672
|
||||
username: rabbitmq
|
||||
password: rabbitmq
|
||||
virtual-host: /
|
||||
# 开启确认模式
|
||||
publisher-confirm-type: correlated
|
||||
# 开启Return模式
|
||||
publisher-returns: true
|
||||
# rabbitmq:
|
||||
# host: 1Panel-rabbitmq-kvHZ
|
||||
# port: 5672
|
||||
# username: rabbitmq
|
||||
# password: rabbitmq
|
||||
# virtual-host: /
|
||||
# # 开启确认模式
|
||||
# publisher-confirm-type: correlated
|
||||
# # 开启Return模式
|
||||
# publisher-returns: true
|
||||
|
||||
# 邮件服务器配置
|
||||
mail:
|
||||
|
||||
@@ -33,11 +33,11 @@ public class SysGenerator {
|
||||
// Vue文件输出目录
|
||||
private static final String OUTPUT_DIR_VUE = "/src";
|
||||
// 作者名称
|
||||
private static final String AUTHOR = "科技小王子";
|
||||
private static final String AUTHOR = "xm";
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://8.134.55.105:13306/gxwebsoft_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_URL = "jdbc:mysql://47.107.249.41:13306/gxwebsoft_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "gxwebsoft_core";
|
||||
private static final String DB_PASSWORD = "ZXT5FkBREBJQPiAs";
|
||||
@@ -54,6 +54,7 @@ public class SysGenerator {
|
||||
// "sys_user_verify"
|
||||
// "sys_user_role",
|
||||
// "sys_authorize_code"
|
||||
"aa"
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
|
||||
Reference in New Issue
Block a user