Browse Source

修改批量方法信息

master
赵鹏 3 weeks ago
parent
commit
e18c82f784
  1. 13
      ReZero/SuperAPI/Application/App.cs
  2. 63
      ReZero/SuperAPI/MethodGeneratorAPI/MethodGeneratorAPI.cs
  3. 6
      SuperAPI/Controllers/StdObjectMappingController.cs
  4. 12
      SuperAPI/Program.cs
  5. 352
      SuperAPI/wwwroot/rezero/default_ui/add_filed.html
  6. 2
      medical.jzyb.entity/STD/STD_METHOD_CONFIG.cs
  7. 2
      medical.jzyb.entity/STD/STD_OBJECT_ASSEMBLY.cs
  8. 45
      medical.jzyb.entity/STD/STD_OBJECT_MAPPING.cs
  9. 42
      medical.transfomer.business/std_object_mapping_business.cs

13
ReZero/SuperAPI/Application/App.cs

@ -95,6 +95,19 @@ namespace ReZero.SuperAPI
{ {
ReZero.DependencyInjection.DependencyResolver.GetLogger().LogInformation(UtilMethods.GetNativeSql(s, p)); ReZero.DependencyInjection.DependencyResolver.GetLogger().LogInformation(UtilMethods.GetNativeSql(s, p));
}; };
// 添加Oracle批量操作配置
if (zeroDatabaseInfo.DbType == DbType.Oracle)
{
db.Aop.OnError = (ex) =>
{
if (ex.Message.Contains("bulkcopy no support identity"))
{
ReZero.DependencyInjection.DependencyResolver.GetLogger().LogWarning("Oracle批量操作遇到identity问题,使用单条插入模式");
}
};
db.Ado.CommandTimeOut = 120; // 增加超时时间
}
}); });
} }
/// <summary> /// <summary>

63
ReZero/SuperAPI/MethodGeneratorAPI/MethodGeneratorAPI.cs

@ -173,7 +173,19 @@ namespace ReZero.SuperAPI
var type = argsTypes![index]; var type = argsTypes![index];
if (IsObject(value, type)) if (IsObject(value, type))
{ {
value = JsonConvert.DeserializeObject(value + "", type); try
{
var valueStr = value?.ToString();
if (!string.IsNullOrEmpty(valueStr))
{
value = JsonConvert.DeserializeObject(valueStr, type);
}
}
catch (JsonException ex)
{
throw new Exception(TextHandler.GetCommonText(p.Name + "JSON解析错误: " + ex.Message,
p.Name + " JSON parsing error: " + ex.Message));
}
} }
} }
try try
@ -181,9 +193,10 @@ namespace ReZero.SuperAPI
value = ConvetEmptyValue(p.ParameterType, value); value = ConvetEmptyValue(p.ParameterType, value);
value = UtilMethods.ChangeType2(value, p.ParameterType); value = UtilMethods.ChangeType2(value, p.ParameterType);
} }
catch (Exception) catch (Exception ex)
{ {
throw new Exception(TextHandler.GetCommonText(p.Name+"参数类型不匹配 "+value, p.Name + " Parameter type does not match " + value)); throw new Exception(TextHandler.GetCommonText(p.Name + "参数类型不匹配 " + value + ", 错误: " + ex.Message,
p.Name + " Parameter type does not match " + value + ", Error: " + ex.Message));
} }
parameters[p.Position] = value!; parameters[p.Position] = value!;
index++; index++;
@ -198,6 +211,36 @@ namespace ReZero.SuperAPI
value = null; value = null;
} }
// 处理JSON数组或对象
var strValue = value?.ToString()?.Trim();
if (strValue != null)
{
if ((type.IsArray || type.FullName.StartsWith("System.Collections.Generic.List")) &&
strValue.StartsWith("[") && strValue.EndsWith("]"))
{
try
{
return JsonConvert.DeserializeObject(strValue, type);
}
catch
{
// 保持原始值
}
}
else if (!type.FullName.StartsWith("System.") &&
strValue.StartsWith("{") && strValue.EndsWith("}"))
{
try
{
return JsonConvert.DeserializeObject(strValue, type);
}
catch
{
// 保持原始值
}
}
}
return value; return value;
} }
private static async Task<object> GetTask(Task task) private static async Task<object> GetTask(Task task)
@ -209,7 +252,19 @@ namespace ReZero.SuperAPI
} }
private static bool IsObject(object? value, Type type) private static bool IsObject(object? value, Type type)
{ {
return (type.IsArray || type.FullName.StartsWith("System.Collections.Generic.List")) && value != null; if ((type.IsArray || type.FullName.StartsWith("System.Collections.Generic.List")) && value != null)
{
return true;
}
// 检查值是否为JSON数组字符串
var valueStr = value?.ToString()?.Trim();
if (valueStr != null && valueStr.StartsWith("[") && valueStr.EndsWith("]"))
{
return true;
}
return false;
} }
} }
} }

