string.Join 拼接在sql中特殊处理

 

string strTripID = string.Join(",", model.TripList.Select(s => "'" + s.TripID + "'"));   

var togetherList = itogetheremployeeservice.GetTogetherEmployee(strTripID);

    public List<T_TOGETHEREMPLOYEE> GetTogetherEmployee(string bizID)
    {
        var tmpList = Filter(item => bizID.Contains(item.BizID)).ToList();
        return tmpList;
    }


// string str = string.Join(",", App.Select(s => "'" + s + "'"));

string strTripID = string.Join(",", returnValue.TripList.Select(s => "'" + s.TripID + "'"));
string sqlStr = " select * from T_TOGETHEREMPLOYEE where BizID in (" + strTripID + ") ";
var togetherList = AppBaseServiceHelper.GetList<TOGETHEREMPLOYEEModel>(sqlStr, null);

 

posted @ 2020-03-10 14:07  *人丑就该多读书*  阅读(794)  评论(0编辑  收藏  举报