public ResponseUserListSearch UserListSearch(RequestUserListSearch request) { ResponseUserListSearch response = new ResponseUserListSearch(); using (cnn = GetConnection()) { var ts = cnn.BeginTransaction(); try { var user = UserInfoGetButAccount(request.Token, ts); string sql = this.GetPageSql("A.*", @"TKS_FAS_User A left join TKS_FAS_User2Node B on A.id=B.userid where B.nodeid=@NodeId and (A.userName like @UserName or A.trueName like @TrueName)", "createDate desc", request.PageSize, request.PageIndex); List <TKS_FAS_UserExt> data = cnn.Query <TKS_FAS_UserExt>(sql, new { UserName = "******" + request.UserName + "%", TrueName = "%" + request.TrueName + "%", NodeId = user.Node.Id }, ts).ToList(); string countSql = @"select count(1) from tks_fas_User A left join TKS_FAS_User2Node B on A.id=B.userid where B.nodeid=@NodeId and (username like @UserName or trueName like @TrueName)"; int total = int.Parse(cnn.ExecuteScalar(countSql, new { UserName = "******" + request.UserName + "%", TrueName = "%" + request.TrueName + "%", NodeId = user.Node.Id }, ts).ToString()); ts.Commit(); response.IsSuccess = true; response.Message = "加载完毕"; response.PageIndex = request.PageIndex; response.Data = data; response.Total = total; return(response); } catch (Exception ex) { ts.Rollback(); return(this.DealException(response, ex) as ResponseUserListSearch); } } }
public ResponseUserListSearch UserListSearch([FromBody] RequestUserListSearch request) { try { PermissionBLL bll = new PermissionBLL(); return(bll.UserListSearch(request)); } catch (Exception ex) { throw new HttpResponseException( Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }