SmartSql 中 in (参数) 查询用法
public dynamic GetTest( string testlist) { try { IList<int> test_list = new List<int> { 1, 2, 3 }; IList<RoleMenu> lsit = chyUserService.SqlMapper.Query<RoleMenu>(new RequestContext { Scope = nameof(User), SqlId = "GetQueryTest", Request = new { Id = test_list } }); return lsit; } catch (Exception ex) { throw ex; } }
对应的xml
<Statement Id="GetQueryTest"> SELECT * from RoleMenu <Where> MenuId in( <For Prepend="" Property="Id" Separator="," > @Id </For> ) </Where> </Statement>