6
SuperAPI/Controllers/StdObjectMappingController.cs

@ -10,12 +10,12 @@ namespace medical.insu.transfomer.Controllers
public class StdObjectMappingController public class StdObjectMappingController
{ {
[DI] [DI]
public std_object_mapping_business _StdObjectMappingBusiness { get; set; } public std_object_mapping_business? std_object_mapping_business { get; set; }
[ApiMethod("批量插入映射关系")] [ApiMethod("批量插入映射关系")]
public int insertList([FromBody]List<STD_OBJECT_MAPPING> list) public int insertList(List<STD_OBJECT_MAPPING> list)
{ {
return _StdObjectMappingBusiness.ListInsert(list); return std_object_mapping_business!.ListInsert(list);
} }
} }
} }

12
SuperAPI/Program.cs

@ -19,7 +19,7 @@ builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(); builder.Services.AddSwaggerGen();
//注册db: 这个不写代码可以不注册 //注册db: 这个不写代码可以不注册
builder.Services.AddScoped<ISqlSugarClient>(it => builder.Services.AddScoped<ISqlSugarClient>(it =>
{ {
var config = ApiConfiguration.GetJsonValue<ReZeroJson>("ReZero"); var config = ApiConfiguration.GetJsonValue<ReZeroJson>("ReZero");
@ -33,21 +33,21 @@ builder.Services.AddScoped<ISqlSugarClient>(it =>
//builder.Services.AddCors(); //builder.Services.AddCors();
//注册ReZero.Api //注册ReZero.Api
builder.Services.AddReZeroServices(api => builder.Services.AddReZeroServices(api =>
{ {
//有重载可换json文件 //有重载可换json文件
var apiObj = SuperAPIOptions.GetOptions(); var apiObj = SuperAPIOptions.GetOptions();
//IOC业务等所有需要的所有集程集 //IOC业务等所有需要的所有集程集
var assemblyList = Assembly.GetExecutingAssembly() var assemblyList = Assembly.GetExecutingAssembly()
.GetAllDependentAssemblies(it => it.Contains("medical.insu.transfomer")) .GetAllDependentAssemblies(it => it.Contains("medical.insu.transfomer") || it.Contains("medical.transfomer"))
.ToArray(); .ToArray();
apiObj!.DependencyInjectionOptions = new DependencyInjectionOptions(assemblyList); apiObj!.DependencyInjectionOptions = new DependencyInjectionOptions(assemblyList);
//启用超级API //启用超级API
api.EnableSuperApi(apiObj); api.EnableSuperApi(apiObj);
}); });

352
SuperAPI/wwwroot/rezero/default_ui/add_filed.html

@ -10,24 +10,23 @@
flex-flow: column nowrap; flex-flow: column nowrap;
gap: 20px; gap: 20px;
} }
.filed-container::before { .filed-container::before {
content: ''; content: "";
position: absolute; position: absolute;
top: 0; top: 0;
left: 50%; left: 50%;
width: 2px; width: 2px;
height: 100%; height: 100%;
background-image: linear-gradient( background-image: linear-gradient(to bottom, #e6f3ff, #fff7e6);
to bottom,
#e6f3ff,
#fff7e6
);
border-radius: 50%; border-radius: 50%;
} }
.info-container { .info-container {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.info-item { .info-item {
flex: 1; flex: 1;
display: flex; display: flex;
@ -36,15 +35,18 @@
flex-flow: column; flex-flow: column;
gap: 20px; gap: 20px;
} }
.footer { .footer {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.footer-item { .footer-item {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10px; gap: 10px;
} }
.info-item-title { .info-item-title {
display: flex; display: flex;
align-items: center; align-items: center;
@ -53,6 +55,7 @@
display: flex; display: flex;
gap: 10px; gap: 10px;
} }
.info-item-upload { .info-item-upload {
display: flex; display: flex;
align-items: center; align-items: center;
@ -63,11 +66,13 @@
color: #419ff8; color: #419ff8;
border-bottom: 1px solid #419ff8; border-bottom: 1px solid #419ff8;
} }
.info-item-input-container { .info-item-input-container {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 5px; gap: 5px;
} }
.info-item-input { .info-item-input {
width: 200px; width: 200px;
height: 32px; height: 32px;
@ -80,56 +85,66 @@
outline: none; outline: none;
box-sizing: border-box; box-sizing: border-box;
} }
.info-form-container { .info-form-container {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
align-items: center; align-items: center;
gap: 10px; gap: 10px;
} }
.table { .table {
width: 100%; width: 100%;
table-layout: fixed; table-layout: fixed;
border-collapse: collapse; border-collapse: collapse;
} }
.table th, .table th,
.table td { .table td {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.table th:nth-child(1), .table th:nth-child(1),
.table td:nth-child(1) { .table td:nth-child(1) {
width: 70px; width: 70px;
} }
.table th:nth-child(2), .table th:nth-child(2),
.table td:nth-child(2), .table td:nth-child(2),
.table th:nth-child(6), .table th:nth-child(6),
.table td:nth-child(6) { .table td:nth-child(6) {
width: 125px; width: 125px;
} }
.table th:nth-child(3), .table th:nth-child(3),
.table td:nth-child(3), .table td:nth-child(3),
.table th:nth-child(7), .table th:nth-child(7),
.table td:nth-child(7) { .table td:nth-child(7) {
width: 120px; width: 120px;
} }
.table th:nth-child(4), .table th:nth-child(4),
.table td:nth-child(4), .table td:nth-child(4),
.table th:nth-child(8), .table th:nth-child(8),
.table td:nth-child(8) { .table td:nth-child(8) {
width: 100px; width: 100px;
} }
.table th:nth-child(5), .table th:nth-child(5),
.table td:nth-child(5), .table td:nth-child(5),
.table th:nth-child(9), .table th:nth-child(9),
.table td:nth-child(9) { .table td:nth-child(9) {
width: 100px; width: 100px;
} }
.table th:nth-child(10), .table th:nth-child(10),
.table td:nth-child(10) { .table td:nth-child(10) {
width: 70px; width: 70px;
text-align: center; text-align: center;
} }
.footer-item-button { .footer-item-button {
display: flex; display: flex;
align-items: center; align-items: center;
@ -143,12 +158,14 @@
color: #333; color: #333;
gap: 5px; gap: 5px;
} }
.table-row { .table-row {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.local-park, .local-park,
.third-park { .third-park {
width: 100%; width: 100%;
@ -158,10 +175,12 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.local-park th, .local-park th,
.third-park th { .third-park th {
flex: 1; flex: 1;
} }
.table-item-input { .table-item-input {
width: 100%; width: 100%;
padding: 8px 12px; padding: 8px 12px;
@ -185,6 +204,7 @@
color: #c0c4cc; color: #c0c4cc;
} }
} }
.table-item-select { .table-item-select {
width: 100%; width: 100%;
padding: 8px 12px; padding: 8px 12px;
@ -195,6 +215,7 @@
outline: none; outline: none;
box-sizing: border-box; box-sizing: border-box;
border: none; border: none;
&:disabled { &:disabled {
background-color: #f5f7fa; background-color: #f5f7fa;
border-color: #e4e7ed; border-color: #e4e7ed;
@ -206,6 +227,7 @@
color: #c0c4cc; color: #c0c4cc;
} }
} }
.table-item-button { .table-item-button {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
@ -219,6 +241,7 @@
transition: all 0.2s ease; transition: all 0.2s ease;
height: 32px; height: 32px;
width: 32px; width: 32px;
&:hover { &:hover {
background-color: #f2f6fc; background-color: #f2f6fc;
color: #409eff; color: #409eff;
@ -232,7 +255,7 @@
font-size: 20px; font-size: 20px;
} }
&[title='保存'] { &[title="保存"] {
color: #67c23a; color: #67c23a;
&:hover { &:hover {
@ -240,7 +263,7 @@
} }
} }
&[title='取消'] { &[title="取消"] {
color: #909399; color: #909399;
&:hover { &:hover {
@ -248,7 +271,7 @@
} }
} }
&[title='删除'] { &[title="删除"] {
color: #f56c6c; color: #f56c6c;
&:hover { &:hover {
@ -256,29 +279,21 @@
} }
} }
} }
.info-item-upload-name { .info-item-upload-name {
color: #01c853; color: #01c853;
} }
</style> </style>
<div <div id="apibox" class="card">
id="apibox"
class="card"
>
<section class="filed-container"> <section class="filed-container">
<section class="info-container"> <section class="info-container">
<section class="info-item"> <section class="info-item">
<section class="info-item-title"> <section class="info-item-title">
本地表 本地表
<section <section class="info-item-upload-name" v-show="localJosnName">
class="info-item-upload-name"
v-show="localJosnName"
>
{{`(${localJosnName})`}} {{`(${localJosnName})`}}
</section> </section>
<section <section class="info-item-upload" @click="uploadLocalFile">
class="info-item-upload"
@click="uploadLocalFile"
>
<input <input
type="file" type="file"
style="opacity: 0; display: none" style="opacity: 0; display: none"
@ -311,16 +326,10 @@
<section class="info-item"> <section class="info-item">
<section class="info-item-title"> <section class="info-item-title">
三方表 三方表
<section <section class="info-item-upload-name" v-show="thirdJsonName">
class="info-item-upload-name"
v-show="thirdJsonName"
>
({{thirdJsonName}}) ({{thirdJsonName}})
</section> </section>
<section <section class="info-item-upload" @click="uploadThirdFile">
class="info-item-upload"
@click="uploadThirdFile"
>
<input <input
type="file" type="file"
style="opacity: 0; display: none" style="opacity: 0; display: none"
@ -356,63 +365,29 @@
<tr> <tr>
<th>序号</th> <th>序号</th>
<th style="background-color: #e6f3ff">字段名</th> <th style="background-color: #e6f3ff">字段名</th>
<th style="background-color: #e6f3ff"> <th style="background-color: #e6f3ff">字段注释</th>
字段注释 <th style="background-color: #e6f3ff">字段类型</th>
</th> <th style="background-color: #e6f3ff">字典名称</th>
<th style="background-color: #e6f3ff">
字段类型
</th>
<th style="background-color: #e6f3ff">
字典名称
</th>
<th style="background-color: #fff7e6">字段名</th> <th style="background-color: #fff7e6">字段名</th>
<th style="background-color: #fff7e6"> <th style="background-color: #fff7e6">字段注释</th>
字段注释 <th style="background-color: #fff7e6">字段类型</th>
</th> <th style="background-color: #fff7e6">字典名称</th>
<th style="background-color: #fff7e6">
字段类型
</th>
<th style="background-color: #fff7e6">
字典名称
</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr <tr v-for="(item, index) in data" :key="index">
v-for="(item, index) in data"
:key="index"
>
<td style="width: 150px">{{index + 1}}</td> <td style="width: 150px">{{index + 1}}</td>
<td <td style="background-color: #f5f9ff; position: relative">
style="
background-color: #f5f9ff;
position: relative;
"
>
{{item.SYSTEM_FIELD}} {{item.SYSTEM_FIELD}}
</td> </td>
<td style="background-color: #f5f9ff"> <td style="background-color: #f5f9ff">{{item.SYSTEM_NAME}}</td>
{{item.SYSTEM_NAME}} <td style="background-color: #f5f9ff">{{item.SYSTEM_FIELD_TYPE}}</td>
</td> <td style="background-color: #f5f9ff">{{item.SYSTEM_DICT_NAME}}</td>
<td style="background-color: #f5f9ff"> <td style="background-color: #fffbf2">{{item.INTERFACE_FIELD}}</td>
{{item.SYSTEM_FIELD_TYPE}} <td style="background-color: #fffbf2">{{item.INTERFACE_NAME}}</td>
</td> <td style="background-color: #fffbf2">{{item.OBJECT_FIELD_TYPE}}</td>
<td style="background-color: #f5f9ff"> <td style="background-color: #fffbf2">{{item.OBJECT_DICT_NAME}}</td>
{{item.SYSTEM_DICT_NAME}}
</td>
<td style="background-color: #fffbf2">
{{item.INTERFACE_FIELD}}
</td>
<td style="background-color: #fffbf2">
{{item.INTERFACE_NAME}}
</td>
<td style="background-color: #fffbf2">
{{item.OBJECT_FIELD_TYPE}}
</td>
<td style="background-color: #fffbf2">
{{item.OBJECT_DICT_NAME}}
</td>
<td> <td>
<button <button
@click="deleteField(index)" @click="deleteField(index)"
@ -425,12 +400,7 @@
</tr> </tr>
<tr v-show="isEditing"> <tr v-show="isEditing">
<td style="width: 150px">{{data.length + 1}}</td> <td style="width: 150px">{{data.length + 1}}</td>
<td <td style="background-color: #f5f9ff; position: relative">
style="
background-color: #f5f9ff;
position: relative;
"
>
<input <input
v-model="submitData.SYSTEM_FIELD" v-model="submitData.SYSTEM_FIELD"
class="table-item-select" class="table-item-select"
@ -498,12 +468,7 @@
:style="{display: submitData.SYSTEM_FIELD_TYPE == 'dict' ? 'block' : 'none'}" :style="{display: submitData.SYSTEM_FIELD_TYPE == 'dict' ? 'block' : 'none'}"
/> />
</td> </td>
<td <td style="background-color: #fffbf2; position: relative">
style="
background-color: #fffbf2;
position: relative;
"
>
<input <input
v-model="submitData.INTERFACE_FIELD" v-model="submitData.INTERFACE_FIELD"
class="table-item-select" class="table-item-select"
@ -621,7 +586,7 @@
</div> </div>
<script> <script>
var vueObj = new Vue({ var vueObj = new Vue({
el: '#apibox', el: "#apibox",
data() { data() {
return { return {
dict: { dict: {
@ -630,167 +595,160 @@
isEditing: true, isEditing: true,
data: [ data: [
{ {
SYSTEM_NAME: '测试1', SYSTEM_NAME: "测试1",
SYSTEM_FIELD: 'test1', SYSTEM_FIELD: "test1",
INTERFACE_NAME: '测试2', INTERFACE_NAME: "测试2",
INTERFACE_FIELD: 'test2', INTERFACE_FIELD: "test2",
SYSTEM_FIELD_TYPE: 'value', SYSTEM_FIELD_TYPE: "value",
SYSTEM_DICT_NAME: '', SYSTEM_DICT_NAME: "",
OBJECT_FIELD_TYPE: 'value', OBJECT_FIELD_TYPE: "value",
OBJECT_DICT_NAME: '', OBJECT_DICT_NAME: "",
}, },
{ {
SYSTEM_NAME: '测试2', SYSTEM_NAME: "测试2",
SYSTEM_FIELD: 'test2', SYSTEM_FIELD: "test2",
INTERFACE_NAME: '测试3', INTERFACE_NAME: "测试3",
INTERFACE_FIELD: 'test3', INTERFACE_FIELD: "test3",
SYSTEM_FIELD_TYPE: 'value', SYSTEM_FIELD_TYPE: "value",
SYSTEM_DICT_NAME: '', SYSTEM_DICT_NAME: "",
OBJECT_FIELD_TYPE: 'value', OBJECT_FIELD_TYPE: "value",
OBJECT_DICT_NAME: '', OBJECT_DICT_NAME: "",
}, },
], ],
localJsonData: {}, localJsonData: {},
localJosnName: '', localJosnName: "",
thirdJsonData: {}, thirdJsonData: {},
thirdJsonName: '', thirdJsonName: "",
submitData: { submitData: {
SYSTEM_NAME: '', SYSTEM_NAME: "",
SYSTEM_FIELD: '', SYSTEM_FIELD: "",
INTERFACE_NAME: '', INTERFACE_NAME: "",
INTERFACE_FIELD: '', INTERFACE_FIELD: "",
SYSTEM_FIELD_TYPE: 'value', SYSTEM_FIELD_TYPE: "value",
SYSTEM_DICT_NAME: '', SYSTEM_DICT_NAME: "",
OBJECT_FIELD_TYPE: 'value', OBJECT_FIELD_TYPE: "value",
OBJECT_DICT_NAME: '', OBJECT_DICT_NAME: "",
}, },
cachesData: { cachesData: {
ID: 0.0,
OBJECT_TABLE_NAME: 'test2', OBJECT_TABLE_NAME: "test2",
OBJECT_TABLE_CNNAME: '测试2', OBJECT_TABLE_CNNAME: "测试2",
SYSTEM_TABLE_CNNAME: '测试1', SYSTEM_TABLE_CNNAME: "测试1",
SYSTEM_TABLE_NAME: 'test1', SYSTEM_TABLE_NAME: "test1",
}, },
} };
}, },
created() { created() {
this.getDictOption() this.getDictOption();
}, },
mounted() {}, mounted() {},
methods: { methods: {
getDictOption() { getDictOption() {
axios axios
.get( .get("/dict_data/simpleList?type=std_filed_type", jwHeader)
'/dict_data/simpleList?type=std_filed_type', .then((res) => {
jwHeader this.dict.filedType = res.data;
) });
.then(res => {
this.dict.filedType = res.data
})
}, },
uploadLocalFile() { uploadLocalFile() {
document.getElementById('localFile').click() document.getElementById("localFile").click();
document.getElementById('localFile').onchange = document.getElementById("localFile").onchange = () => {
() => { const file = document.getElementById("localFile").files[0];
const file = this.localJosnName = file.name;
document.getElementById('localFile').files[0] const reader = new FileReader();
this.localJosnName = file.name reader.readAsText(file);
const reader = new FileReader()
reader.readAsText(file)
reader.onload = () => { reader.onload = () => {
this.localJsonData = JSON.parse(reader.result) this.localJsonData = JSON.parse(reader.result);
} };
} };
}, },
uploadThirdFile() { uploadThirdFile() {
document.getElementById('thirdFile').click() document.getElementById("thirdFile").click();
document.getElementById('thirdFile').onchange = document.getElementById("thirdFile").onchange = () => {
() => { const file = document.getElementById("thirdFile").files[0];
const file = this.thirdJsonName = file.name;
document.getElementById('thirdFile').files[0] const reader = new FileReader();
this.thirdJsonName = file.name reader.readAsText(file);
const reader = new FileReader()
reader.readAsText(file)
reader.onload = () => { reader.onload = () => {
this.thirdJsonData = JSON.parse(reader.result) this.thirdJsonData = JSON.parse(reader.result);
} };
} };
}, },
addNewField() { addNewField() {
this.submitData = { this.submitData = {
SYSTEM_NAME: '', SYSTEM_NAME: "",
SYSTEM_FIELD: '', SYSTEM_FIELD: "",
INTERFACE_NAME: '', INTERFACE_NAME: "",
INTERFACE_FIELD: '', INTERFACE_FIELD: "",
SYSTEM_FIELD_TYPE: 'value', SYSTEM_FIELD_TYPE: "value",
SYSTEM_DICT_NAME: '', SYSTEM_DICT_NAME: "",
OBJECT_FIELD_TYPE: 'value', OBJECT_FIELD_TYPE: "value",
OBJECT_DICT_NAME: '', OBJECT_DICT_NAME: "",
} };
this.isEditing = true this.isEditing = true;
}, },
saveField(index) { saveField(index) {
this.data.push(this.submitData) this.data.push(this.submitData);
this.isEditing = false this.isEditing = false;
}, },
cancelField(index) { cancelField(index) {
this.submitData = { this.submitData = {
SYSTEM_NAME: '', SYSTEM_NAME: "",
SYSTEM_FIELD: '', SYSTEM_FIELD: "",
INTERFACE_NAME: '', INTERFACE_NAME: "",
INTERFACE_FIELD: '', INTERFACE_FIELD: "",
SYSTEM_FIELD_TYPE: 'value', SYSTEM_FIELD_TYPE: "value",
SYSTEM_DICT_NAME: '', SYSTEM_DICT_NAME: "",
OBJECT_FIELD_TYPE: 'value', OBJECT_FIELD_TYPE: "value",
OBJECT_DICT_NAME: '', OBJECT_DICT_NAME: "",
} };
this.isEditing = false this.isEditing = false;
}, },
deleteField(index) { deleteField(index) {
this.data.splice(index, 1) this.data.splice(index, 1);
}, },
thridChange(e) { thridChange(e) {
this.submitData.INTERFACE_FIELD = e.target.value this.submitData.INTERFACE_FIELD = e.target.value;
}, },
localChange(e) { localChange(e) {
this.submitData.SYSTEM_FIELD = e.target.value this.submitData.SYSTEM_FIELD = e.target.value;
}, },
saveAll() { saveAll() {
if ( if (
this.cachesData.SYSTEM_TABLE_NAME === '' || this.cachesData.SYSTEM_TABLE_NAME === "" ||
this.cachesData.OBJECT_TABLE_NAME === '' this.cachesData.OBJECT_TABLE_NAME === ""
) { ) {
tools.alert('请输入表名') tools.alert("请输入表名");
return return;
} }
if (this.data.length === 0) { if (this.data.length === 0) {
tools.alert('请输入字段') tools.alert("请输入字段");
return return;
} }
const data = this.data.map(i => { const data = this.data.map((i) => {
return { return {
...this.cachesData, ...this.cachesData,
...i, ...i,
} };
}) });
console.log(data) console.log(data);
axios axios
.post( .post(
`/std_filed/createBatch`, `/api/200100/stdobjectmappingcontroller/insertlist`,
{ Data: JSON.stringify(data) }, { list: data },
jwHeader jwHeader
) )
.then(res => { .then((res) => {
tools.highlightErrorFields(res.data) tools.highlightErrorFields(res.data);
// window.location.href = './std_filed_map.html' // window.location.href = './std_filed_map.html'
}) })
.catch(error => { .catch((error) => {
tools.alert(error.message) tools.alert(error.message);
}) });
}, },
cancelAll() { cancelAll() {
window.location.href = './std_filed_map.html' window.location.href = "./std_filed_map.html";
}, },
}, },
}) });
</script> </script>

2
medical.jzyb.entity/STD/STD_METHOD_CONFIG.cs

@ -19,7 +19,7 @@ namespace medical.transfomer.entity
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName="METHOD_ID" ,IsPrimaryKey = true) ] [SugarColumn(ColumnName="METHOD_ID" ,IsPrimaryKey = true) ]
public string METHOD_ID { get; set; } = null!; public string? METHOD_ID { get; set; } = null!;
/// <summary> /// <summary>
/// 备 注:方法名称(需符合医保规范) /// 备 注:方法名称(需符合医保规范)

2
medical.jzyb.entity/STD/STD_OBJECT_ASSEMBLY.cs

@ -60,7 +60,7 @@ namespace medical.transfomer.entity
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName="ID" ,IsPrimaryKey = true,IsIdentity = true) ] [SugarColumn(ColumnName="ID" ,IsPrimaryKey = true,IsIdentity = true) ]
public decimal ID { get; set; } public decimal? ID { get; set; }
} }

45
medical.jzyb.entity/STD/STD_OBJECT_MAPPING.cs

@ -13,6 +13,13 @@ namespace medical.transfomer.entity
{ {
/// <summary>
/// 备 注:主键
/// 默认值:
///</summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public decimal? ID { get; set; }
/// <summary> /// <summary>
/// 备 注:本地系统名称(如姓名 年龄) /// 备 注:本地系统名称(如姓名 年龄)
/// 默认值: /// 默认值:
@ -21,82 +28,82 @@ namespace medical.transfomer.entity
public string? SYSTEM_NAME { get; set; } public string? SYSTEM_NAME { get; set; }
/// <summary> /// <summary>
/// 备 注:系统字段名(如name age) /// 备 注:本地系统字段名(如name age)
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "SYSTEM_FIELD")] [SugarColumn(ColumnName = "SYSTEM_FIELD")]
public string? SYSTEM_FIELD { get; set; } public string? SYSTEM_FIELD { get; set; }
/// <summary> /// <summary>
/// 备 注:医保接口字段名 /// 备 注:对接系统名称
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "INTERFACE_NAME")] [SugarColumn(ColumnName = "INTERFACE_NAME")]
public string? INTERFACE_NAME { get; set; } public string? INTERFACE_NAME { get; set; }
/// <summary> /// <summary>
/// 备 注:医保字段名(需符合国标) /// 备 注:对接系统字段名
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "INTERFACE_FIELD")] [SugarColumn(ColumnName = "INTERFACE_FIELD")]
public string? INTERFACE_FIELD { get; set; } public string? INTERFACE_FIELD { get; set; }
/// <summary> /// <summary>
/// 备 注:所属对象名(外键) /// 备 注:对接系统表中文名
/// 默认值:
///</summary>
[SugarColumn(ColumnName="OBJECT_TABLE_NAME" ) ]
public string? OBJECT_TABLE_NAME { get; set; }
/// <summary>
/// 备 注:所属对象存储表中文名
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "OBJECT_TABLE_CNNAME")] [SugarColumn(ColumnName = "OBJECT_TABLE_CNNAME")]
public string? OBJECT_TABLE_CNNAME { get; set; } public string? OBJECT_TABLE_CNNAME { get; set; }
/// <summary> /// <summary>
/// 备 注:系统表中文名 /// 备 注:本地系统表中文名
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "SYSTEM_TABLE_CNNAME")] [SugarColumn(ColumnName = "SYSTEM_TABLE_CNNAME")]
public string? SYSTEM_TABLE_CNNAME { get; set; } public string? SYSTEM_TABLE_CNNAME { get; set; }
/// <summary> /// <summary>
/// 备 注:系统表英文名 /// 备 注:本地系统表英文名
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "SYSTEM_TABLE_NAME")] [SugarColumn(ColumnName = "SYSTEM_TABLE_NAME")]
public string? SYSTEM_TABLE_NAME { get; set; } public string? SYSTEM_TABLE_NAME { get; set; }
/// <summary> /// <summary>
/// 备 注:系统字段类型 /// 备 注:本地系统字段类型
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "SYSTEM_FIELD_TYPE")] [SugarColumn(ColumnName = "SYSTEM_FIELD_TYPE")]
public decimal? SYSTEM_FIELD_TYPE { get; set; } public string? SYSTEM_FIELD_TYPE { get; set; }
/// <summary> /// <summary>
/// 备 注:系统字典名称 /// 备 注:本地系统字典名称
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "SYSTEM_DICT_NAME")] [SugarColumn(ColumnName = "SYSTEM_DICT_NAME")]
public string? SYSTEM_DICT_NAME { get; set; } public string? SYSTEM_DICT_NAME { get; set; }
/// <summary> /// <summary>
/// 备 注:对接字段类型 /// 备 注:对接系统字段类型
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "OBJECT_FIELD_TYPE")] [SugarColumn(ColumnName = "OBJECT_FIELD_TYPE")]
public decimal? OBJECT_FIELD_TYPE { get; set; } public string? OBJECT_FIELD_TYPE { get; set; }
/// <summary> /// <summary>
/// 备 注:对接字典名称 /// 备 注:对接系统字典名称
/// 默认值: /// 默认值:
///</summary> ///</summary>
[SugarColumn(ColumnName = "OBJECT_DICT_NAME")] [SugarColumn(ColumnName = "OBJECT_DICT_NAME")]
public string? OBJECT_DICT_NAME { get; set; } public string? OBJECT_DICT_NAME { get; set; }
/// <summary>
/// 备 注:对接系统表英文名
/// 默认值:
///</summary>
[SugarColumn(ColumnName = "OBJECT_TABLE_NAME")]
public string? OBJECT_TABLE_NAME { get; set; }
} }

