This commit is contained in:
parent
c286348cb0
commit
6f20622001
|
|
@ -187,26 +187,29 @@ public class ProcessInfoUtil
|
||||||
public static void setParameterFromDB (ProcessInfo pi)
|
public static void setParameterFromDB (ProcessInfo pi)
|
||||||
{
|
{
|
||||||
ArrayList<ProcessInfoParameter> list = new ArrayList<ProcessInfoParameter>();
|
ArrayList<ProcessInfoParameter> list = new ArrayList<ProcessInfoParameter>();
|
||||||
String sql = "SELECT DISTINCT pp.ColumnName," // 1
|
final String sql = "SELECT p.ParameterName," // 1
|
||||||
+ " p.P_String,p.P_String_To, p.P_Number,p.P_Number_To," // 2/3 4/5
|
+ " p.P_String,p.P_String_To, p.P_Number,p.P_Number_To," // 2/3 4/5
|
||||||
+ " p.P_Date,p.P_Date_To, p.Info,p.Info_To, " // 6/7 8/9
|
+ " p.P_Date,p.P_Date_To, p.Info,p.Info_To, " // 6/7 8/9
|
||||||
+ " i.AD_Client_ID, i.AD_Org_ID, i.AD_User_ID, " // 10..12
|
+ " i.AD_Client_ID, i.AD_Org_ID, i.AD_User_ID, " // 10..12
|
||||||
+ " COALESCE(p.IsNotClause,'N') AS IsNotClause, pp.SeqNo " // 13..14
|
+ " p.IsNotClause, p.SeqNo " // 13..14
|
||||||
|
+ "FROM AD_PInstance_Para p"
|
||||||
|
+ " INNER JOIN AD_PInstance i ON (p.AD_PInstance_ID=i.AD_PInstance_ID) "
|
||||||
|
+ "WHERE p.AD_PInstance_ID=? "
|
||||||
|
+ " UNION " /* Add as null the parameters that were not passed */
|
||||||
|
+ " SELECT pp.ColumnName, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, i.AD_Client_ID, i.AD_Org_ID, i.AD_User_ID, 'N', pp.SeqNo "
|
||||||
+ " FROM AD_PInstance i "
|
+ " FROM AD_PInstance i "
|
||||||
+ " JOIN AD_Process_Para pp ON (pp.AD_Process_ID=i.AD_Process_ID) "
|
+ " JOIN AD_Process_Para pp ON (pp.AD_Process_ID=i.AD_Process_ID AND pp.IsActive='Y') "
|
||||||
+ " LEFT JOIN AD_PInstance_Para p ON (p.AD_PInstance_ID = i.AD_PInstance_ID AND p.ParameterName=pp.ColumnName) "
|
|
||||||
+ " WHERE i.AD_PInstance_ID=? "
|
+ " WHERE i.AD_PInstance_ID=? "
|
||||||
+ "ORDER BY pp.SeqNo, pp.ColumnName, "
|
+ " AND pp.ColumnName NOT IN (SELECT ParameterName FROM AD_PInstance_Para p WHERE p.AD_PInstance_ID=?) "
|
||||||
+ " p.P_String,p.P_String_To, p.P_Number,p.P_Number_To,"
|
+ "ORDER BY SeqNo";
|
||||||
+ " p.P_Date,p.P_Date_To, p.Info,p.Info_To, "
|
|
||||||
+ " i.AD_Client_ID, i.AD_Org_ID, i.AD_User_ID, "
|
|
||||||
+ " COALESCE(p.IsNotClause,'N')";
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, pi.getAD_PInstance_ID());
|
pstmt.setInt(1, pi.getAD_PInstance_ID());
|
||||||
|
pstmt.setInt(2, pi.getAD_PInstance_ID());
|
||||||
|
pstmt.setInt(3, pi.getAD_PInstance_ID());
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue