public T_approvalProcess queryById(String approve_Id, String ap_id) {
StringBuffer str = new StringBuffer("SELECT ap.*,ar.* FROM t_approvalProcess AS ap JOIN t_approverecord AS ar ON ap.approvalRecordId = ar.alp_id WHERE 1 = 1 ");
if (Strings.isNotBlank(approve_Id)) str.append(" AND ap.ap_id = @ap_id ");
if (Strings.isNotBlank(ap_id)) str.append(" AND ar.approve_Id = @approve_Id ");
Sql sql = Sqls.queryRecord(str.toString());
sql.params().set("ap_id", ap_id);
sql.params().set("approve_Id", approve_Id);
dao.execute(sql);
List<Record> records = sql.getList(Record.class);
T_approvalProcess approvalProcess = null;
for (Record r : records) {
approvalProcess = r.toEntity(dao.getEntity(T_approvalProcess.class));
T_approverecord approverecord = r.toEntity(dao.getEntity(T_approverecord.class));
approvalProcess.setApproverecord(approverecord);
}
return approvalProcess;
}