General.Services/Department/DepartmentService.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using AutoMapper;
using General.Core.Data;
using General.Entities.Data;
using General.Entities.Models;
using General.Entities.ViewData.Department;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace General.Services.Department
{
public class DepartmentService : IDepartmentService
{
private readonly IRepository<tc_department> tc_DepartmentRepository;
private readonly IRepository<tc_departmentaccount> tc_DepartmentaccountRepository;
private readonly IMapper mapper;
public DepartmentService(IRepository<tc_department> tc_departmentRepository,
IRepository<tc_departmentaccount> tc_departmentaccountRepository,
IMapper mapper)
{
tc_DepartmentRepository = tc_departmentRepository;
tc_DepartmentaccountRepository = tc_departmentaccountRepository;
this.mapper = mapper;
}
/// <summary>
/// 获取列表信息
/// </summary>
/// <returns></returns>
public async Task<AdminResult> GetList()
{
AdminResult result = new AdminResult();
var res = await tc_DepartmentRepository.GetAllAsync().OrderBy(x=>x.seq).ToListAsync();
var data = mapper.Map<List<DepartmentModel>>(res);
result.count = data.Count();
result.data = data;
result.code = 0;
return result;
}
/// <summary>
/// 根据id查询
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<tc_department> GetDataByID(int id)
{
var data = await tc_DepartmentRepository.GetAsync(x => x.id == id);
return data;
}
/// <summary>
/// 添加机构数据
后面还有 138 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
