Merge branch 'location-history' into 'corrective-policy'

Fix store app loading issue

See merge request entgra/carbon-device-mgt!683
4.x.x
Dharmakeerthi Lasantha 4 years ago
commit 4b5d577d33

@ -173,14 +173,14 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
if (deviceTypeId != -1) { if (deviceTypeId != -1) {
sql += "AND AP_APP.DEVICE_TYPE_ID = ? "; sql += "AND AP_APP.DEVICE_TYPE_ID = ? ";
} }
sql += "GROUP BY AP_APP.ID "; sql += "GROUP BY AP_APP.ID ORDER BY AP_APP.ID ";
if (StringUtils.isNotEmpty(filter.getSortBy())) { if (StringUtils.isNotEmpty(filter.getSortBy())) {
sql += "ORDER BY ID " + filter.getSortBy() +" "; sql += filter.getSortBy() +" ";
} }
if (filter.getLimit() != -1) { if (filter.getLimit() != -1) {
sql += "LIMIT ? OFFSET ? "; sql += "LIMIT ? OFFSET ? ";
} }
sql += ") AS app_data ON app_data.ID = AP_APP.ID WHERE AP_APP.TENANT_ID = ?"; sql += ") AS app_data ON app_data.ID = AP_APP.ID WHERE AP_APP.TENANT_ID = ? ORDER BY AP_APP.ID";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {

@ -118,15 +118,14 @@ public class OracleApplicationDAOImpl extends GenericApplicationDAOImpl {
if (deviceTypeId != -1) { if (deviceTypeId != -1) {
sql += "AND AP_APP.DEVICE_TYPE_ID = ? "; sql += "AND AP_APP.DEVICE_TYPE_ID = ? ";
} }
sql += "GROUP BY AP_APP.ID "; sql += "GROUP BY AP_APP.ID ORDER BY AP_APP.ID ";
if (StringUtils.isNotEmpty(filter.getSortBy())) { if (StringUtils.isNotEmpty(filter.getSortBy())) {
sql += "ORDER BY ID " + filter.getSortBy() + " "; sql += filter.getSortBy() +" ";
} }
if (filter.getLimit() != -1) { if (filter.getLimit() != -1) {
sql += "OFFSET ? ROWS FETCH NEXT ? ROWS ONLY "; sql += "OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ";
} }
sql += ") AS app_data ON app_data.ID = AP_APP.ID " + sql += ") AS app_data ON app_data.ID = AP_APP.ID WHERE AP_APP.TENANT_ID = ? ORDER BY AP_APP.ID";
"WHERE AP_APP.TENANT_ID = ?";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {

@ -117,15 +117,14 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl {
if (deviceTypeId != -1) { if (deviceTypeId != -1) {
sql += "AND AP_APP.DEVICE_TYPE_ID = ? "; sql += "AND AP_APP.DEVICE_TYPE_ID = ? ";
} }
sql += "GROUP BY AP_APP.ID "; sql += "GROUP BY AP_APP.ID ORDER BY AP_APP.ID ";
if (StringUtils.isNotEmpty(filter.getSortBy())) { if (StringUtils.isNotEmpty(filter.getSortBy())) {
sql += "ORDER BY ID " + filter.getSortBy() + " "; sql += filter.getSortBy() +" ";
} }
if (filter.getLimit() != -1) { if (filter.getLimit() != -1) {
sql += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY "; sql += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ";
} }
sql += ") AS app_data ON app_data.ID = AP_APP.ID " + sql += ") AS app_data ON app_data.ID = AP_APP.ID WHERE AP_APP.TENANT_ID = ? ORDER BY AP_APP.ID";
"WHERE AP_APP.TENANT_ID = ?";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {

Loading…
Cancel
Save