使用entityManager做分頁查詢

2021-09-23 06:04:30 字數 1461 閱讀 6133

例子

@apioperation("pc端,根據條件查詢審批分頁資料")

}

@data

@apimodel(description = "pc,審批回參")

@apimodelproperty("審批uuid")

private string uuid;

@apimodelproperty("客戶名")

private string customername;

@apimodelproperty("賠款金額或退款金額")

private bigdecimal payamount;

@apimodelproperty("服務名稱")

private string servername;

@apimodelproperty("申請型別,0:轉會、1:延期、2:賠償、3:退項、4:退卡、5:餘項調整、6:餘額調整")

private integer type;

@apimodelproperty("申請型別名稱")

private string typename;

@apimodelproperty("申請人(顧問)名稱")

@apimodelproperty("顧問所在門店名")

private string storename;

@apimodelproperty("品牌名")

private string suppliername;

@apimodelproperty("狀態,0:待審核、1:已通過、2:已拒絕、3:異常失敗、4:系統處理中")

private integer state;

@apimodelproperty("狀態,0:待審核、1:已通過、2:已拒絕、3:異常失敗、4:系統處理中")

private string statename;

@apimodelproperty("申請時間")

private string date;

@apimodelproperty("更新時間")

private string updatetime;

public string gettypename()

public string getstatename()

}

工廠類

uuidlistdto dto = storeclient.getstoreuuids();

if (dto == null || dto.getuuids() == null || dto.getuuids().size() == 0)

userdto userdto = contextutil.getcurrentuser();

pcqueryvo.setsuppliercode(userdto.getsuppliercode());

return readvopage;

}

使用EntityManager操作實體

顧名思義,實體管理器entitymanager是負責管理entity的物件。對entity的操作包括新增 刪除 修改和查詢,都是通過實體管理器來實現的。在ejb容器中,entitymanager的獲得可以通過標註,使用依賴注入來建立entitymanager例項,如下所示。persistenceco...

EntityManager常用API簡單備忘

1 find getreference 獲得實體,類似getbyid。2 persist 將資料儲存到資料庫中,傳遞的引數必須是實體bean,類似insert。3 當實體正在被容器管理時,你可以呼叫實體的set方法對資料進行修改,在容器決定flush時 這個由container自行判斷 更新的資料才...

entityManager 的常用方法(一)

理解eneitymanager的這三個方法的作用和區別,首先需要分清楚persistencecontext 和 entitymanager.persistencecontext 是entity的乙個例項。entitymanager 是和persistencecontext聯絡在一起的,被用來建立 刪...