temp
This commit is contained in:
24
urbanLifelineServ/log/src/main/java/org/xyzh/log/LogApp.java
Normal file
24
urbanLifelineServ/log/src/main/java/org/xyzh/log/LogApp.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package org.xyzh.log;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDubbo // 启用 Dubbo 服务
|
||||
@ComponentScan(basePackages = {
|
||||
"org.xyzh.log", // log 模块
|
||||
"org.xyzh.common" // 公共模块
|
||||
})
|
||||
public class LogApp {
|
||||
private static final Logger logger = LoggerFactory.getLogger(LogApp.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
logger.info("======================== LogApp 启动中 =========================");
|
||||
SpringApplication.run(LogApp.class, args);
|
||||
logger.info("======================== LogApp 启动成功 =========================");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.xyzh.log.config;
|
||||
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Contact;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OpenAPI 配置类 - Log 服务
|
||||
* 配置 Swagger/OpenAPI 文档,方便 Apifox 导入接口和对象进行测试
|
||||
*
|
||||
* @author yslg
|
||||
*/
|
||||
@Configuration
|
||||
public class OpenApiConfig {
|
||||
|
||||
@Bean
|
||||
public OpenAPI logOpenAPI() {
|
||||
return new OpenAPI()
|
||||
.info(new Info()
|
||||
.title("日志服务 API 文档")
|
||||
.description("""
|
||||
日志服务接口文档,包括系统日志、登录日志等功能。
|
||||
|
||||
## 使用说明
|
||||
1. 访问 Swagger UI: http://localhost:8083/urban-lifeline/log/swagger-ui.html
|
||||
2. 访问 OpenAPI JSON: http://localhost:8083/urban-lifeline/log/v3/api-docs
|
||||
3. 在 Apifox 中导入 OpenAPI JSON 进行接口测试
|
||||
""")
|
||||
.version("1.0.0")
|
||||
.contact(new Contact()
|
||||
.name("yslg")
|
||||
.email("3401275564@qq.com"))
|
||||
.license(new License()
|
||||
.name("Apache 2.0")
|
||||
.url("https://www.apache.org/licenses/LICENSE-2.0.html")))
|
||||
.servers(List.of(
|
||||
new Server().url("http://localhost:8083/urban-lifeline/log").description("本地开发环境")
|
||||
))
|
||||
.addSecurityItem(new SecurityRequirement().addList("Bearer Authentication"))
|
||||
.components(new Components()
|
||||
.addSecuritySchemes("Bearer Authentication",
|
||||
new SecurityScheme()
|
||||
.type(SecurityScheme.Type.HTTP)
|
||||
.scheme("bearer")
|
||||
.bearerFormat("JWT")
|
||||
.description("请输入JWT Token,格式:Bearer {token}")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.xyzh.log.mapper.log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.api.log.dto.TbSysLogDTO;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @description 系统日志Mapper接口
|
||||
* @filename TbSysLogMapper.java
|
||||
* @author yslg
|
||||
* @copyright yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbSysLogMapper extends BaseMapper<TbSysLogDTO> {
|
||||
|
||||
/**
|
||||
* @description 插入系统日志
|
||||
* @param logDTO 系统日志DTO
|
||||
* @return int 插入结果
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
int insertLog(TbSysLogDTO logDTO);
|
||||
|
||||
/**
|
||||
* @description 更新系统日志
|
||||
* @param logDTO 系统日志DTO
|
||||
* @return int 更新结果
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
int updateLog(TbSysLogDTO logDTO);
|
||||
|
||||
/**
|
||||
* @description 删除系统日志
|
||||
* @param logDTO 系统日志DTO
|
||||
* @return int 删除结果
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
int deleteLog(TbSysLogDTO logDTO);
|
||||
|
||||
/**
|
||||
* @description 根据日志ID查询系统日志
|
||||
* @param logId 日志ID
|
||||
* @return TbSysLogDTO 系统日志DTO
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
TbSysLogDTO getLogById(String logId);
|
||||
|
||||
/**
|
||||
* @description 根据条件查询系统日志列表
|
||||
* @param filter 系统日志DTO
|
||||
* @return List<TbSysLogDTO> 系统日志列表
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
List<TbSysLogDTO> getLogByFilter(@Param("filter") TbSysLogDTO filter);
|
||||
|
||||
/**
|
||||
* @description 根据条件查询系统日志分页列表
|
||||
* @param filter 系统日志DTO
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbSysLogDTO> 系统日志列表
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
List<TbSysLogDTO> getLogPageByFilter(@Param("filter") TbSysLogDTO filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 根据条件查询系统日志数量
|
||||
* @param filter 系统日志DTO
|
||||
* @return int 系统日志数量
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
int getLogCount(TbSysLogDTO filter);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.xyzh.log.mapper.log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.api.log.dto.TbSysLoginLogDTO;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @description 系统登录日志Mapper接口
|
||||
* @filename TbSysLoginLogMapper.java
|
||||
* @author yslg
|
||||
* @copyright yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbSysLoginLogMapper extends BaseMapper<TbSysLoginLogDTO> {
|
||||
|
||||
/**
|
||||
* @description 插入系统登录日志
|
||||
* @param loginLogDTO 系统登录日志DTO
|
||||
* @return int 插入结果
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
int insertLoginLog(TbSysLoginLogDTO loginLogDTO);
|
||||
|
||||
/**
|
||||
* @description 更新系统登录日志
|
||||
* @param loginLogDTO 系统登录日志DTO
|
||||
* @return int 更新结果
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
int updateLoginLog(TbSysLoginLogDTO loginLogDTO);
|
||||
|
||||
/**
|
||||
* @description 删除系统登录日志
|
||||
* @param loginLogDTO 系统登录日志DTO
|
||||
* @return int 删除结果
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
int deleteLoginLog(TbSysLoginLogDTO loginLogDTO);
|
||||
|
||||
/**
|
||||
* @description 根据登录日志ID查询系统登录日志
|
||||
* @param loginLogId 登录日志ID
|
||||
* @return TbSysLoginLogDTO 系统登录日志DTO
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
TbSysLoginLogDTO getLoginLogById(String loginLogId);
|
||||
|
||||
/**
|
||||
* @description 根据条件查询系统登录日志列表
|
||||
* @param filter 系统登录日志DTO
|
||||
* @return List<TbSysLoginLogDTO> 系统登录日志列表
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
List<TbSysLoginLogDTO> getLoginLogByFilter(@Param("filter") TbSysLoginLogDTO filter);
|
||||
|
||||
/**
|
||||
* @description 根据条件查询系统登录日志分页列表
|
||||
* @param filter 系统登录日志DTO
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbSysLoginLogDTO> 系统登录日志列表
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
List<TbSysLoginLogDTO> getLoginLogPageByFilter(@Param("filter") TbSysLoginLogDTO filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 根据条件查询系统登录日志数量
|
||||
* @param filter 系统登录日志DTO
|
||||
* @return int 系统登录日志数量
|
||||
* @author yslg
|
||||
* @since 2025-11-07
|
||||
*/
|
||||
int getLoginLogCount(TbSysLoginLogDTO filter);
|
||||
}
|
||||
|
||||
36
urbanLifelineServ/log/src/main/resources/application.yml
Normal file
36
urbanLifelineServ/log/src/main/resources/application.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
server:
|
||||
port: 8083
|
||||
servlet:
|
||||
context-path: /urban-lifeline/log
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
# 启用 API 文档
|
||||
enabled: true
|
||||
# API 文档路径
|
||||
path: /v3/api-docs
|
||||
swagger-ui:
|
||||
# 启用 Swagger UI
|
||||
enabled: true
|
||||
# Swagger UI 路径
|
||||
path: /swagger-ui.html
|
||||
# 尝试请求超时时间(毫秒)
|
||||
try-it-out-enabled: true
|
||||
# 显示请求执行时间
|
||||
show-common-extensions: true
|
||||
# 显示请求头部
|
||||
show-extensions: true
|
||||
# 显示模型
|
||||
show-request-duration: true
|
||||
# 过滤开关
|
||||
filter: true
|
||||
# 标签排序
|
||||
tags-sorter: alpha
|
||||
# 操作排序
|
||||
operations-sorter: alpha
|
||||
# 分组配置(可选)
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
display-name: '日志服务 API'
|
||||
paths-to-match: '/**'
|
||||
|
||||
Reference in New Issue
Block a user