diff --git a/AiMessageController.java b/AiMessageController.java new file mode 100644 index 0000000..e7db4ae --- /dev/null +++ b/AiMessageController.java @@ -0,0 +1,36 @@ +package com.southern.power.grid.controller; + +import com.southern.power.grid.common.Result; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ContentDisposition; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +/** + * AI问答消息Controller + * + * @author system + * @date 2025-01-15 + */ +@RestController +@RequestMapping("/api/ai/message") +@Slf4j +public class AiMessageController { + + /** + * demo + */ + @GetMapping("/report/download/{messageId}") + public Result downloadReport() { + log.info("download report"); + return Result.success(Boolean.TRUE); + } +} + diff --git a/Result.java b/Result.java new file mode 100644 index 0000000..f324b46 --- /dev/null +++ b/Result.java @@ -0,0 +1,29 @@ +package com.southern.power.grid.common; + +import lombok.Data; + +@Data +public class Result { + private String code; + private String message; + private T data; + + public static Result success(T data) { + Result result = new Result<>(); + result.setCode("ok"); + result.setMessage("success"); + result.setData(data); + return result; + } + + public static Result error(String message) { + return error("error", message); + } + + public static Result error(String code, String message) { + Result result = new Result<>(); + result.setCode(code); + result.setMessage(message); + return result; + } +} diff --git a/SouthernPowerGridApplication.java b/SouthernPowerGridApplication.java new file mode 100644 index 0000000..0ce79f6 --- /dev/null +++ b/SouthernPowerGridApplication.java @@ -0,0 +1,19 @@ +package com.southern.power.grid; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * MyBatis-Plus测试应用启动类 + * + * @author jinshan + */ +@SpringBootApplication +public class SouthernPowerGridApplication { + + public static void main(String[] args) { + SpringApplication.run(SouthernPowerGridApplication.class, args); + } + +} + diff --git a/application.yml b/application.yml new file mode 100644 index 0000000..fee42a1 --- /dev/null +++ b/application.yml @@ -0,0 +1,33 @@ +server: + port: 8080 + +spring: + application: + name: jinshan-mybatis-test + datasource: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:13360/jinshan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true + username: jinshan + password: jinshan@1234A. + hikari: + connection-timeout: 30000 + validation-timeout: 5000 + minimum-idle: 10 + maximum-pool-size: 20 + idle-timeout: 600000 + max-lifetime: 900000 + keepaliveTime: 30000 + +# MyBatis-Plus配置 +mybatis-plus: + configuration: + map-underscore-to-camel-case: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + id-type: auto + table-underline: true + mapper-locations: classpath*:mapper/**/*.xml + type-aliases-package: com.jinshan.mybatistest.entity +