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.
58 lines
1.5 KiB
58 lines
1.5 KiB
using Wood.Data.Repository;
|
|
using Wood.Entity;
|
|
using Wood.Entity.SystemManage;
|
|
using Wood.Service.BaseService;
|
|
using Wood.Service.SystemManage.Param;
|
|
using Wood.Util;
|
|
|
|
namespace Wood.Service.SystemManage
|
|
{
|
|
/// <summary>
|
|
/// 职位管理
|
|
/// </summary>
|
|
public class PositionService : ApiCRUDService<PositionEntity, PositionEntity, PositionAddParam, PositionUpdateParam>
|
|
{
|
|
public PositionService(SqlSugarRepository<PositionEntity> repository) : base(repository)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页查询职位
|
|
/// </summary>
|
|
/// <param name="param"></param>
|
|
/// <returns></returns>
|
|
public async Task<TDataPaged<PositionEntity>> Paged(PositionPagedParam param)
|
|
{
|
|
return await _repository.AsQueryable()
|
|
.WhereIF(!string.IsNullOrEmpty(param.Name), it => it.PositionName.Contains(param.Name!) || it.FormCode.Contains(param.Name!))
|
|
.ToPagedListAsync(param);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取职位信息列表用于选择
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<ElSelectDto>> SelectList()
|
|
{
|
|
return await _repository.AsQueryable()
|
|
.Where(it => it.Status == 1)
|
|
.Select(it => new ElSelectDto()
|
|
{
|
|
Label = it.PositionName,
|
|
Disabled = false,
|
|
Value = it.Id.ToString()
|
|
}).ToListAsync();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取一个最大的sort数字
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<int> GetMaxSort()
|
|
{
|
|
var result = await _repository.AsQueryable().MaxAsync(it => it.Sort);
|
|
return result + 10;
|
|
}
|
|
|
|
}
|
|
}
|
|
|