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. 67
      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));
};
// 添加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>

63
ReZero/SuperAPI/MethodGeneratorAPI/MethodGeneratorAPI.cs

@ -173,7 +173,19 @@ namespace ReZero.SuperAPI
var type = argsTypes![index];
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
@ -181,9 +193,10 @@ namespace ReZero.SuperAPI
value = ConvetEmptyValue(p.ParameterType, value);
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!;
index++;
@ -198,6 +211,36 @@ namespace ReZero.SuperAPI
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;
}
private static async Task<object> GetTask(Task task)
@ -209,7 +252,19 @@ namespace ReZero.SuperAPI
}
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
{
[DI]
public std_object_mapping_business _StdObjectMappingBusiness { get; set; }
public std_object_mapping_business? std_object_mapping_business { get; set; }
[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();
//注册db: 这个不写代码可以不注册
//注册db: 这个不写代码可以不注册
builder.Services.AddScoped<ISqlSugarClient>(it =>
{
var config = ApiConfiguration.GetJsonValue<ReZeroJson>("ReZero");
@ -33,21 +33,21 @@ builder.Services.AddScoped<ISqlSugarClient>(it =>
//builder.Services.AddCors();
//注册ReZero.Api
//注册ReZero.Api
builder.Services.AddReZeroServices(api =>
{
//有重载可换json文件
//有重载可换json文件
var apiObj = SuperAPIOptions.GetOptions();
//IOC业务等所有需要的所有集程集
//IOC业务等所有需要的所有集程集
var assemblyList = Assembly.GetExecutingAssembly()
.GetAllDependentAssemblies(it => it.Contains("medical.insu.transfomer"))
.GetAllDependentAssemblies(it => it.Contains("medical.insu.transfomer") || it.Contains("medical.transfomer"))
.ToArray();
apiObj!.DependencyInjectionOptions = new DependencyInjectionOptions(assemblyList);
//启用超级API
//启用超级API
api.EnableSuperApi(apiObj);
});

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

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

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

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

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

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

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

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