public ProductTypePageInfoResponse GetPageInfoList(ProductTypeMapRequest request) { var response = new ProductTypePageInfoResponse(); response.DataList = ProductItemTypeRepository.GetPageInfoList(request, out int total); response.Total = total; return(response); }
public BaseResponse GetPageInfoList(ProductTypeMapRequest request) { try { var response = ProductItemTypeDomainService.GetPageInfoList(request); return(ApiSuccessResult(response)); } catch (Exception ex) { return(ApiErrorResult(ex.Message)); } }
public List <ProductTypePageInfo> GetPageInfoList(ProductTypeMapRequest request, out int total) { StringBuilder _query = new StringBuilder(); _query.Append(@"select a.Id,c.SysDictValue PocSource,a.TeachLevelOneOrgName LevelOneOrgName,a.ProductTypeName,a.ProductTypeID,a.NodeFlag, case when b.Id is null then '否' else '是' end IsMapping,b.ProductTypeMapGuid,b.UpdateDate MappingDateDate , STUFF((SELECT '>'+ltrim(ProductTypeName) FROM T_POC_ProductType where CAST(ProductTypeGuid as varchar(36)) in (select Code from [dbo].[f_split](b.ProductTypeTitle,',') ) FOR XML PATH(''),TYPE).value('.','nvarchar(max)'), 1, 1, '')+'|'+b.ProductTypeTitle ProductTypeTitle from T_EXT_ItemType a left join T_POC_ProductTypeMap b on b.FKItemTypeId = a.id left join [T_SYS_Dictionary] c on c.SysDictKey = cast(a.POCSource as nvarchar)"); var _parameters = new DynamicParameters(); var _where = new StringBuilder(" where 1 = 1"); if (request.PocSource?.Count > 0) { _where.Append(" and a.POCSource in @Pocsource"); _parameters.Add("@Pocsource", request.PocSource.ToArray()); } if (request.LevelOneOrgID?.Count > 0) { _where.Append(" and a.TeachLevelOneOrgID in @OneOrgId"); _parameters.Add("@OneOrgId", request.LevelOneOrgID.ToArray()); } if (!string.IsNullOrWhiteSpace(request.IsMapping)) { if (request.IsMapping.Equals("0")) { _where.Append(" and b.Id is null"); } if (request.IsMapping.Equals("1")) { _where.Append(" and b.Id is not null"); } } var countsql = @"select count(1) from T_EXT_ItemType a left join T_POC_ProductTypeMap b on b.FKItemTypeId = a.id left join [T_SYS_Dictionary] c on c.SysDictKey = cast(a.POCSource as nvarchar)" + _where.ToString(); total = GetInfos <int>(EumDBName.POC, countsql, _parameters).First(); return(GetPageInfos <ProductTypePageInfo>(EumDBName.POC, _query.ToString() + _where.ToString(), "a.Id ASC", request.PageIndex, request.PageSize, _parameters).ToList()); }