29
07月
2019
LIKE '%@Title%' 会解析成'%'@Title'%' 这里用拼接也是不行的'%'+@Title+'%' 只能用MySQL函数方法拼接
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public dynamic GetListByFilter(ArticleModel filter, PageInfo pageInfo) { string _where = " where 1=1"; if (!string.IsNullOrEmpty(filter.Title)) { //LIKE '%@Title%' 会解析成'%'@Title'%' 这里用拼接也是不行的'%'+@Title+'%' 只能用MySQL函数方法拼接 _where += " and Title LIKE CONCAT('%',@Title,'%')"; } if (filter.Status != null) { _where += " and Status=@Status"; } return GetListByFilter(filter, pageInfo, _where); } |
非特殊说明,本文版权归 毅力航程 所有,转载请注明出处.