• 当findById(Integer id)变成String类型


    1、原Action

    // 添加跳转
        @RequiresPermissions("pdaManager:v_add")
        @RequestMapping("/pdaManager/v_add.do")
        public String add(HttpServletRequest request, ModelMap model) {
            List<BeanDataDictionary> sbztList = dataMng.findByPid(128);
            List<BeanEquipmentModel> list = equipMng.getList();
            List<BeanEquipmentModel> zdxhList = new ArrayList<BeanEquipmentModel>();
            for(BeanEquipmentModel equip : list){
                 BeanFacturer facture = facMng.findById(equip.getFacturerId());
                 BeanEquipmentModel bean = new BeanEquipmentModel();
                 bean.setModel_code(equip.getModel_code()+"("+facture.getFacturer_short()+")");
                 bean.setId(equip.getId());
                 zdxhList.add(bean);            
            }
            
            model.addAttribute("zdxhList", zdxhList);
            model.addAttribute("sbztList", sbztList);
            return "pdaManager/add";
        }

    2、新action

    // 添加跳转
        @RequiresPermissions("pdaManager:v_add")
        @RequestMapping("/pdaManager/v_add.do")
        public String add(HttpServletRequest request, ModelMap model) {
            List<BeanDataDictionary> sbztList = dataMng.findByPid(128);
            List<BeanEquipmentModel> list = equipMng.getList();
            List<BeanEquipmentModel> zdxhList = new ArrayList<BeanEquipmentModel>();
            for(BeanEquipmentModel equip : list){
                String ids = equip.getFacturerId();
                String id[] =  ids.split(",");
                for (int i = 0; i < id.length; i++) {
                 BeanFacturer facture = facMng.findById(Integer.parseInt(id[i]));
                 BeanEquipmentModel bean = new BeanEquipmentModel();
                 bean.setModel_code(equip.getModel_code()+"("+facture.getFacturer_short()+")");
                 bean.setId(equip.getId());
                 zdxhList.add(bean);            
            }
            }
            model.addAttribute("zdxhList", zdxhList);
            model.addAttribute("sbztList", sbztList);
            return "pdaManager/add";
        }
  • 相关阅读:
    flex布局语法
    sqlserver判断text字段是否有数据
    z-index设置后导致遮罩层显示跳动问题
    C# UpdatePanel加载完毕回调JS
    json日期字符串格式化时间
    钉钉考勤机开发需要注意的一个坑
    python bs4 + requests4 简单爬虫
    温故而知新: 关于 js Form 方式提交的一些新认知
    window 环境 Composer 安装 thinkphp5
    百度地图 绘制东莞东城地图示例
  • 原文地址:https://www.cnblogs.com/xinxin1994/p/6038566.html
Copyright © 2020-2023  润新知