| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- package xin.glue.ui.B.common;
- import com.posdata.glue.biz.activity.PosActivity;
- import com.posdata.glue.biz.constants.PosBizControlConstants;
- import com.posdata.glue.context.PosContext;
- import com.posdata.glue.dao.vo.PosParameter;
- /**
- *
- * @Description 增、删、改
- * @author 梅贵平{meiguiping}
- * @date 2011-01-07 下午07:42:42
- * @JDK Version jdk1.4.2
- */
- public class XgSimpleModify extends PosActivity
- {
- public String runActivity(PosContext context)
- {
- PosParameter posParam = null;
-
- String sCount = this.getProperty("sqlCount");
- if(sCount == null)
- return PosBizControlConstants.SUCCESS;
-
- String[] simpleStatus = (String[])context.get("RowStatus");
- int iCount = Integer.parseInt(sCount.trim());//获取所对应的sql语句的个数
- String[] sql = new String[iCount];//定义存放sqllist的数组
- String[] nodeList = new String[iCount];//定义存放各sql语句参数的数组
- String[] param = null;
-
- int j =0;
- for(int i = 0; i < iCount; i++)
- {
- posParam = new PosParameter();
- j = 0;
- sql[i] = this.getProperty("sqlkey"+i);//sql
- nodeList[i] = this.getProperty("param"+i);//参数
- param = nodeList[i].split("\\|"); //注,不考虑没有参数的情况,作为DML语句,必须存在参数
- for(int s = 0; s < simpleStatus.length; s++)
- {
- if("i".equals(simpleStatus[s]))
- {
- for(int pi = 0; pi < param.length; pi++)
- {
- posParam.setValueParamter(j++, ((String[])context.get(param[pi]))[s] );
- }
- this.getDao("mesdao").insert(sql[i], posParam);
- }
- else if("u".equals(simpleStatus[s]))
- {
- for(int pi = 0; pi < param.length; pi++)
- {
- posParam.setWhereClauseParameter(j++, ((String[])context.get(param[pi]))[s] );
- }
- this.getDao("mesdao").update(sql[i], posParam);
- }
- else if("d".equals(simpleStatus[s]))
- {
- for(int pi = 0; pi < param.length; pi++)
- {
- posParam.setWhereClauseParameter(j++, ((String[])context.get(param[pi]))[s] );
- }
- this.getDao("mesdao").delete(sql[i], posParam);
- }
- }
- }
-
- return PosBizControlConstants.SUCCESS;
- }
- }
|