基础服务api
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

35 lines
1.2 KiB

  1. using BPA.SAAS.Manage.Application.Org.Dtos.Users;
  2. using BPA.SAAS.Manage.Application.Org.Interface;
  3. using BPA.SAAS.Manage.Application.Org.Interface;
  4. using BPA.SAAS.Manage.Comm.Const;
  5. using BPA.SAAS.Manage.Core.Org;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace BPA.SAAS.Manage.Application.Org.Services
  12. {
  13. public class UserService : IUserService, ITransient
  14. {
  15. private readonly ISqlSugarClient _db;
  16. public UserService(ISqlSugarClient db)
  17. {
  18. _db=db;
  19. }
  20. public async Task<bool> AddUser(UserDtoInput input)
  21. {
  22. var user = input.Adapt<BPA_Users>();
  23. user.Id= Guid.NewGuid().ToString();
  24. user.Password = MD5Encryption.Encrypt("123456").ToLower();
  25. user.CreateAt=DateTime.Now;
  26. user.CreateBy = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
  27. var check = _db.Queryable<BPA_Users>().First(t => t.Account == user.Account);
  28. if (check != null)
  29. return false;
  30. return await _db.Insertable(user).ExecuteCommandAsync()> 0;
  31. }
  32. }
  33. }