@@ -35,13 +35,13 @@ namespace Yi.Framework.ApiMicroservice
|
||||
|
||||
services.AddControllers();
|
||||
services.AddCors(options => options.AddPolicy("CorsPolicy",//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
builder =>
|
||||
{
|
||||
builder.AllowAnyMethod()
|
||||
.SetIsOriginAllowed(_ => true)
|
||||
.AllowAnyHeader()
|
||||
.AllowCredentials();
|
||||
}));
|
||||
builder =>
|
||||
{
|
||||
builder.AllowAnyMethod()
|
||||
.SetIsOriginAllowed(_ => true)
|
||||
.AllowAnyHeader()
|
||||
.AllowCredentials();
|
||||
}));
|
||||
services.Configure<SqliteOptions>(this.Configuration.GetSection("SqliteConn"));
|
||||
|
||||
services.AddScoped<DbContext, DataContext>();
|
||||
@@ -49,9 +49,6 @@ namespace Yi.Framework.ApiMicroservice
|
||||
|
||||
services.AddScoped<IUserService, UserService>();
|
||||
services.AddScoped<IRoleService, RoleService>();
|
||||
services.AddScoped<IMouldService, MouldService>();
|
||||
services.AddScoped<IMenuService, MenuService>();
|
||||
services.AddScoped<ILoopModelService, LoopModelService>();
|
||||
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.Interface
|
||||
{
|
||||
public interface ILoopModelService:IBaseService<loopModel>
|
||||
{
|
||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
||||
Task<IEnumerable<loopModel>> GetAllEntitiesTrueAsync();
|
||||
Task<IEnumerable<loopModel>> GetEntitiesTrueByIdAsync(List<int> _ids);
|
||||
Task<bool> AddEntitesAsync(List<loopModel> _loopModels);
|
||||
Task<bool> UpdateEntitesAsync(List<loopModel> _loopModels);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.Interface
|
||||
{
|
||||
public interface IMenuService:IBaseService<menu>
|
||||
{
|
||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
||||
Task<IEnumerable<menu>> GetAllEntitiesTrueAsync();
|
||||
Task<IEnumerable<menu>> GetEntitiesTrueByIdAsync(List<int> _ids);
|
||||
Task<bool> AddEntitesAsync(List<menu> _menus);
|
||||
Task<bool> UpdateEntitesAsync(List<menu> _menus);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.Interface
|
||||
{
|
||||
public interface IMouldService:IBaseService<mould>
|
||||
{
|
||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
||||
Task<IEnumerable<mould>> GetAllEntitiesTrueAsync();
|
||||
Task<IEnumerable<mould>> GetEntitiesTrueByIdAsync(List<int> _ids);
|
||||
Task<bool> AddEntitesAsync(List<mould> _moulds);
|
||||
Task<bool> UpdateEntitesAsync(List<mould> _moulds);
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,5 @@ namespace Yi.Framework.Interface
|
||||
{
|
||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
||||
Task<IEnumerable<role>> GetAllEntitiesTrueAsync();
|
||||
Task<IEnumerable<role>> GetEntitiesTrueByIdAsync(List<int> _ids);
|
||||
Task<bool> AddEntitesAsync(List<role> _roles);
|
||||
Task<bool> UpdateEntitesAsync(List<role> _roles);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,6 @@ namespace Yi.Framework.Interface
|
||||
public interface IUserService:IBaseService<user>
|
||||
{
|
||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
||||
Task<IEnumerable<user>> GetAllEntitiesTrueAsync();
|
||||
Task<IEnumerable<user>> GetEntitiesTrueByIdAsync(List<int> _ids);
|
||||
Task<bool> AddEntitesAsync(List<user> _users);
|
||||
Task<bool> UpdateEntitesAsync(List<user> _users);
|
||||
|
||||
Task<IEnumerable<user>> GetAllEntitiesTrueAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,10 @@ namespace Yi.Framework.Model.Models
|
||||
{
|
||||
public string icon { get; set; }
|
||||
public string router { get; set; }
|
||||
public string menu_name { get; set; }
|
||||
public string menu_name { get; set; }
|
||||
|
||||
|
||||
|
||||
public ICollection<menu> children { get; set; }
|
||||
public mould mould { get; set; }
|
||||
public ICollection<role> roles { get; set; }
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Yi.Framework.Model.Models
|
||||
{
|
||||
public string role_name { get; set; }
|
||||
public string introduce { get; set; }
|
||||
|
||||
|
||||
public ICollection<menu> menus { get; set; }
|
||||
public ICollection<user> users { get; set; }
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Yi.Framework.Model.Models
|
||||
public string ip { get; set; }
|
||||
public int? age { get; set; }
|
||||
public string introduction { get; set; }
|
||||
|
||||
public ICollection<role> roles { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.Service
|
||||
{
|
||||
public class LoopModelService:BaseService<loopModel>, ILoopModelService
|
||||
{
|
||||
public LoopModelService(DbContext Db) : base(Db)
|
||||
{
|
||||
}
|
||||
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
|
||||
{
|
||||
var loopModelList = await GetEntitiesAsync(u => _ids.Contains(u.id));
|
||||
loopModelList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
|
||||
return await UpdateListAsync(loopModelList);
|
||||
}
|
||||
public async Task<IEnumerable<loopModel>> GetAllEntitiesTrueAsync()
|
||||
{
|
||||
return await GetEntitiesAsync(u => u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
|
||||
}
|
||||
public async Task<bool> AddEntitesAsync(List<loopModel> _loopModels)
|
||||
{
|
||||
_loopModels.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Normal);
|
||||
return await AddEntitesAsync(_loopModels);
|
||||
}
|
||||
public async Task<IEnumerable<loopModel>> GetEntitiesTrueByIdAsync(List<int> _ids)
|
||||
{
|
||||
return await GetEntitiesAsync(u => _ids.Contains(u.id));
|
||||
}
|
||||
public async Task<bool> UpdateEntitesAsync(List<loopModel> _loopModels)
|
||||
{
|
||||
return await UpdateEntitesAsync(_loopModels);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.Service
|
||||
{
|
||||
public class MenuService:BaseService<menu>, IMenuService
|
||||
{
|
||||
public MenuService(DbContext Db):base(Db)
|
||||
{
|
||||
|
||||
}
|
||||
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
|
||||
{
|
||||
var menuList = await GetEntitiesAsync(u => _ids.Contains(u.id));
|
||||
menuList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
|
||||
return await UpdateListAsync(menuList);
|
||||
}
|
||||
public async Task<IEnumerable<menu>> GetAllEntitiesTrueAsync()
|
||||
{
|
||||
return await GetEntitiesAsync(u => u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
|
||||
}
|
||||
public async Task<bool> AddEntitesAsync(List<menu> _menus)
|
||||
{
|
||||
_menus.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Normal);
|
||||
return await AddEntitesAsync(_menus);
|
||||
}
|
||||
public async Task<IEnumerable<menu>> GetEntitiesTrueByIdAsync(List<int> _ids)
|
||||
{
|
||||
return await GetEntitiesAsync(u => _ids.Contains(u.id));
|
||||
}
|
||||
public async Task<bool> UpdateEntitesAsync(List<menu> _menus)
|
||||
{
|
||||
return await UpdateEntitesAsync(_menus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.Service
|
||||
{
|
||||
public class MouldService:BaseService<mould>, IMouldService
|
||||
{
|
||||
public MouldService(DbContext Db) : base(Db)
|
||||
{
|
||||
|
||||
}
|
||||
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
|
||||
{
|
||||
var mouldList = await GetEntitiesAsync(u => _ids.Contains(u.id));
|
||||
mouldList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
|
||||
return await UpdateListAsync(mouldList);
|
||||
}
|
||||
public async Task<IEnumerable<mould>> GetAllEntitiesTrueAsync()
|
||||
{
|
||||
return await GetEntitiesAsync(u => u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
|
||||
}
|
||||
public async Task<bool> AddEntitesAsync(List<mould> _moulds)
|
||||
{
|
||||
_moulds.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Normal);
|
||||
return await AddEntitesAsync(_moulds);
|
||||
}
|
||||
public async Task<IEnumerable<mould>> GetEntitiesTrueByIdAsync(List<int> _ids)
|
||||
{
|
||||
return await GetEntitiesAsync(u => _ids.Contains(u.id));
|
||||
}
|
||||
public async Task<bool> UpdateEntitesAsync(List<mould> _moulds)
|
||||
{
|
||||
return await UpdateEntitesAsync(_moulds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,26 +17,13 @@ namespace Yi.Framework.Service
|
||||
|
||||
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
|
||||
{
|
||||
var roleList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
|
||||
roleList.ToList().ForEach(u => u.is_delete =(short)Common.Enum.DelFlagEnum.Deleted);
|
||||
return await UpdateListAsync(roleList);
|
||||
var userList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
|
||||
userList.ToList().ForEach(u => u.is_delete =(short)Common.Enum.DelFlagEnum.Deleted);
|
||||
return await UpdateListAsync(userList);
|
||||
}
|
||||
public async Task<IEnumerable<role>> GetAllEntitiesTrueAsync()
|
||||
{
|
||||
return await GetEntitiesAsync(u => u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
|
||||
}
|
||||
public async Task<bool> AddEntitesAsync(List<role> _roles)
|
||||
{
|
||||
_roles.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Normal);
|
||||
return await AddEntitesAsync(_roles);
|
||||
}
|
||||
public async Task<IEnumerable<role>> GetEntitiesTrueByIdAsync(List<int> _ids)
|
||||
{
|
||||
return await GetEntitiesAsync(u => _ids.Contains(u.id));
|
||||
}
|
||||
public async Task<bool> UpdateEntitesAsync(List<role> _roles)
|
||||
{
|
||||
return await UpdateEntitesAsync(_roles);
|
||||
return await _Db.Set<role>().Where(u => u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,31 +15,16 @@ namespace Yi.Framework.Service
|
||||
public UserService(DbContext Db):base(Db)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
|
||||
{
|
||||
var userList = await GetEntitiesAsync(u => _ids.Contains(u.id));
|
||||
userList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
|
||||
return await UpdateListAsync(userList);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<user>> GetAllEntitiesTrueAsync()
|
||||
{
|
||||
return await GetEntitiesAsync(u=>u.is_delete==(short)Common.Enum.DelFlagEnum.Normal);
|
||||
return await _Db.Set<user>().Where(u=>u.is_delete==(short)Common.Enum.DelFlagEnum.Normal).ToListAsync();
|
||||
}
|
||||
public async Task<bool> AddEntitesAsync(List<user> _users)
|
||||
{
|
||||
_users.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Normal);
|
||||
return await AddEntitesAsync(_users);
|
||||
}
|
||||
public async Task<IEnumerable<user>> GetEntitiesTrueByIdAsync(List<int> _ids)
|
||||
{
|
||||
return await GetEntitiesAsync(u => _ids.Contains(u.id));
|
||||
}
|
||||
public async Task<bool> UpdateEntitesAsync(List<user> _users)
|
||||
{
|
||||
return await UpdateEntitesAsync(_users);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user