当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";
}
当findById(Integer id)变成String类型的更多相关文章
- Redis 中 String 类型的内存开销比较大
使用 String 类型内存开销大 1.简单动态字符串 2.RedisObject 3.全局哈希表 使用 Hash 来存储 总结 参考 使用 String 类型内存开销大 如果我们有大量的数据需要来保 ...
- String类型函数传递问题
String类型函数传递问题 问题 以前没有注意过的一个问题, 最近在使用String类型作为函数入参的时候, 发现函数内对于String类型的改变并不会影响到外层调用对象本身; 结论 (先说结论) ...
- ArrayList list = new ArrayList()在这个泛型为Integer的ArrayList中存放一个String类型的对象
java面试要点---ArrayList list = new ArrayList(); 在这个泛型为Integer的ArrayList中存放一个String类型的对象. ArrayList list ...
- 通过反射 往泛型Integer的集合里添加String 类型的数据 Day25
package com.sxt.method1; import java.lang.reflect.Method; /* * 需求:通过反射 往泛型Integer的集合里添加String 类型的数据 ...
- 如果不空null并且不是空字符串才去修改这个值,但这样写只能针对字符串(String)类型,如果是Integer类型的话就会有问题了。 int i = 0; i!=''。 mybatis中会返回tr
mybatis 参数为Integer型数据并赋值0时,有这样一个问题: mybatis.xml中有if判断条件判断参数不为空时,赋值为0的Integer参数被mybatis判断为空,因此不执行< ...
- List<Integer>里有可能存String类型元素吗?
这其实是我遇到的一个线上bug,在这里分享给大家. 如果是用反射,那就很简单了,毕竟泛型只是在编译期进行约束,对运行期是无能为力的. 想想看,如果不使用反射,有没有办法做到呢? 问题起因 在我们公司的 ...
- ElasticSearch 5学习(9)——映射和分析(string类型废弃)
在ElasticSearch中,存入文档的内容类似于传统数据每个字段一样,都会有一个指定的属性,为了能够把日期字段处理成日期,把数字字段处理成数字,把字符串字段处理成字符串值,Elasticsearc ...
- 总结:String类型与Int类型的转换【实现插入操作主键自增】
1.String类型(此类型是数字格式的字符串类型)转换成Int类型 String str = "10000"; 转换成Int类型: int num = Integer.parse ...
- Java 类类型之 String 类型
类类型 引用数据类型存的都是地址,通过地址指向对象: 基本数据类型存的都是具体值: 字符串 (String) 类型 特点: 1.字符创都是对象: 2.一旦初始化,不能被更改,字符串缓冲区支持可变的字符 ...
随机推荐
- C语言--scanf
关于C语言的scanf,首先看个例子 int get_int(void){ int input; char ch; ){ printf("is not an integer,please e ...
- css实现省略号
样式: {width: 160px; overflow: hidden; text-overflow:ellipsis; white-space: nowrap;} 说明: white-space: ...
- java多线程系类:基础篇:08之join
本章,会对Thread中join()方法进行介绍.涉及到的内容包括:1. join()介绍2. join()源码分析(基于JDK1.7.0_40)3. join()示例 转载请注明出处:http:// ...
- Oracle 常用操作【01】修改、更新数据
1. oracle 修改表名.列名.字段类型.添加表列.删除表列 alert table scott.test rename to test1--修改表名 alter table scott.tes ...
- SQL基础之GROUPING
1.grouping sets 记得前几天第一次接触grouping sets时,笔者的感觉是一脸懵逼. 后来一不小心看到msdn上对grouping sets的说明,顿时豁然开朗,其实groupin ...
- bootstrap-datepicker带中文的js文件
) { $(".datepicker").datepicker({ language: "zh-CN", autoclose: true,//选中之后自动隐藏日 ...
- c8051f320学习,单片机不外乎时钟、IO、串口、USB等外设用法
时钟 IO(输入.输出,如何配置) IO 数字和模拟资源可以通过25个I/O 引脚(C805 1F3 2 0 ),每个端口引脚都可以被定义为 通用I/O(GPIO)或 0 模拟输入 所有端口I ...
- 编程中的offsetof
linux和windows平台都已经定义了offsetof函数,用于取struct类型中某个变量的偏移量 在stddef.h头文件中,该宏的完整说明如下: #ifdef __cplusplus #if ...
- 2015/11/9用Python写游戏,pygame入门(8):按钮和游戏结束
昨天没有更新内容,今天相对多写一些. 因为我们已经基本完成游戏框架,但是游戏结束后,并不知道怎样比较好开始.我本来本着懒的原则,想结束后显示一个黑屏,然后你重新点一下鼠标就重新开始.但是那样实在太不像 ...
- nios II--实验2——led软件部分
软件开发 首先,在硬件工程文件夹里面新建一个software的文件夹用于放置软件部分:打开toolsàNios II 11.0 Software Build Tools for Eclipse,需要进 ...