Dapper 参数化查询:
对于此种查询:id in(1,2,3,4) ,code in('a','b','c') ,传参:List<int> id ,List<string> code .实列如下:
public List<Evaluation_SelfAssessment_details_ChildEntity> GetChildListByIndexIds(int selfId, List<int> indexIds)
{
DynamicParameters Parameters = new DynamicParameters();
Parameters.Add("SelfId", selfId);
Parameters.Add("indexIds", indexIds);
string sql = @"SELECT a.id,a.IndexId,a.ChildId,a.Indexvalue_Code,a.Indexvalue
FROM [dbo].[Evaluation_SelfAssessment_details_Child] a WHERE a.SelfId=@SelfId AND a.IndexId IN @indexIds ";
return _Respository.GetListWithSql(sql, Parameters);
}