diff --git a/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs b/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs
new file mode 100644
index 0000000..d24e173
--- /dev/null
+++ b/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs
@@ -0,0 +1,42 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Entity
+{
+ [Table("bs_house_projectinfo")]
+ [Comment("项目表")]
+ public class BsHouseProjectInfo : Core.DEntityBase
+ {
+ [Comment("名称")]
+ [MaxLength(100)]
+ [Required]
+ public string Name { get; set; }
+
+ [Comment("备注")]
+ [MaxLength(1000)]
+ public string Note { get; set; }
+
+ [Comment("排序")]
+ [Required]
+ public int Sort { get; set; }
+
+ [Comment("区域ID")]
+ [MaxLength(36)]
+ [Required]
+ public string AreaId { get; set; }
+
+ [Comment("区域名称")]
+ [MaxLength(500)]
+ public string AreaName { get; set; }
+
+ [Comment("类型")]
+ [Required]
+ public int Type { get; set; }
+ }
+}
diff --git a/Api/Ewide.Application/Entity/CodeGenTest.cs b/Api/Ewide.Application/Entity/CodeGenTest.cs
deleted file mode 100644
index 2c70604..0000000
--- a/Api/Ewide.Application/Entity/CodeGenTest.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using Ewide.Core;
-using Microsoft.EntityFrameworkCore;
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
-
-namespace Ewide.Application
-{
- ///
- /// 代码生成实体测试(EF)
- ///
- [Table("code_gen_test")]
- [Comment("代码生成业务")]
- public class CodeGenTest : DEntityBase
- {
- ///
- /// 名称
- ///
- [Comment("名称")]
- public string Name { get; set; }
-
- ///
- /// 昵称
- ///
- [Comment("昵称")]
- public string NickName { get; set; }
-
- ///
- /// 生日
- ///
- [Comment("生日")]
- public DateTimeOffset Birthday { get; set; }
-
- ///
- /// 年龄
- ///
- [Comment("年龄")]
- public int Age { get; set; }
- }
-}
diff --git a/Api/Ewide.Application/Entity/Test.cs b/Api/Ewide.Application/Entity/Test.cs
deleted file mode 100644
index 58e75d4..0000000
--- a/Api/Ewide.Application/Entity/Test.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using SqlSugar;
-using System;
-
-namespace Ewide.Application
-{
- ///
- /// SqlSugar实体
- ///
- [SugarTable("Test", TableDescription = "我的业务表")]
- public class Test
- {
- ///
- /// 雪花Id
- ///
- [SugarColumn(IsPrimaryKey = true)]
- public long Id { get; set; }
-
- ///
- /// 名称
- ///
- [SugarColumn(ColumnDataType = "Nvarchar(32)")]
- public string Name { get; set; }
-
- ///
- /// 年龄
- ///
- public int Age { get; set; }
-
- ///
- /// 创建时间
- ///
- [SugarColumn(IsNullable = true)]
- public DateTimeOffset CreateTime { get; set; }
- }
-}
diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml
index b5c97a0..55480a5 100644
--- a/Api/Ewide.Application/Ewide.Application.xml
+++ b/Api/Ewide.Application/Ewide.Application.xml
@@ -4,65 +4,51 @@
Ewide.Application
-
+
- 代码生成实体测试(EF)
+ 项目管理相关服务
-
+
- 名称
+ 添加项目
+
+
-
+
- 昵称
+ 删除项目
+
+
-
+
- 生日
+ 编辑项目
+
+
-
+
- 年龄
+ 通过ID获取项目
+
+
-
+
- SqlSugar实体
+ 分页查询
+
+
-
+
- 雪花Id
-
-
-
-
- 名称
-
-
-
-
- 年龄
-
-
-
-
- 创建时间
-
-
-
-
- 业务服务及集成SqlSugar用法事例
-
-
-
-
- 测试方法
+
+
diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs
new file mode 100644
index 0000000..d89a0df
--- /dev/null
+++ b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs
@@ -0,0 +1,52 @@
+using Ewide.Core;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseProjectInfo.Dto
+{
+ public class HouseProjectInfoInput : XnInputBase
+ {
+ public string Name { get; set; }
+ public string Note { get; set; }
+ public int Sort { get; set; }
+ public string AreaID { get; set; }
+ public string AreaName { get; set; }
+ public int Type { get; set; }
+ public DateTimeOffset? CreatedTime { get; set; }
+ public DateTimeOffset? UpdatedTime { get; set; }
+ public string CreatedUserId { get; set; }
+ public string CreatedUserName { get; set; }
+ public string UpdatedUserId { get; set; }
+ public string UpdatedUserName { get; set; }
+ }
+ public class AddProjectInput : HouseProjectInfoInput
+ {
+ [Required(ErrorMessage = "项目ID不可为空")]
+ public string ID { get; set; }
+ }
+ public class UpdateProjectInput
+ {
+ public string ID { get; set; }
+ public string Note { get; set; }
+
+ public int Type { get; set; }
+ public DateTimeOffset? UpdatedTime { get; set; }
+ public string UpdatedUserId { get; set; }
+ public string UpdatedUserName { get; set; }
+ }
+
+ public class DeleteProjectInput
+ {
+ [Required(ErrorMessage = "项目ID不可为空")]
+ public string ID { get; set; }
+ }
+
+ public class QueryProjectInput : AddProjectInput
+ {
+
+ }
+}
diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectOutput.cs b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectOutput.cs
new file mode 100644
index 0000000..f8289ca
--- /dev/null
+++ b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectOutput.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseProjectInfo.Dto
+{
+ public class HouseProjectOutput
+ {
+ public string ID { get; set; }
+ public string Name { get; set; }
+ public string Note { get; set; }
+ public int Sort { get; set; }
+ public string AreaID { get; set; }
+ public string AreaName { get; set; }
+ public int Type { get; set; }
+ public DateTimeOffset? CreatedTime { get; set; }
+ public DateTimeOffset? UpdatedTime { get; set; }
+ public string CreatedUserId { get; set; }
+ public string CreatedUserName { get; set; }
+ public string UpdatedUserId { get; set; }
+ public string UpdatedUserName { get; set; }
+ }
+}
diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs
new file mode 100644
index 0000000..67f84c2
--- /dev/null
+++ b/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs
@@ -0,0 +1,109 @@
+using Ewide.Application.Entity;
+using Ewide.Application.Service.HouseProjectInfo.Dto;
+using Ewide.Core;
+using Ewide.Core.Service;
+using Furion.DatabaseAccessor;
+using Furion.DatabaseAccessor.Extensions;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseProjectInfo
+{
+ ///
+ /// 项目管理相关服务
+ ///
+ [ApiDescriptionSettings(Name = "HouseProjectInfo", Order = 170)]
+ public class HouseProjectInfoService : IHouseProjectInfoService, ITransient, IDynamicApiController
+ {
+ private readonly IRepository _houseProjectInfoRep;
+
+ public HouseProjectInfoService(IRepository houseProjectInfoRep)
+ {
+ _houseProjectInfoRep = houseProjectInfoRep;
+ }
+
+ ///
+ /// 添加项目
+ ///
+ ///
+ ///
+ [HttpPost("/houseProjectInfo/add")]
+ public async Task AddProject(AddProjectInput input)
+ {
+ await _houseProjectInfoRep.InsertNowAsync(input.Adapt());
+ }
+
+ ///
+ /// 删除项目
+ ///
+ ///
+ ///
+ [HttpPost("/houseProjectInfo/delete")]
+ public async Task DeleteProject(DeleteProjectInput input)
+ {
+ var project = _houseProjectInfoRep.FirstOrDefault(p => p.Id == input.ID) ;
+ await project.DeleteNowAsync();
+ }
+
+ ///
+ /// 编辑项目
+ ///
+ ///
+ ///
+ [HttpPost("/houseProjectInfo/edit")]
+ public async Task UpdateProject(AddProjectInput input)
+ {
+ var project = input.Adapt();
+ await project.UpdateNowAsync();
+ }
+
+ ///
+ /// 通过ID获取项目
+ ///
+ ///
+ ///
+ [HttpGet("/houseProjectInfo/detailById")]
+ public async Task GetProjectById([Required] string id)
+ {
+ return await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == id);
+ }
+
+ ///
+ /// 分页查询
+ ///
+ ///
+ ///
+ [HttpGet("/houseProjectInfo/page")]
+ public async Task QueryProjectPageList([FromQuery] HouseProjectInfoInput input)
+ {
+ var areaID = !string.IsNullOrEmpty(input.AreaID);
+ var projects = await _houseProjectInfoRep.DetachedEntities
+ .Where(areaID, p => p.AreaId == input.AreaID)
+ .Select(p => p.Adapt()).ToPagedListAsync(input.PageNo, input.PageSize);
+ return XnPageResult.PageResult(projects);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("/houseProjectInfo/detail")]
+ public async Task GetProject([FromQuery] QueryProjectInput input)
+ {
+ var user = await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == input.ID);
+ var userDto = user.Adapt();
+
+ return userDto;
+ }
+ }
+}
diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/IHouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseProjectInfo/IHouseProjectInfoService.cs
new file mode 100644
index 0000000..6c50503
--- /dev/null
+++ b/Api/Ewide.Application/Service/HouseProjectInfo/IHouseProjectInfoService.cs
@@ -0,0 +1,21 @@
+using Ewide.Application.Entity;
+using Ewide.Application.Service.HouseProjectInfo.Dto;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseProjectInfo
+{
+ public interface IHouseProjectInfoService
+ {
+ Task AddProject(AddProjectInput input);
+ Task DeleteProject(DeleteProjectInput input);
+ Task UpdateProject(AddProjectInput input);
+ Task GetProjectById([FromRoute] string id);
+ Task GetProject([FromQuery] QueryProjectInput input);
+ Task QueryProjectPageList([FromQuery] HouseProjectInfoInput input);
+ }
+}
diff --git a/Api/Ewide.Application/Service/ITestService.cs b/Api/Ewide.Application/Service/ITestService.cs
deleted file mode 100644
index 117eb4e..0000000
--- a/Api/Ewide.Application/Service/ITestService.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Ewide.Application
-{
- public interface ITestService
- {
- string GetDescription();
- }
-}
\ No newline at end of file
diff --git a/Api/Ewide.Application/Service/TestService.cs b/Api/Ewide.Application/Service/TestService.cs
deleted file mode 100644
index c7c4ecd..0000000
--- a/Api/Ewide.Application/Service/TestService.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using Ewide.Core;
-using Furion.DependencyInjection;
-using Furion.DynamicApiController;
-using Furion.Snowflake;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Ewide.Application
-{
- ///
- /// 业务服务及集成SqlSugar用法事例
- ///
- public class TestService : ITestService, IDynamicApiController, ITransient
- {
- //private readonly ISqlSugarRepository _testRep;
- //private readonly SqlSugarClient _db; // SqlSugar对象
-
- public TestService(/*ISqlSugarRepository sqlSugarRep*/)
- {
- //_testRep = sqlSugarRep;
- //_db = (SqlSugarClient)_testRep.Context;
- }
-
- ///
- /// 测试方法
- ///
- ///
- [HttpPost("/test")]
- public string GetDescription()
- {
- return "Admin.NET";
- }
-
- /////
- ///// 增加数据
- /////
- /////
- //[HttpPost("/test/add")]
- //public async Task AddTestAsync()
- //{
- // var test = new Test()
- // {
- // Id = IDGenerator.NextId(),
- // Name = "Admin.NET",
- // Age = 1,
- // CreateTime = DateTimeOffset.Now
- // };
- // await _testRep.InsertAsync(test);
- // // _db.Insertable(test).ExecuteCommand();
- //}
-
- /////
- ///// 查询所有
- /////
- /////
- //[HttpPost("/test/page")]
- //public async Task> GetTestListAsync()
- //{
- // return await _testRep.Entities.ToListAsync();
- //}
-
- /////
- ///// 查询系统用户
- /////
- /////
- //[HttpPost("/test/userPage")]
- //public async Task GetUserListAsync()
- //{
- // return await _db.Queryable().ToListAsync();
- //}
- }
-}
diff --git a/Api/Ewide.Core/Service/Role/SysRoleService.cs b/Api/Ewide.Core/Service/Role/SysRoleService.cs
index 911dcac..8dc6a18 100644
--- a/Api/Ewide.Core/Service/Role/SysRoleService.cs
+++ b/Api/Ewide.Core/Service/Role/SysRoleService.cs
@@ -255,7 +255,7 @@ namespace Ewide.Core.Service
customDataScopeRoleIdList.Add(u.Id);
if ((u.DataScopeType == (int)DataScopeType.AREA || u.DataScopeType == (int)DataScopeType.AREA_WITH_CHILD) && strongerAreaType < u.DataScopeType)
{
- strongerDataScopeType = u.DataScopeType;
+ strongerAreaType = u.DataScopeType;
}
else if (u.DataScopeType <= strongerDataScopeType)
strongerDataScopeType = u.DataScopeType;
diff --git a/Api/Ewide.Web.Entry/Controllers/HomeController.cs b/Api/Ewide.Web.Entry/Controllers/HomeController.cs
index e656d6e..dd52d00 100644
--- a/Api/Ewide.Web.Entry/Controllers/HomeController.cs
+++ b/Api/Ewide.Web.Entry/Controllers/HomeController.cs
@@ -7,17 +7,13 @@ namespace Ewide.Web.Entry.Controllers
[AllowAnonymous]
public class HomeController : Controller
{
- private readonly ITestService _testService;
-
- public HomeController(ITestService testService)
+ public HomeController()
{
- _testService = testService;
+
}
public IActionResult Index()
{
- ViewBag.Description = _testService.GetDescription();
-
return View();
}
}