1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using AutoMapper;
- using OASystem.Domain;
- using OASystem.Domain.Dtos.Groups;
- using OASystem.Domain.Entities.Groups;
- using OASystem.Domain.Entities.Resource;
- using OASystem.Domain.ViewModels.Groups;
- using OASystem.Infrastructure.Repositories.System;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OASystem.Infrastructure.Repositories.Groups
- {
- public class DecreasePaymentsRepository : BaseRepository<Grp_DecreasePayments, Grp_DecreasePayments>
- {
- private readonly IMapper _mapper;
- public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar)
- {
- this._mapper = mapper;
- }
- /// <summary>
- /// 根据团组Id查询数据
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- public async Task<Result> DecreasePaymentsList(DecreasePaymentsListDto dto)
- {
- Result result = new Result() { Code = -2, Msg = "未知错误" };
- try
- {
- string sql = string.Format(@"select Id,DiId,PriceName,Price,(select name from Sys_SetData where id=s.Currency) as Currency,FilePath,
- (select CnName from Sys_Users where Id=s.CreateUserId) as 'CreateUserName',CreateTime,(select IsAuditGM from
- Grp_CreditCardPayment where CTable=98 and CId=s.Id) as 'isAudit' from Grp_DecreasePayments s where DIID={0} and IsDel=0 ", dto.DiId);
- List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
- if (_DecreasePayments.Count != 0)
- {
- result = new Result() { Code = 0, Msg = "查询成功!",Data=_DecreasePayments };
- }
- else
- {
- result = new Result() { Code = 0, Msg = "暂无数据!", Data = _DecreasePayments };
- }
- }
- catch (Exception ex)
- {
- result = new Result() { Code = -2, Msg = "未知错误" };
- }
- return result;
- }
- public async Task<Result> DecreasePaymentsSelect(DecreasePaymentsDto dto)
- {
- Result result = new Result() { Code = -2, Msg = "未知错误" };
- try
- {
- #region 团组下拉框
- List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == 98).ToList();
- string DiId = "";
- foreach (var item in grp_GroupsTaskAssignment)
- {
- DiId += item.DIId + ",";
- }
- DiId = DiId.Substring(0, DiId.Length - 1);
- string sql = string.Format(@"select * from Grp_DelegationInfo where Id in({0}) and IsDel={1}", DiId, 0);
- List<Grp_DelegationInfo> grp_Delegations = _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
- if (grp_Delegations.Count == 0)
- {
- return result = new Result() { Code = -1, Msg = "查询失败!" };
- }
- #endregion
- #region 其他下拉框查询
-
- //支付方式
- List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
- List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
- #endregion
- var data = new
- {
- Payment = _Payment,
- GroupName = grp_Delegations,
- };
- return result = new Result() { Code = 0, Msg = "查询成功!", Data = data };
- }
- catch (Exception ex)
- {
- return result = new Result() { Code = -2, Msg = "程序错误" };
- throw;
- }
- }
- }
- }
|