42
medical.transfomer.business/std_object_mapping_business.cs

@ -1,5 +1,7 @@
using medical.transfomer.entity; using DocumentFormat.OpenXml.Drawing.Charts;
using medical.transfomer.entity;
using ReZero.DependencyInjection; using ReZero.DependencyInjection;
using ReZero.SuperAPI;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -11,17 +13,45 @@ namespace medical.transfomer.business
{ {
public class std_object_mapping_business : IScopeContract public class std_object_mapping_business : IScopeContract
{ {
//属性注入
[DI]
public ISqlSugarClient? db { get; set; } public ISqlSugarClient? db = ZeroDb.Db;
public Task<object> ExecuteAction(DataModel dataModel)
{
throw new NotImplementedException();
}
// 批量插入信息 // 批量插入信息
public int ListInsert(List<STD_OBJECT_MAPPING> list) public int ListInsert(List<STD_OBJECT_MAPPING> list)
{ {
var result = new List<STD_OBJECT_MAPPING>(); try
{
db!.Ado.BeginTran();
return db.Insertable<STD_OBJECT_MAPPING>(list).ExecuteCommand(); // 完全避免批量插入语法,改用循环逐条插入
int result = 0;
foreach (var item in list)
{
// 不要设置ID为null,而是完全忽略ID列
result += db!.Insertable(item)
.IgnoreColumns(it => new { it.ID }) // 完全忽略ID列,让Oracle生成
.ExecuteCommand();
}
db!.Ado.CommitTran();
return result;
}
catch (Exception ex)
{
db!.Ado.RollbackTran();
// 记录错误详情以便调试
Console.WriteLine($"Oracle插入错误: {ex.Message}");
if (ex.InnerException != null)
Console.WriteLine($"内部错误: {ex.InnerException.Message}");
throw;
}
} }
} }
} }

Loading…
Cancel
Save