1
huanghongfeng
2024-11-27 1dd9f4bf540a74a7de2daeeebf38491f86befa08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Basic;
using WIDESEA_IBasicRepository;
using WIDESEA_Model.Models;
 
namespace WIDESEA_BasicRepository
{
    public class CachePointRepository : RepositoryBase<Dt_CachePoint>, ICachePointRepository
    {
        public CachePointRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
        {
        }
 
        public List<CachePointGroupDTO> GetCachePointGroups(int areaId, LocationStatusEnum locationAStatus, LocationStatusEnum locationBStatus)
        {
           return Db.Queryable<Dt_CachePoint>().Where(a => a.Depth == 1 && a.AreaId == areaId && a.PointStatus == locationAStatus.ObjToInt() && a.PointStatus == locationAStatus.ObjToInt()).InnerJoin(Db.Queryable<Dt_CachePoint>().Where(b => b.Depth == 2 && b.AreaId == areaId && b.PointStatus == locationBStatus.ObjToInt() && b.PointStatus == locationBStatus.ObjToInt()), (a, b) => a.Column == b.Column && a.AreaId == b.AreaId && a.Row != b.Row && SqlFunc.Abs(a.Row - b.Row) == 1).Select((a, b) => new CachePointGroupDTO { DepthA = a.Depth, DepthB = b.Depth, EnableStatusA = a.EnableStatus, EnableStatusB = b.EnableStatus, IdA = a.Id, IdB = b.Id, PointCodeA = a.PointCode, PointCodeB = b.PointCode, PointStatusA = a.PointStatus, PointStatusB = b.PointStatus, PointTypeA = a.PointType, PointTypeB = b.PointType }).ToList();
        }
    }
}