mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'dev-1' into 'master'
Fix validation of appname when a webclip is created See merge request entgra/carbon-device-mgt!874
This commit is contained in:
commit
d21782160a
@ -1737,12 +1737,24 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
|
|||||||
+ "AP_APP.NAME = ? AND "
|
+ "AP_APP.NAME = ? AND "
|
||||||
+ "AP_APP.DEVICE_TYPE_ID = ? AND "
|
+ "AP_APP.DEVICE_TYPE_ID = ? AND "
|
||||||
+ "AP_APP.TENANT_ID = ?";
|
+ "AP_APP.TENANT_ID = ?";
|
||||||
|
if(deviceTypeId != -1){
|
||||||
|
sql = "SELECT AP_APP.ID AS ID "
|
||||||
|
+ "FROM AP_APP "
|
||||||
|
+ "WHERE "
|
||||||
|
+ "AP_APP.NAME = ? AND "
|
||||||
|
+ "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)){
|
||||||
stmt.setString(1, appName);
|
if(deviceTypeId != -1){
|
||||||
stmt.setInt(2, deviceTypeId);
|
stmt.setString(1, appName);
|
||||||
stmt.setInt(3, tenantId);
|
stmt.setInt(2, tenantId);
|
||||||
|
} else {
|
||||||
|
stmt.setString(1, appName);
|
||||||
|
stmt.setInt(2, deviceTypeId);
|
||||||
|
stmt.setInt(3, tenantId);
|
||||||
|
}
|
||||||
try (ResultSet rs = stmt.executeQuery()){
|
try (ResultSet rs = stmt.executeQuery()){
|
||||||
return rs.next();
|
return rs.next();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user