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

浙江省建设厅网站图审备案wordpress 前端投稿插件

浙江省建设厅网站图审备案,wordpress 前端投稿插件,网站建设合同图片,想自己做网站该学些什么关联查询#xff1a; 一对一#xff1a; 两种方式实现: 1.通过业务扩展的方式进行一对一查询#xff0c;新建一个实体类#xff0c;继承其中属性多的一个#xff0c;然后写上另一个类中的属性#xff1a; 实体类: 映射文件: 1 !-- 业务扩展的方式进行一对一查询… 关联查询 一对一 两种方式实现: 1.通过业务扩展的方式进行一对一查询新建一个实体类继承其中属性多的一个然后写上另一个类中的属性 实体类:    映射文件: 1 !-- 业务扩展的方式进行一对一查询创建一个新的实体类继承属性多的一方然后重写属性少的一方 -- 2 select idqueryStudentWithOO parameterTypeint resultTypeStudentBusiness 3 select * from student s inner join studentcard c on s.sid c.cid and sid #{sid} 4 /select 测试类: 1 //一对一查寻2 public static void queryStudentWithOO() throws IOException {3 //读取配置文件4 Reader reader Resources.getResourceAsReader(conf.xml);5 //创建sqlSessionFactory6 SqlSessionFactory sessionFactory new SqlSessionFactoryBuilder().build(reader);7 //获取session8 SqlSession session sessionFactory.openSession();9 //定位映射文件 10 studentMapper studentMapper session.getMapper(studentMapper.class); 11 //定位sql语句并执行 12 StudentBusiness studentBusiness studentMapper.queryStudentWithOO(3); 13 //提交事务 14 session.commit(); 15 System.out.println(studentBusiness); 16 //关闭连接 17 session.close(); 18 } 2.通过ResultMap的方式实现一对一 然后在映射文件中使用association进行对象属性的映射: 实体类: 配置文件: 1 select idqueryStudentWithMap parameterTypeint resultMapStudentBusiness12 select * from student s inner join studentcard c on s.sid c.cid and sid #{sid}3 /select4 resultMap typeStudentBusiness idStudentBusiness15 id propertysid columnsid/6 result propertysname columnsname/7 result propertyage columnage/8 result propertysex columnsex/9 result propertycid columncid/ 10 result propertystuInfo columnstuInfo/ 11 association propertyaddress javaTypeAddress 12 result propertyhomeAddress columnhomeaddress/ 13 result propertyschoolAddress columnschooladdress/ 14 /association 15 /resultMap 测试类: 1 //一对一查寻使用ResultMap的方式2 public static void queryStudentWithMap() throws IOException {3 //读取配置文件4 Reader reader Resources.getResourceAsReader(conf.xml);5 //创建sqlSessionFactory6 SqlSessionFactory sessionFactory new SqlSessionFactoryBuilder().build(reader);7 //获取session8 SqlSession session sessionFactory.openSession();9 //定位映射文件 10 studentMapper studentMapper session.getMapper(studentMapper.class); 11 //定位sql语句并执行 12 StudentBusiness studentBusiness studentMapper.queryStudentWithMap(3); 13 //提交事务 14 session.commit(); 15 System.out.println(studentBusiness); 16 //关闭连接 17 session.close(); 18 } 2.一对多: 一个班级对应多个学生应在班级的实体类中定义一个学生的属性,然后在映射文件中使用collection进行对象属性集合进行映射: 实体类:   配置文件 1 !-- 一对多查询 --2 select idqueryStudentWithOM parameterTypeint resultMapStudentclass13 select * from student s inner join studentclass c on s.cno c.cno and c.cno #{cno}4 /select5 6 resultMap typeStudentClass idStudentclass17 id propertycno columncno/8 result propertycname columncname/9 !-- 循环集合用collection属性值写集合属性名类型写集合中的元素的类型并且使用的是ofType -- 10 collection propertystudents ofTypestudent 11 result propertysname columnsname/ 12 result propertyage columnage/ 13 result propertysex columnsex/ 14 /collection 15 /resultMap 测试类: 1 //一对多查寻2 public static void queryStudentWithOM() throws IOException {3 //读取配置文件4 Reader reader Resources.getResourceAsReader(conf.xml);5 //创建sqlSessionFactory6 SqlSessionFactory sessionFactory new SqlSessionFactoryBuilder().build(reader);7 //获取session8 SqlSession session sessionFactory.openSession();9 //定位映射文件 10 studentMapper studentMapper session.getMapper(studentMapper.class); 11 //定位sql语句并执行 12 StudentClass studentClass studentMapper.queryStudentWithOM(2); 13 System.out.println(studentClass); 14 //提交事务 15 session.commit(); 16 ListStudent students studentClass.getStudents(); 17 for (Student student : students) { 18 System.out.print(studentClass.getCno() , studentClass.getCname() ,); 19 System.out.println(student.getSname(), student.getAge(), student.getSex()); 20 } 21 //关闭连接 22 session.close(); 23 }   转载于:https://www.cnblogs.com/man-tou/p/11345703.html
http://www.sadfv.cn/news/236783/

相关文章:

  • 网站开发 语音输入网站创建域名
  • 怎么自己做淘客网站新编asp.net 2.0网站开发从入门到精通 代码
  • 最新的销售平台seo优化是指通过研究搜索引擎排名规则
  • 滕州网站建设建设网站的效益分析
  • 本地门户网站源码wordpress 蓝色企业主题
  • 禹城网站建设价格菏泽网站建设价格
  • 桂林象鼻山离哪个高铁站近wordpress标题去重
  • 网站建设中的html高德地图网页版
  • 海南省旅游专业网站发展电子商务缺乏强大的专业产业资源做后盾一个网站制作流程
  • 哈尔滨市网站建设做网站一定要域名吗
  • 一个网站大概多少页面php做的网站怎么让外网访问
  • 网站建设前景wordpress sweep
  • 免费网站建设itcask邢台市最新人事调整
  • 全国建设管理信息网站网站开发基本工资是多少
  • 用什么网站做一手楼好网站seo什么意思
  • 网站付费模板做爰明星视频网站
  • 成都网站建设公司汇总中国核工业第五建设公司网站
  • 富利建设集团有限公司网站论坛网页制作
  • 网站服务器 同步备份免费网页代理浏览器1
  • 怎么建立国外网站做网站反应快的笔记本有哪些
  • 台州建设工程信息网站做网站能干什么
  • 常德城乡和住房建设局网站网站验收确认
  • 贵阳网站建设 赶集网站友情链接怎么做
  • 企业网站规划要求300元做网站
  • 常熟做网站价格河北营销型网站方案
  • 企业网站建设方案资讯ps网站建设要知道的知识
  • 南京建设银行网站秦皇岛海港区防疫人员事件
  • 专注南京网站建设赣州的免费网站建设
  • 青岛html5网站制作wordpress资讯类主题
  • 建筑网官方网站做的比较好的车载嗨曲网站