增加系统菜单
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -9,10 +9,10 @@
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.cst</groupId>
|
||||
<artifactId>Langchain4j-heima</artifactId>
|
||||
<artifactId>Langchain4j-rj</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>Langchain4j-heima20250803</name>
|
||||
<description>Langchain4j-heima20250803</description>
|
||||
<name>Langchain4j-rj</name>
|
||||
<description>Langchain4j-rj20250803</description>
|
||||
<url/>
|
||||
<licenses>
|
||||
<license/>
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
//http://localhost:8080/swagger-ui/index.html?urls.primaryName=public-api
|
||||
//http://101.43.230.106:8180/aismartcard/aicardbackend
|
||||
@MapperScan("com.rj.mapper")
|
||||
@SpringBootApplication
|
||||
public class Langchain4jHeima20250803Application {
|
||||
|
||||
94
src/main/java/com/rj/common/Result.java
Normal file
94
src/main/java/com/rj/common/Result.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package com.rj.common;
|
||||
|
||||
|
||||
/**
|
||||
* 返回值的标准格式
|
||||
*/
|
||||
public class Result {
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private int code=0;
|
||||
|
||||
/**
|
||||
* 消息提示
|
||||
*/
|
||||
private String msg="OK";
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
private Object data;
|
||||
|
||||
/**
|
||||
* 成功 不返回数据
|
||||
*/
|
||||
public static Result ok(){
|
||||
return new Result();
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回自定义消息
|
||||
*/
|
||||
public static Result error(String msg){
|
||||
return new Result(-1,msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回系统异常消息
|
||||
*/
|
||||
public static Result error(){
|
||||
return new Result(-1,"系统异常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回数据
|
||||
*/
|
||||
public static Result ok(Object data){
|
||||
return new Result(data);
|
||||
}
|
||||
|
||||
public Result(int code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Result() {
|
||||
}
|
||||
|
||||
public Result(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Result{" +
|
||||
"code=" + code +
|
||||
", msg='" + msg + '\'' +
|
||||
", data=" + data +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
74
src/main/java/com/rj/entity/sys/MetaTypeHandler.java
Normal file
74
src/main/java/com/rj/entity/sys/MetaTypeHandler.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package com.rj.entity.sys;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MetaTypeHandler extends BaseTypeHandler<Meta> {
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, Meta parameter, JdbcType jdbcType) throws SQLException {
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
String json = null;
|
||||
try {
|
||||
json = om.writeValueAsString(parameter);
|
||||
if(Objects.nonNull(json)){
|
||||
ps.setString(i,json);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Meta getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
String json = rs.getString(columnName);
|
||||
Meta meta = null;
|
||||
try {
|
||||
if(Objects.nonNull(json)){
|
||||
meta = om.readValue(json, Meta.class);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Meta getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
String json = rs.getString(columnIndex);
|
||||
Meta meta = null;
|
||||
try {
|
||||
if(Objects.nonNull(json)){
|
||||
meta = om.readValue(json, Meta.class);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Meta getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
String json = cs.getString(columnIndex);
|
||||
Meta meta = null;
|
||||
try {
|
||||
if(Objects.nonNull(json)){
|
||||
meta = om.readValue(json, Meta.class);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user