/// <summary> /// 明细列表 /// </summary> /// <param name="itemId">分类Id</param> /// <returns></returns> public IEnumerable <DataItemDetailEntity> GetList(string itemId) { var sql = PetaPoco.Sql.Builder.Append(@"select * from Base_DataItemDetail where 1=1"); if (!string.IsNullOrEmpty(itemId)) { sql.Append(" and ItemId=@0", itemId); } sql.Append(" order by SortCode"); var list = Base_DataItemDetail.Query(sql); return(EntityConvertTools.CopyToList <Base_DataItemDetail, DataItemDetailEntity>(list.ToList())); }
/// <summary> /// 项目值不能重复 /// </summary> /// <param name="itemValue">项目值</param> /// <param name="keyValue">主键</param> /// <param name="itemId">分类Id</param> /// <returns></returns> public bool ExistItemValue(string itemValue, string keyValue, string itemId) { var sql = PetaPoco.Sql.Builder.Append(@"select * from Base_DataItemDetail where 1=1 "); if (!string.IsNullOrEmpty(itemId)) { sql.Append(" and (ItemValue=@0 and ItemId=@1)", itemValue, itemId); } if (!string.IsNullOrEmpty(keyValue)) { sql.Append(" and ItemDetailId!=@0", keyValue); } return(Base_DataItemDetail.Query(sql).Count() == 0 ? true : false); }