네 이 티 브 SQL 구성 조회

String sql = "SELECT gather.dwid,gather.dwname,recorditem.unit,record.id equiprecordid,record.equipname FROM eqm_equipgather_item gather LEFT JOIN eqm_equiprecord_item recorditem ON gather.equiprecorditemid =recorditem.id LEFT JOIN eqm_equiprecord record ON recorditem.equiprecordid =record.id WHERE record.equipmodelid = "
								+ equipmodelid + " AND gather.dwname LIKE '%" + displayconfig.getDisplayname()
								+ "%' AND gather.tenantid = " + tenantid + "";

						Query query = em.createNativeQuery(sql);
						query.unwrap(SQLQuery.class).addScalar("dwid", StandardBasicTypes.STRING)
								.addScalar("dwname", StandardBasicTypes.STRING)
								.addScalar("equiprecordid", StandardBasicTypes.LONG)
								.addScalar("unit", StandardBasicTypes.STRING)
								.addScalar("equipname", StandardBasicTypes.STRING)
								.setResultTransformer(Transformers.aliasToBean(EquipgatheritemVo.class));
						List gatherList = query.getResultList();

좋은 웹페이지 즐겨찾기