zhuangpei-mesbackend/DOAN.Service/MES/group/GroupPersonSkillMatrixService.cs
2024-08-12 15:13:24 +08:00

94 lines
2.9 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Model.Dto;
using DOAN.Model.MES.group;
using DOAN.Model.MES.group.Dto;
using DOAN.Repository;
using DOAN.Service.group.IService;
using System.Linq;
namespace DOAN.Service.group
{
/// <summary>
/// 人员技能矩阵图Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IGroupPersonSkillMatrixService), ServiceLifetime = LifeTime.Transient)]
public class GroupPersonSkillMatrixService : BaseService<GroupPersonSkill>, IGroupPersonSkillMatrixService
{
/// <summary>
/// 查询人员技能矩阵图列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<GroupPersonSkillMatrixDto> GetList(GroupPersonSkillMatrixQueryDto parm)
{
var predicate = Expressionable.Create<GroupPersonSkill>()
.AndIF(!string.IsNullOrEmpty(parm.SkillName),it=>it.SkillName.Contains(parm.SkillName))
.AndIF(parm.Status>0,it=>it.Status==parm.Status)
;
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<GroupPersonSkill, GroupPersonSkillMatrixDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public GroupPersonSkill GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加人员技能矩阵图
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public GroupPersonSkill AddGroupPersonSkillMatrix(GroupPersonSkill model)
{
if(string.IsNullOrEmpty(model.Id))
{
model.Id = XueHua;
}
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改人员技能矩阵图
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateGroupPersonSkillMatrix(GroupPersonSkill model)
{
//var response = Update(w => w.Id == model.Id, it => new GroupPersonSkill()
//{
// SkillName = model.SkillName,
// Image = model.Image,
// Vedio = model.Vedio,
// Remark = model.Remark,
// Status = model.Status,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}