文章标题

第三步 action
package com.isoftstone.zfmi.struts.action.claim;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.isoftstone.iaeap.op.DBPersistenceManager;
import com.isoftstone.iaeap.op.OPSysManager;
import com.isoftstone.iaeap.op.QuerySet;

import com.isoftstone.zfmi.boc.Application.entity.Code;
import com.isoftstone.zfmi.boc.Application.entity.Codefilee;

/**
* @author 1
* wj 编码规则多级菜单的跳转
*
*/
public class ProjectAction extends Action{

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    // TODO 自动生成方法存根

     String aa = request.getParameter("project");


    List realsubcodetypeList = new ArrayList();
    List<Codefilee> list4 = new ArrayList();

        Object[] paras = {};

        DBPersistenceManager dbpm = OPSysManager.getInstance().getDBPersistenceManager();



     try{
         dbpm.currentTransaction().begin();

         String sql3="SELECT a.realsubcodetype FROM tb_code_filee a where flag='1' group by realsubcodetype,grade order by grade";

         QuerySet dptSet2 = dbpm.executeQuery(sql3, paras);
         int num3 = dptSet2.getRowCount();
            if(num3>0){
                 for( int i=1; i<= num3; i++ ){
                     String realsubcodetype =dptSet2.getString(i,"realsubcodetype");//标题编号 
                     realsubcodetypeList.add(realsubcodetype);

                 }
            }
            for (int i = 0; i < realsubcodetypeList.size(); i++) {
                String strRealsubcodetype = (String)realsubcodetypeList.get(i);

                Object[] paras1 = {strRealsubcodetype};


            String sql1 = " SELECT t.* FROM tb_code_filee t where realsubcodetype=? ";
            QuerySet dptSet = dbpm.executeQuery(sql1, paras1);
            int num = dptSet.getRowCount();
             if(num>0){
                 List list = new ArrayList();
                 for( int j=1; j<= num; j++ ){
                    String codecode= dptSet.getString(j,"codecode");//上级代码
                    String subcode = dptSet.getString(j,"subcode");//本级代码
                    String realsubcode= dptSet.getString(j,"realsubcode");//本级编号
                    String realsubcodetype =dptSet.getString(j,"realsubcodetype");//标题编号
                    String realsubcname = dptSet.getString(j,"realsubcname");//标题名字
                    String subcodecname = dptSet.getString(j,"subcodecname");//属性中文名
                    String grade = dptSet.getString(j,"grade");//等级
                    Code code =new Code();
                    code.setCodecode(codecode);
                    code.setSubcode (subcode );
                    code.setRealsubcode(realsubcode);
                    code.setRealsubcodetype(realsubcodetype);
                    code.setRealsubcname(realsubcname);
                    code.setSubcodecname(subcodecname);
                    code.setGrade(grade);
                    list.add(code);                     
                }

                    Codefilee codefileeDto = new Codefilee();
                    codefileeDto.setTitleName(((Code)list.get(0)).getRealsubcname());
                    codefileeDto.setGrade(((Code)list.get(0)).getGrade());
                    codefileeDto.setSubCode(((Code)list.get(0)).getSubcode());
                    codefileeDto.setRealsubcode(((Code)list.get(0)).getRealsubcode());
                    codefileeDto.setCodecode(((Code)list.get(0)).getCodecode());
                    codefileeDto.setListcode(list);
                    list4.add(codefileeDto);
                }
            }

              dbpm.currentTransaction().commit();
                dbpm.close();
     }catch(Exception ex){

     }

        request.setAttribute("list4", list4);//传值到前端
        //log.debug(mapping.getInputForward());
     return mapping.findForward("result");  //返回到配置文件指定路径跳转jsp页面 result



}

}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值