|
1 | | -usingDestinyCore.AspNetCore.Api; |
2 | | -usingDestinyCore.AspNetCore; |
3 | | -usingDestinyCore.Audit; |
4 | | -usingDestiny.Core.Flow.Dtos; |
5 | | -usingDestinyCore.Filter; |
6 | | -usingDestiny.Core.Flow.IServices; |
7 | | -usingDestinyCore.Permission; |
8 | | -usingMicrosoft.AspNetCore.Mvc; |
9 | | -usingMicrosoft.Extensions.Logging; |
10 | | -usingSystem; |
11 | | -usingSystem.ComponentModel; |
12 | | -usingSystem.Threading.Tasks; |
13 | | -namespaceDestiny.Core.Flow.API.Controllers |
14 | | -{ |
15 | | - |
16 | | -/// <summary> |
17 | | -/// 用户管理 |
18 | | -/// </summary> |
19 | | -[Description("用户管理")] |
20 | | - |
21 | | -publicclassUserController:AdminControllerBase |
22 | | -{ |
23 | | - |
24 | | -privatereadonlyIUserServices_userService=null; |
25 | | -privatereadonlyILogger_logger=null; |
26 | | -privatereadonlyIServiceProvider_serviceProvider=null; |
27 | | -publicUserController(IUserServicesuserService,IServiceProviderserviceProvider) |
28 | | -{ |
29 | | -_userService=userService; |
30 | | -_logger=IocManage.GetLogger<UserController>(); |
31 | | -_serviceProvider=serviceProvider; |
32 | | -} |
33 | | - |
34 | | - |
35 | | -/// <summary> |
36 | | -/// 异步创建用户 |
37 | | -/// </summary> |
38 | | -/// <param name="dto"></param> |
39 | | -/// <returns></returns> |
40 | | -[HttpPost] |
41 | | -[Description("异步创建用户")] |
42 | | -//[ServiceFilter(typeof(AuditLogFilterAttribute))] |
43 | | -publicasyncTask<AjaxResult>CreateAsync([FromBody]UserInputDtodto) |
44 | | -{ |
45 | | - |
46 | | -//var validator = _serviceProvider.GetService<IModelValidator<UserInputDto>>(); |
47 | | - |
48 | | -//var failures = validator.Validate(new UserInputDto()); |
49 | | -return(await_userService.CreateAsync(dto)).ToAjaxResult(); |
50 | | -} |
51 | | - |
52 | | - |
53 | | - |
54 | | -/// <summary> |
55 | | -/// 异步更新用户 |
56 | | -/// </summary> |
57 | | -/// <param name="dto"></param> |
58 | | -/// <returns></returns> |
59 | | - |
60 | | -[HttpPost] |
61 | | -[Description("异步更新用户")] |
62 | | -//[ServiceFilter(typeof(AuditLogFilterAttribute))] |
63 | | - |
64 | | -publicasyncTask<AjaxResult>UpdateAsync([FromBody]UserUpdateInputDtodto) |
65 | | -{ |
66 | | - |
67 | | -return(await_userService.UpdateAsync(dto)).ToAjaxResult(); |
68 | | -} |
69 | | - |
70 | | -/// <summary> |
71 | | -/// 异步删除用户 |
72 | | -/// </summary> |
73 | | -/// <param name="id">主键</param> |
74 | | -/// <returns></returns> |
75 | | - |
76 | | -[HttpDelete] |
77 | | -[Description("异步删除用户")] |
78 | | -//[ServiceFilter(typeof(AuditLogFilterAttribute))] |
79 | | -publicasyncTask<AjaxResult>DeleteAsync(Guidid) |
80 | | -{ |
81 | | - |
82 | | -return(await_userService.DeleteAsync(id)).ToAjaxResult(); |
83 | | - |
84 | | -} |
85 | | - |
86 | | - |
87 | | - |
88 | | -/// <summary> |
89 | | -/// 异步加载用户 |
90 | | -/// </summary> |
91 | | -/// <param name="id">主键</param> |
92 | | -/// <returns></returns> |
93 | | - |
94 | | -[HttpGet] |
95 | | -[Description("异步加载用户")] |
96 | | -[NoAuthorityVerification] |
97 | | -publicasyncTask<AjaxResult>LoadAsync(Guidid) |
98 | | -{ |
99 | | - |
100 | | -return(await_userService.LoadFormUserAsync(id)).ToAjaxResult(); |
101 | | - |
102 | | -} |
103 | | - |
104 | | -/// <summary> |
105 | | -/// 用户分配角色 |
106 | | -/// </summary> |
107 | | -/// <returns></returns> |
108 | | -[Description("用户分配角色")] |
109 | | -[HttpPost] |
110 | | -//[ServiceFilter(typeof(AuditLogFilterAttribute))] |
111 | | -publicasyncTask<AjaxResult>AllocationRoleAsync([FromBody]UserAllocationRoleInputDtodto) |
112 | | -{ |
113 | | -return(await_userService.AllocationRoleAsync(dto)).ToAjaxResult(); |
114 | | -} |
115 | | -/// <summary> |
116 | | -///获取所有用户列表 |
117 | | -/// </summary> |
118 | | -/// <param name="dto"></param> |
119 | | -/// <returns></returns> |
120 | | -[HttpGet] |
121 | | -[Description("获取所有用户列表")] |
122 | | - |
123 | | -publicasyncTask<AjaxResult>GetUsersToSelectListItemAsync() |
124 | | -{ |
125 | | -return(await_userService.GetUsersToSelectListItemAsync()).ToAjaxResult(); |
126 | | -} |
127 | | - |
128 | | -/// <summary> |
129 | | -/// 异步得到分页 |
130 | | -/// </summary> |
131 | | -/// <param name="request"></param> |
132 | | -/// <returns></returns> |
133 | | -[HttpPost] |
134 | | -[Description("异步得到分页")] |
135 | | -publicasyncTask<PageList<UserOutputPageListDto>>GetUserPageAsync([FromBody]PageRequestrequest) |
136 | | -{ |
137 | | -return(await_userService.GetUserPageAsync(request)).ToPageList(); |
138 | | - |
139 | | -} |
140 | | -/// <summary> |
141 | | -/// 异步得到所有用户 |
142 | | -/// </summary> |
143 | | -/// <returns></returns> |
144 | | -[HttpGet] |
145 | | -[Description("异步得到所有用户")] |
146 | | -[NoAuthorityVerification] |
147 | | -publicasyncTask<AjaxResult>GetUsersAsync() |
148 | | -{ |
149 | | - |
150 | | -return(await_userService.GetUsersAsync()).ToAjaxResult(); |
| 1 | +usingDestinyCore.AspNetCore.Api; |
| 2 | +usingDestinyCore.AspNetCore; |
| 3 | +usingDestinyCore.Audit; |
| 4 | +usingDestiny.Core.Flow.Dtos; |
| 5 | +usingDestinyCore.Filter; |
| 6 | +usingDestiny.Core.Flow.IServices; |
| 7 | +usingDestinyCore.Permission; |
| 8 | +usingMicrosoft.AspNetCore.Mvc; |
| 9 | +usingMicrosoft.Extensions.Logging; |
| 10 | +usingSystem; |
| 11 | +usingSystem.ComponentModel; |
| 12 | +usingSystem.Threading.Tasks; |
| 13 | +namespaceDestiny.Core.Flow.API.Controllers |
| 14 | +{ |
| 15 | + |
| 16 | +/// <summary> |
| 17 | +/// 用户管理 |
| 18 | +/// </summary> |
| 19 | +[Description("用户管理")] |
| 20 | + |
| 21 | +publicclassUserController:AdminControllerBase |
| 22 | +{ |
| 23 | + |
| 24 | +privatereadonlyIUserServices_userService=null; |
| 25 | +privatereadonlyILogger_logger=null; |
| 26 | +privatereadonlyIServiceProvider_serviceProvider=null; |
| 27 | +publicUserController(IUserServicesuserService,IServiceProviderserviceProvider) |
| 28 | +{ |
| 29 | +_userService=userService; |
| 30 | +_logger=IocManage.GetLogger<UserController>(); |
| 31 | +_serviceProvider=serviceProvider; |
| 32 | +} |
| 33 | + |
| 34 | + |
| 35 | +/// <summary> |
| 36 | +/// 异步创建用户 |
| 37 | +/// </summary> |
| 38 | +/// <param name="dto"></param> |
| 39 | +/// <returns></returns> |
| 40 | +[HttpPost] |
| 41 | +[Description("异步创建用户")] |
| 42 | +//[ServiceFilter(typeof(AuditLogFilterAttribute))] |
| 43 | +publicasyncTask<AjaxResult>CreateAsync([FromBody]UserInputDtodto) |
| 44 | +{ |
| 45 | + |
| 46 | +//var validator = _serviceProvider.GetService<IModelValidator<UserInputDto>>(); |
| 47 | + |
| 48 | +//var failures = validator.Validate(new UserInputDto()); |
| 49 | +return(await_userService.CreateAsync(dto)).ToAjaxResult(); |
| 50 | +} |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | +/// <summary> |
| 55 | +/// 异步更新用户 |
| 56 | +/// </summary> |
| 57 | +/// <param name="dto"></param> |
| 58 | +/// <returns></returns> |
| 59 | + |
| 60 | +[HttpPost] |
| 61 | +[Description("异步更新用户")] |
| 62 | +//[ServiceFilter(typeof(AuditLogFilterAttribute))] |
| 63 | + |
| 64 | +publicasyncTask<AjaxResult>UpdateAsync([FromBody]UserUpdateInputDtodto) |
| 65 | +{ |
| 66 | + |
| 67 | +return(await_userService.UpdateAsync(dto)).ToAjaxResult(); |
| 68 | +} |
| 69 | + |
| 70 | +/// <summary> |
| 71 | +/// 异步删除用户 |
| 72 | +/// </summary> |
| 73 | +/// <param name="id">主键</param> |
| 74 | +/// <returns></returns> |
| 75 | + |
| 76 | +[HttpDelete] |
| 77 | +[Description("异步删除用户")] |
| 78 | +//[ServiceFilter(typeof(AuditLogFilterAttribute))] |
| 79 | +publicasyncTask<AjaxResult>DeleteAsync(Guidid) |
| 80 | +{ |
| 81 | + |
| 82 | +return(await_userService.DeleteAsync(id)).ToAjaxResult(); |
| 83 | + |
| 84 | +} |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +/// <summary> |
| 89 | +/// 异步加载用户 |
| 90 | +/// </summary> |
| 91 | +/// <param name="id">主键</param> |
| 92 | +/// <returns></returns> |
| 93 | + |
| 94 | +[HttpGet] |
| 95 | +[Description("异步加载用户")] |
| 96 | +[NoAuthorityVerification] |
| 97 | +publicasyncTask<AjaxResult>LoadAsync(Guidid) |
| 98 | +{ |
| 99 | + |
| 100 | +return(await_userService.LoadFormUserAsync(id)).ToAjaxResult(); |
| 101 | + |
| 102 | +} |
| 103 | + |
| 104 | +/// <summary> |
| 105 | +/// 用户分配角色 |
| 106 | +/// </summary> |
| 107 | +/// <returns></returns> |
| 108 | +[Description("用户分配角色")] |
| 109 | +[HttpPost] |
| 110 | +//[ServiceFilter(typeof(AuditLogFilterAttribute))] |
| 111 | +publicasyncTask<AjaxResult>AllocationRoleAsync([FromBody]UserAllocationRoleInputDtodto) |
| 112 | +{ |
| 113 | +return(await_userService.AllocationRoleAsync(dto)).ToAjaxResult(); |
151 | 114 | } |
| 115 | +/// <summary> |
| 116 | +///获取所有用户列表 |
| 117 | +/// </summary> |
| 118 | +/// <param name="dto"></param> |
| 119 | +/// <returns></returns> |
| 120 | +[HttpGet] |
| 121 | +[Description("获取所有用户列表")] |
152 | 122 |
|
153 | | -/// <summary> |
154 | | -/// 异步重置密码 |
155 | | -/// </summary> |
156 | | -/// <param name="userId">用户ID</param> |
157 | | -/// <returns></returns> |
158 | | -[HttpGet] |
| 123 | +publicasyncTask<AjaxResult>GetUsersToSelectListItemAsync() |
| 124 | +{ |
| 125 | +return(await_userService.GetUsersToSelectListItemAsync()).ToAjaxResult(); |
| 126 | +} |
| 127 | + |
| 128 | +/// <summary> |
| 129 | +/// 异步得到分页 |
| 130 | +/// </summary> |
| 131 | +/// <param name="request"></param> |
| 132 | +/// <returns></returns> |
| 133 | +[HttpPost] |
| 134 | +[Description("异步得到分页")] |
| 135 | +publicasyncTask<PageList<UserOutputPageListDto>>GetUserPageAsync([FromBody]PageRequestrequest) |
| 136 | +{ |
| 137 | +return(await_userService.GetUserPageAsync(request)).ToPageList(); |
| 138 | + |
| 139 | +} |
| 140 | +/// <summary> |
| 141 | +/// 异步得到所有用户 |
| 142 | +/// </summary> |
| 143 | +/// <returns></returns> |
| 144 | +[HttpGet] |
| 145 | +[Description("异步得到所有用户")] |
| 146 | +[NoAuthorityVerification] |
| 147 | +publicasyncTask<AjaxResult>GetUsersAsync() |
| 148 | +{ |
| 149 | + |
| 150 | +return(await_userService.GetUsersAsync()).ToAjaxResult(); |
| 151 | +} |
| 152 | + |
| 153 | +/// <summary> |
| 154 | +/// 异步重置密码 |
| 155 | +/// </summary> |
| 156 | +/// <param name="userId">用户ID</param> |
| 157 | +/// <returns></returns> |
| 158 | +[HttpGet] |
159 | 159 | [Description("异步重置密码")] |
160 | 160 | publicTask<AjaxResult>ResetPasswordAsync(GuiduserId) |
161 | 161 | { |
162 | | -return_userService.ResetPasswordAsync(userId).ToAjaxResult(); |
163 | | -} |
164 | | -} |
165 | | -} |
| 162 | +return_userService.ResetPasswordAsync(userId).ToAjaxResult(); |
| 163 | +} |
| 164 | +} |
| 165 | +} |