diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index 73c9f8fe..7a8e4863 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -130,6 +130,20 @@ + + + id范围删除 + + + + + + + 更新 + + + + 动态条件分页查询 @@ -159,6 +173,20 @@ + + + 更新 + + + + + + + 根据字典id获取字典信息表 + + + + 文件 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryController.cs index 0fcc3abb..c5c38f6f 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryController.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Yi.Framework.Common.Helper; using Yi.Framework.Common.Models; using Yi.Framework.Interface; using Yi.Framework.Model.Models; @@ -73,5 +74,29 @@ namespace Yi.Framework.ApiMicroservice.Controllers { return Result.Success().SetData(await _iDictionaryService._repository.GetListAsync()); } + + + /// + /// id范围删除 + /// + /// + /// + [HttpDelete] + + public async Task DelList(List ids) + { + return Result.Success().SetStatus(await _iDictionaryService._repository.DeleteByIdsAsync(ids.ToDynamicArray())); + } + + /// + /// 更新 + /// + /// + /// + [HttpPut] + public async Task Update(DictionaryEntity dic) + { + return Result.Success().SetStatus(await _iDictionaryService._repository.UpdateIgnoreNullAsync(dic)); + } } } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryInfoController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryInfoController.cs index 06a321df..2a41bb27 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryInfoController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryInfoController.cs @@ -76,5 +76,29 @@ namespace Yi.Framework.ApiMicroservice.Controllers return Result.Success().SetStatus(await _iDictionaryInfoService._repository.DeleteByIdsAsync(ids.ToDynamicArray())); } + + /// + /// 更新 + /// + /// + /// + [HttpPut] + public async Task Update(DictionaryInfoEntity dicInfo) + { + return Result.Success().SetStatus(await _iDictionaryInfoService._repository.UpdateIgnoreNullAsync(dicInfo)); + } + + + /// + /// 根据字典id获取字典信息表 + /// + /// + /// + [HttpGet] + [Route("{id}")] + public async Task GetById(long id) + { + return Result.Success().SetData(await _iDictionaryInfoService._repository.GetByIdAsync(id)); + } } } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index 323989b1..bc2597ac 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Vue3.X.RuoYi/src/api/system/dict/data.js b/Yi.Vue3.X.RuoYi/src/api/system/dict/data.js index 5ff5ac04..8f7766ea 100644 --- a/Yi.Vue3.X.RuoYi/src/api/system/dict/data.js +++ b/Yi.Vue3.X.RuoYi/src/api/system/dict/data.js @@ -12,7 +12,7 @@ export function listData(query) { // 查询字典数据详细 export function getData(dictCode) { return request({ - url: '/system/dict/data/' + dictCode, + url: '/dictionaryInfo/getById/' + dictCode, method: 'get' }) } @@ -37,7 +37,7 @@ export function addData(data) { // 修改字典数据 export function updateData(data) { return request({ - url: '/system/dict/data', + url: '/dictionaryInfo/update', method: 'put', data: data }) diff --git a/Yi.Vue3.X.RuoYi/src/api/system/dict/type.js b/Yi.Vue3.X.RuoYi/src/api/system/dict/type.js index f886c6a8..347686d6 100644 --- a/Yi.Vue3.X.RuoYi/src/api/system/dict/type.js +++ b/Yi.Vue3.X.RuoYi/src/api/system/dict/type.js @@ -29,7 +29,7 @@ export function addType(data) { // 修改字典类型 export function updateType(data) { return request({ - url: '/system/dict/type', + url: '/dictionary/update', method: 'put', data: data }) @@ -37,9 +37,14 @@ export function updateType(data) { // 删除字典类型 export function delType(dictId) { + if("string"==typeof(dictId)) +{ + dictId=[dictId]; +} return request({ - url: '/system/dict/type/' + dictId, - method: 'delete' + url: '/dictionary/delList', + method: 'delete', + data:dictId }) } diff --git a/Yi.Vue3.X.RuoYi/src/views/system/dict/data.vue b/Yi.Vue3.X.RuoYi/src/views/system/dict/data.vue index 3356f84e..26fefe3a 100644 --- a/Yi.Vue3.X.RuoYi/src/views/system/dict/data.vue +++ b/Yi.Vue3.X.RuoYi/src/views/system/dict/data.vue @@ -221,7 +221,7 @@ const data = reactive({ pageSize: 10, dictName: undefined, dictType: undefined, - isDeleted: undefined + isDeleted: false }, rules: { dictLabel: [{ required: true, message: "数据标签不能为空", trigger: "blur" }], diff --git a/Yi.Vue3.X.RuoYi/src/views/system/dict/index.vue b/Yi.Vue3.X.RuoYi/src/views/system/dict/index.vue index 049eaad5..43f53c85 100644 --- a/Yi.Vue3.X.RuoYi/src/views/system/dict/index.vue +++ b/Yi.Vue3.X.RuoYi/src/views/system/dict/index.vue @@ -19,9 +19,9 @@ @keyup.enter="handleQuery" /> - + item.dictId); + ids.value = selection.map(item => item.id); single.value = selection.length != 1; multiple.value = !selection.length; } /** 修改按钮操作 */ function handleUpdate(row) { reset(); - const dictId = row.dictId || ids.value; + const dictId = row.id || ids.value; getType(dictId).then(response => { form.value = response.data; open.value = true; @@ -278,7 +278,7 @@ function handleUpdate(row) { function submitForm() { proxy.$refs["dictRef"].validate(valid => { if (valid) { - if (form.value.dictId != undefined) { + if (form.value.id != undefined) { updateType(form.value).then(response => { proxy.$modal.msgSuccess("修改成功"); open.value = false; @@ -296,7 +296,7 @@ function submitForm() { } /** 删除按钮操作 */ function handleDelete(row) { - const dictIds = row.dictId || ids.value; + const dictIds = row.id || ids.value; proxy.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() { return delType(dictIds); }).then(() => {