当前位置: 首页 > news >正文

哪个网站做视频钱多模仿做网站

哪个网站做视频钱多,模仿做网站,网页是啥,做网站电话销售2023.10.29 本章学习MyBatis的基本crud操作。 insert java程序如下#xff1a; ①使用map集合传参 Testpublic void testInsertCar(){SqlSession sqlSession SqlSessionUtil.openSession();//先将数据放到Map集合中#xff0c;在sql语句中使用 #{map集合的key} 来完成传…2023.10.29 本章学习MyBatis的基本crud操作。 insert java程序如下 ①使用map集合传参 Testpublic void testInsertCar(){SqlSession sqlSession SqlSessionUtil.openSession();//先将数据放到Map集合中在sql语句中使用 #{map集合的key} 来完成传值#{} 等同于JDBC中的 ? #{}就是占位符MapString,Object map new HashMap();map.put(carNum, 1029);map.put(brand, 马自达);map.put(guidePrice, 50.3);map.put(produceTime, 2023-10-29);map.put(carType, 燃油车);// 执行SQL语句使用map集合给sql语句传递数据int count sqlSession.insert(insertCar, map);System.out.println(插入了几条记录 count);sqlSession.commit();sqlSession.close();} ②使用pojo传参 Testpublic void testInsertCarByPOJO(){SqlSession sqlSession SqlSessionUtil.openSession();Car car new Car(null,1029,马自达,50.3,2023-10-29,燃油车);int count sqlSession.insert(insertCar,car);System.out.println(count);sqlSession.commit();sqlSession.close();} SQL语句如下 insert idinsertCarinsert into t_car(id,car_num,brand,guide_price,produce_time,car_type) values (null,#{carNum},#{brand},#{guidePrice},#{produceTime},#{carType}); /insert 运行结果 ps如果采用map集合传参#{} 里写的是map集合的key如果key不存在不会报错数据库表中会插入NULL。 ps如果采用POJO传参#{} 里写的是POJO类中get方法的方法名去掉get之后将剩下的单词首字母变小写例如getAge对应的是#{age}getUserName对应的是#{userName}如果这样的get方法不存在会报错。 delete 需求根据car_num进行删除。 java程序如下 Testpublic void testDeleteById(){SqlSession sqlSession SqlSessionUtil.openSession();int count sqlSession.delete(deleteById,2);sqlSession.commit();sqlSession.close();} sql语句如下 delete iddeleteByIddelete from t_car where id #{id}/delete 运行结果 ps当占位符只有一个的时候${} 里面的内容可以随便写。 update java代码如下 Testpublic void testUpdateById(){SqlSession sqlSession SqlSessionUtil.openSession();Car car new Car(21L,1029,宝马7系,66.6,1999-11-23,燃油车);int count sqlSession.update(updateById,car);System.out.println(count);sqlSession.commit();sqlSession.close();} sql语句如下 update idupdateByIdupdate t_car setcar_num #{carNum}, brand #{brand},guide_price #{guidePrice}, produce_time #{produceTime},car_type #{carType}where id #{id}/update 运行结果 select  查询一条数据 需求查询id为21的Car信息 java代码如下 Testpublic void testSelectCarById(){// 获取SqlSession对象SqlSession sqlSession SqlSessionUtil.openSession();// 执行SQL语句Object car sqlSession.selectOne(selectCarById, 21);System.out.println(car);} sql语句如下 select idselectCarById resultTypepojo.Carselectid, car_num as carNum, brand, guide_price as guidePrice, produce_time as produceTime, car_type as carTypefromt_carwhereid #{id}/select 运行结果 ps当查询结果的字段名和java类的属性名对应不上的话可以采用as关键字起别名 。 查询多条数据 java代码如下 Testpublic void testSelectCarAll(){// 获取SqlSession对象SqlSession sqlSession SqlSessionUtil.openSession();// 执行SQL语句ListObject cars sqlSession.selectList(selectCarAll);// 输出结果cars.forEach(car - System.out.println(car));} sql语句如下 !--虽然结果是List集合但是resultType属性需要指定的是List集合中元素的类型。--select idselectCarAll resultTypepojo.Car!--记得使用as起别名让查询结果的字段名和java类的属性名对应上。--selectid, car_num as carNum, brand, guide_price as guidePrice, produce_time as produceTime, car_type as carTypefromt_car/select 由于我数据库只有一条记录先手动添加几条记录 运行查询语句结果为 ps在SQL Mapper配置文件中mapper标签的namespace属性可以翻译为命名空间这个命名空间主要是为了防止sqlId冲突的。
http://www.yutouwan.com/news/99017/

相关文章:

  • 郑州网站优化托管被黑网站
  • 昌吉 建设局 网站新房装修图片
  • 做网站一个月工资小程序游戏开发成本
  • .net开发网站怎么样脑卒中中心建设网站
  • 蓟县集团网站建设延吉省住房和城乡建设厅网站
  • 嘉兴网站建设电话辽源网站建设
  • 重庆网站关键词推广网站免费创建
  • 江南大学做网站天眼查公司注册查询官网
  • 做美瞳网站需要什么资质心理健康网站建设方案
  • 公开课网站建设山东房地产新闻
  • 菠菜网站怎么建设义乌网站推广
  • Wordpress怎么做筛选功能wordpress 自动seo插件
  • 对于网站建设的意见和建议企业网站建设经济效益分析
  • 网站数据库修改密码要怎么做深圳地图各区分布图
  • 深圳做网站哪个平台好临沂网站制作加速企业发展
  • 石家庄网站建设成功案例科技馆展厅
  • 3d 网站设计怎么创建自己的小程序商城
  • 网站建设的国内外现状外贸采购平台推荐
  • 佛山做网站wordpress ip 地址修改
  • 杭州正规的网站建设公司最好的企业网站源码
  • 北京建设网网站做的网站每年都要交费吗
  • 自己建网站需要钱吗360建筑网如何删除自己的信息
  • 山东省建设备案网站审批企业展厅设计费用多少
  • 克拉玛依市建设局网站彩票网站里的统计怎么做
  • 营销型网站建设的概念旅游网站技术方案
  • 工作室 网站东莞互联网大公司
  • 违禁网站用什么浏览器住房城乡建设局是干什么的
  • 图片点开是网站怎么做免费网站转app
  • 搭建钓鱼网站教程中企动力z邮局登录
  • 宿迁网站制作网站模板下载大全