12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using AutoMapper;
- using OASystem.Domain.Entities.Groups;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OASystem.Infrastructure.Repositories.Groups
- {
- public class GroupCostParameterRepository : BaseRepository<Grp_GroupCostParameter, Grp_GroupCostParameterView>
- {
- public GroupCostParameterRepository(SqlSugarClient sqlSugar) :
- base(sqlSugar)
- {
- }
- public List<Grp_GroupCostParameter> GetGroupCostParameterListByDiid(int diid)
- {
- return Query(x=>x.DiId == diid).ToList();
- }
- public async Task<bool> SaveAsync(List<Grp_GroupCostParameter> List,int UserId)
- {
- var AddList = List.Where(x => x.Id == 0).ToList();
- var UpdateList = List.Where(x => x.Id != 0).ToList();
- BeginTran();
- bool isTrue = false;
- if (AddList.Count > 0)
- {
- AddList.ForEach(x => { x.CreateUserId = UserId; x.CreateTime = DateTime.Now; });
- isTrue = Adds(AddList) > 0;
- }
- if (UpdateList.Count > 0)
- {
- isTrue = await _sqlSugar.Updateable<Grp_GroupCostParameter>(UpdateList).ExecuteCommandHasChangeAsync();
- }
- return isTrue;
- }
- }
- }
|