配置管理增删改查
This commit is contained in:
Binary file not shown.
@@ -180,6 +180,14 @@
|
|||||||
<param name="ids"></param>
|
<param name="ids"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ConfigController.PageList(Yi.Framework.Model.Models.ConfigEntity,Yi.Framework.Common.Models.PageParModel)">
|
||||||
|
<summary>
|
||||||
|
动态条件分页查询
|
||||||
|
</summary>
|
||||||
|
<param name="dic"></param>
|
||||||
|
<param name="page"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.SelctGetList(Yi.Framework.Model.Models.DeptEntity)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.SelctGetList(Yi.Framework.Model.Models.DeptEntity)">
|
||||||
<summary>
|
<summary>
|
||||||
动态条件查询
|
动态条件查询
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
using Yi.Framework.WebCore;
|
||||||
|
using Yi.Framework.WebCore.AttributeExtend;
|
||||||
|
using Yi.Framework.WebCore.AuthorizationPolicy;
|
||||||
|
|
||||||
|
namespace Yi.Framework.ApiMicroservice.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
public class ConfigController : BaseSimpleCrudController<ConfigEntity>
|
||||||
|
{
|
||||||
|
private IConfigService _iConfigService;
|
||||||
|
public ConfigController(ILogger<ConfigEntity> logger, IConfigService iConfigService) : base(logger, iConfigService)
|
||||||
|
{
|
||||||
|
_iConfigService = iConfigService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动态条件分页查询
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <param name="page"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> PageList([FromQuery] ConfigEntity dic, [FromQuery] PageParModel page)
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iConfigService.SelctPageList(dic, page));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
13
Yi.Framework.Net6/Yi.Framework.Interface/IConfigService.cs
Normal file
13
Yi.Framework.Net6/Yi.Framework.Interface/IConfigService.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface IConfigService:IBaseService<ConfigEntity>
|
||||||
|
{
|
||||||
|
Task<PageModel<List<ConfigEntity>>> SelctPageList(ConfigEntity config, PageParModel page);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface IConfigService:IBaseService<ConfigEntity>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 配置表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("Config")]
|
||||||
|
public partial class ConfigEntity:IBaseModelEntity
|
||||||
|
{
|
||||||
|
public ConfigEntity()
|
||||||
|
{
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 配置名称
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ConfigName" )]
|
||||||
|
public string ConfigName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 配置键
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ConfigKey" )]
|
||||||
|
public string ConfigKey { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 配置值
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ConfigValue" )]
|
||||||
|
public string ConfigValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 配置类别
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ConfigType" )]
|
||||||
|
public string ConfigType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateUser" )]
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateTime" )]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyTime" )]
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否删除
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDeleted" )]
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 租户Id
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
|
public long? TenantId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 排序字段
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="OrderNum" )]
|
||||||
|
public int? OrderNum { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 描述
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="Remark" )]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Yi.Framework.Net6/Yi.Framework.Service/ConfigService.cs
Normal file
29
Yi.Framework.Net6/Yi.Framework.Service/ConfigService.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Service
|
||||||
|
{
|
||||||
|
public partial class ConfigService : BaseService<ConfigEntity>, IConfigService
|
||||||
|
{
|
||||||
|
public async Task<PageModel<List<ConfigEntity>>> SelctPageList(ConfigEntity config, PageParModel page)
|
||||||
|
{
|
||||||
|
RefAsync<int> total = 0;
|
||||||
|
var data = await _repository._DbQueryable
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(config.ConfigName), u => u.ConfigName.Contains(config.ConfigName))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(config.ConfigKey), u => u.ConfigKey.Contains(config.ConfigKey))
|
||||||
|
.WhereIF(page.StartTime.IsNotNull() && page.EndTime.IsNotNull(), u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime)
|
||||||
|
.WhereIF(config.IsDeleted.IsNotNull(), u => u.IsDeleted == config.IsDeleted)
|
||||||
|
.OrderBy(u => u.OrderNum, OrderByType.Desc)
|
||||||
|
.ToPageListAsync(page.PageNum, page.PageSize, total);
|
||||||
|
|
||||||
|
return new PageModel<List<ConfigEntity>>(data, total);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using Yi.Framework.Interface;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Service
|
||||||
|
{
|
||||||
|
public partial class ConfigService : BaseService<ConfigEntity>, IConfigService
|
||||||
|
{
|
||||||
|
public ConfigService(IRepository<ConfigEntity> repository) : base(repository)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||||||
// 查询参数列表
|
// 查询参数列表
|
||||||
export function listConfig(query) {
|
export function listConfig(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/config/list',
|
url: '/config/pageList',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
@@ -12,7 +12,7 @@ export function listConfig(query) {
|
|||||||
// 查询参数详细
|
// 查询参数详细
|
||||||
export function getConfig(configId) {
|
export function getConfig(configId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/config/' + configId,
|
url: '/config/getById/' + configId,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ export function getConfigKey(configKey) {
|
|||||||
// 新增参数配置
|
// 新增参数配置
|
||||||
export function addConfig(data) {
|
export function addConfig(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/config',
|
url: '/config/add',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@@ -37,7 +37,7 @@ export function addConfig(data) {
|
|||||||
// 修改参数配置
|
// 修改参数配置
|
||||||
export function updateConfig(data) {
|
export function updateConfig(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/config',
|
url: '/config/update',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@@ -45,9 +45,15 @@ export function updateConfig(data) {
|
|||||||
|
|
||||||
// 删除参数配置
|
// 删除参数配置
|
||||||
export function delConfig(configId) {
|
export function delConfig(configId) {
|
||||||
|
|
||||||
|
if("string"==typeof(configId))
|
||||||
|
{
|
||||||
|
configId=[configId];
|
||||||
|
}
|
||||||
return request({
|
return request({
|
||||||
url: '/system/config/' + configId,
|
url: '/config/delList',
|
||||||
method: 'delete'
|
method: 'delete',
|
||||||
|
data:configId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="参数主键" align="center" prop="configId" />
|
<el-table-column label="参数主键" align="center" prop="id" />
|
||||||
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
|
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
|
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="参数键值" align="center" prop="configValue" />
|
<el-table-column label="参数键值" align="center" prop="configValue" />
|
||||||
@@ -213,8 +213,8 @@ const { queryParams, form, rules } = toRefs(data);
|
|||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listConfig(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
listConfig(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
||||||
configList.value = response.rows;
|
configList.value = response.data.data;
|
||||||
total.value = response.total;
|
total.value = response.data.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -226,12 +226,13 @@ function cancel() {
|
|||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
configId: undefined,
|
id: undefined,
|
||||||
configName: undefined,
|
configName: undefined,
|
||||||
configKey: undefined,
|
configKey: undefined,
|
||||||
configValue: undefined,
|
configValue: undefined,
|
||||||
configType: "Y",
|
configType: "Y",
|
||||||
remark: undefined
|
remark: undefined,
|
||||||
|
isDeleted: false
|
||||||
};
|
};
|
||||||
proxy.resetForm("configRef");
|
proxy.resetForm("configRef");
|
||||||
}
|
}
|
||||||
@@ -248,7 +249,7 @@ function resetQuery() {
|
|||||||
}
|
}
|
||||||
/** 多选框选中数据 */
|
/** 多选框选中数据 */
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.configId);
|
ids.value = selection.map(item => item.id);
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1;
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length;
|
||||||
}
|
}
|
||||||
@@ -261,7 +262,7 @@ function handleAdd() {
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset();
|
reset();
|
||||||
const configId = row.configId || ids.value;
|
const configId = row.id || ids.value;
|
||||||
getConfig(configId).then(response => {
|
getConfig(configId).then(response => {
|
||||||
form.value = response.data;
|
form.value = response.data;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
@@ -272,7 +273,7 @@ function handleUpdate(row) {
|
|||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["configRef"].validate(valid => {
|
proxy.$refs["configRef"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.configId != undefined) {
|
if (form.value.id != undefined) {
|
||||||
updateConfig(form.value).then(response => {
|
updateConfig(form.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
@@ -290,7 +291,7 @@ function submitForm() {
|
|||||||
}
|
}
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const configIds = row.configId || ids.value;
|
const configIds = row.id || ids.value;
|
||||||
proxy.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function () {
|
proxy.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function () {
|
||||||
return delConfig(configIds);
|
return delConfig(configIds);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user