add 添加自增主键,批量新增数据,接口定义
parent
62af5a8f17
commit
f1d181592f
@ -1 +0,0 @@
|
||||
custom: http://doc.ruoyi.vip/tagApi-vue/other/donate.html
|
@ -0,0 +1,70 @@
|
||||
package hw.tagApi.service.constant;
|
||||
|
||||
/**
|
||||
* API常量类
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
/**
|
||||
* 数据库状态
|
||||
*/
|
||||
public static final String DATA_STATUS = "00";
|
||||
/**
|
||||
* 数据导入
|
||||
*/
|
||||
public static final String DATA_IMPORT = "10";
|
||||
|
||||
/**
|
||||
* 数据查询
|
||||
*/
|
||||
public static final String DATA_QUERY = "20";
|
||||
/**
|
||||
* 数据导出
|
||||
*/
|
||||
public static final String DATA_EXPORT = "30";
|
||||
|
||||
/**
|
||||
* 导入中
|
||||
*/
|
||||
public static final String IMPORTING = "导入中";
|
||||
/**
|
||||
* 系统错误
|
||||
*/
|
||||
public static final String SYSTEM_ERROR = "系统错误";
|
||||
|
||||
/**
|
||||
* 搜索中
|
||||
*/
|
||||
public static final String SEARCHING = "搜索中";
|
||||
/**
|
||||
* 搜索超时
|
||||
*/
|
||||
public static final String SEARCH_TIMEOUT = "搜索超时";
|
||||
|
||||
/**
|
||||
* 导出中
|
||||
*/
|
||||
public static final String EXPORTING = "导出中";
|
||||
|
||||
|
||||
public static final String SUCCESS = "SUCCESS";
|
||||
public static final String FAILED = "FAILED";
|
||||
|
||||
public static class ImportStatus {
|
||||
public static final String IMPORT_SUCCESS = "IMPORT_SUCCESS";
|
||||
public static final String IMPORT_FAILED = "IMPORT_FAILED";
|
||||
}
|
||||
|
||||
public static class ExportStatus {
|
||||
public static final String EXPORT_SUCCESS = "EXPORT_SUCCESS";
|
||||
public static final String EXPORT_FAILED = "EXPORT_FAILED";
|
||||
}
|
||||
|
||||
public static class SearchStatus {
|
||||
public static final String SEARCH_SUCCESS = "SEARCH_SUCCESS";
|
||||
public static final String NO_RECORD = "NO_RECORD";
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package hw.tagApi.service.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* API请求内容对象
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
public class ApiContent {
|
||||
|
||||
/** 字段集合 */
|
||||
@JsonProperty("fields")
|
||||
private Map<String, String> fields;
|
||||
|
||||
/** 记录ID */
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
public Map<String, String> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setFields(Map<String, String> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiContent{" +
|
||||
"fields=" + fields +
|
||||
", id='" + id + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package hw.tagApi.service.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* API请求对象
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
public class ApiRequest {
|
||||
|
||||
/** 功能代码 */
|
||||
@JsonProperty("CASE")
|
||||
private String CASE;
|
||||
|
||||
/** 请求内容 */
|
||||
@JsonProperty("CONTENT")
|
||||
private List<ApiContent> CONTENT;
|
||||
|
||||
public String getCASE() {
|
||||
return CASE;
|
||||
}
|
||||
|
||||
public void setCASE(String CASE) {
|
||||
this.CASE = CASE;
|
||||
}
|
||||
|
||||
public List<ApiContent> getCONTENT() {
|
||||
return CONTENT;
|
||||
}
|
||||
|
||||
public void setCONTENT(List<ApiContent> CONTENT) {
|
||||
this.CONTENT = CONTENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiRequest{" +
|
||||
"CASE='" + CASE + '\'' +
|
||||
", CONTENT=" + CONTENT +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package hw.tagApi.service.service;
|
||||
|
||||
/**
|
||||
* 云文档服务接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
public interface IKDocsService {
|
||||
|
||||
/**
|
||||
* 获取系统状态
|
||||
*
|
||||
* @return 系统状态
|
||||
*/
|
||||
String getSystemStatus();
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param data 待导入的数据
|
||||
* @return 导入结果
|
||||
*/
|
||||
String importData(String data);
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 数据ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
String deleteData(String id);
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
String queryData(String query);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param query 导出条件
|
||||
* @return 导出结果
|
||||
*/
|
||||
String exportData(String query);
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package hw.tagApi.service.service.impl;
|
||||
|
||||
import hw.tagApi.service.service.IKDocsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import hw.tagApi.service.constant.ApiConstants;
|
||||
import hw.tagApi.service.mapper.HwTagRecordMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 云文档服务实现类
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
@Service
|
||||
public class KDocsServiceImpl implements IKDocsService
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(KDocsServiceImpl.class);
|
||||
|
||||
private HwTagRecordMapper hwTagRecordMapper;
|
||||
|
||||
@Override
|
||||
public String getSystemStatus() {
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("CASE", ApiConstants.DATA_IMPORT);
|
||||
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
|
||||
Map<String, Object> statusItem = new HashMap<>();
|
||||
Map<String, String> statusFields = new HashMap<>();
|
||||
statusFields.put("导入状态", ApiConstants.IMPORTING);
|
||||
statusItem.put("fields", statusFields);
|
||||
statusItem.put("id", "16");
|
||||
result.add(statusItem);
|
||||
|
||||
Map<String, Object> errorItem = new HashMap<>();
|
||||
Map<String, String> errorFields = new HashMap<>();
|
||||
errorFields.put("导入模式", ApiConstants.SYSTEM_ERROR);
|
||||
errorFields.put("情况说明", "");
|
||||
errorItem.put("fields", errorFields);
|
||||
errorItem.put("id", "s5");
|
||||
result.add(errorItem);
|
||||
|
||||
response.put("RESULT", result);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importData(String data) {
|
||||
// TODO: 实现数据导入逻辑
|
||||
return getSystemStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String deleteData(String id) {
|
||||
// TODO: 实现数据删除逻辑
|
||||
return getSystemStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryData(String query) {
|
||||
// TODO: 实现数据查询逻辑
|
||||
return getSystemStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String exportData(String query) {
|
||||
// TODO: 实现数据导出逻辑
|
||||
return getSystemStatus();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue