88 lines
2.6 KiB
C#
88 lines
2.6 KiB
C#
using System;
|
|
using SqlSugar;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using DOAN.Model;
|
|
using DOAN.Model.Dto;
|
|
using DOAN.Model.MES.base_;
|
|
using DOAN.Model.MES.base_.Dto;
|
|
using DOAN.Repository;
|
|
using DOAN.Service.MES.base_.IService;
|
|
|
|
|
|
|
|
namespace DOAN.Service.MES.base_
|
|
{
|
|
/// <summary>
|
|
/// 组Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IBaseGroupService), ServiceLifetime = LifeTime.Transient)]
|
|
public class BaseGroupService : BaseService<BaseGroup>, IBaseGroupService
|
|
{
|
|
/// <summary>
|
|
/// 查询组列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<BaseGroupDto> GetList(BaseGroupQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<BaseGroup>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.GroupCode), it => it.GroupCode == parm.GroupCode)
|
|
.AndIF(!string.IsNullOrEmpty(parm.GroupName), it => it.GroupName == parm.GroupName)
|
|
.AndIF(parm.Status > 0, it => it.Status == parm.Status);
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<BaseGroup, BaseGroupDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public BaseGroup GetInfo(int Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加组
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public BaseGroup AddBaseGroup(BaseGroup model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改组
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateBaseGroup(BaseGroup model)
|
|
{
|
|
//var response = Update(w => w.Id == model.Id, it => new BaseGroup()
|
|
//{
|
|
// GroupName = model.GroupName,
|
|
// Remark = model.Remark,
|
|
// Status = model.Status,
|
|
// CreatedBy = model.CreatedBy,
|
|
// CreatedTime = model.CreatedTime,
|
|
// UpdatedBy = model.UpdatedBy,
|
|
// UpdatedTime = model.UpdatedTime,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
}
|
|
} |