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

国外优秀的网站wordpress自建主题

国外优秀的网站,wordpress自建主题,蓟门桥网站建设,制作网站需要哪些素材自定义映射resultMap 自定义映射resultMap 自定义映射resultMapresultMap处理字段和属性的映射关系字段名和属性名不一致的情况#xff0c;如何处理映射关系?1、为查询的字段设置别名#xff0c;和属性名保持一致2、核心配置文件(mybatis-config.xml)中设置一个全局配置3、使…自定义映射resultMap 自定义映射resultMap 自定义映射resultMapresultMap处理字段和属性的映射关系字段名和属性名不一致的情况如何处理映射关系?1、为查询的字段设置别名和属性名保持一致2、核心配置文件(mybatis-config.xml)中设置一个全局配置3、使用resultMap自定义映射处理1处理多对一的映射关系①级联方式处理②association③分步查询 2处理一对多的映射关系 resultMap处理字段和属性的映射关系 字段名和属性名不一致的情况如何处理映射关系? 属性名 字段名 1、为查询的字段设置别名和属性名保持一致 select idgetEmpByEmpId resultTypeEmpselect emp_id empId,emp_name empName,age,gender from t_emp where emp_id #{empId}/select2、核心配置文件(mybatis-config.xml)中设置一个全局配置 当字段符合MySQL的要求使用_而属性符合java的要求使用驼峰 此时可以在MyBatis的核心配置文件(mybatis-config.xml)中设置一个全局配置可以自动将下划线映射为驼峰 emp_id:empId,emp_name:empName settings!--将下划线映射为驼峰--setting namemapUnderscoreToCamelCase valuetrue/!--开启延迟加载--setting namelazyLoadingEnabled valuetrue/!--按需加载--setting nameaggressiveLazyLoading valuefalse//settings3、使用resultMap自定义映射处理 resultMap设置自定义映射 属性 id表示自定义映射的唯一标识 type查询的数据要映射的实体类的类型 子标签 id设置主键的映射关系 result设置普通字段的映射关系 association设置多对一的映射关系 collection设置一对多的映射关系 属性 property设置映射关系中实体类中的属性名 column设置映射关系中表中的字段名 resultMap iduserMap typeUser id propertyid columnid/id result propertyuserName columnuser_name/result result propertypassword columnpassword/result result propertyage columnage/result result propertysex columnsex/result /resultMap !--ListUser testMohu(Param(mohu) String mohu);-- select idtestMohu resultMapuserMap !--select * from t_user where username like %${mohu}%-- select id,user_name,password,age,sex from t_user where user_name like concat(%,#{mohu},%) /select1处理多对一的映射关系 多个员工对应一个部门 ①级联方式处理 !-- 级联方式处理--resultMap idempAndDeptResultMapOne typeEmpid columnemp_id propertyempId/idresult columnemp_name propertyempName/resultresult columnage propertyage/resultresult columngender propertygender/resultresult columndept_id propertydept.deptId/resultresult columndept_name propertydept.deptName/result/resultMapselect idgetEmpAndDeptByEmpId resultMapempAndDeptResultMapOneselectt_emp.*,t_dept.*from t_empleft join t_depton t_emp.dept_id t_dept.dept_idwhere t_emp.emp_id #{empId}/select ②association !--association--resultMap idempAndDeptResultMap typeEmpid columnemp_id propertyempId/idresult columnemp_name propertyempName/resultresult columnage propertyage/resultresult columngender propertygender/result!--association处理多对一的映射关系处理实体类类型的属性property设置需要处理映射关系的属性的属性名javaType设置要处理的属性的类型--association propertydept javaTypeDeptid columndept_id propertydeptId/idresult columndept_name propertydeptName/result/association/resultMapselect idgetEmpAndDeptByEmpId resultMapempAndDeptResultMapselectt_emp.*,t_dept.*from t_empleft join t_depton t_emp.dept_id t_dept.dept_idwhere t_emp.emp_id #{empId}/select ③分步查询 DeptMapper.xml部门 select idgetEmpAndDeptByStepTwo resultTypeDeptselect * from t_dept where dept_id #{deptId}/select EmpMapper.xml员工 !--分步查询--resultMap idempAndDeptByStepResultMap typeEmpid columnemp_id propertyempId/idresult columnemp_name propertyempName/resultresult columnage propertyage/resultresult columngender propertygender/result!--property设置需要处理映射关系的属性的属性名select设置分步查询的sql的唯一标识column将查询出的某个字段作为分步查询的sql的条件fetchType在开启了延迟加载的环境中通过该属性设置当前的分步查询是否使用延迟加载fetchTypeeager(立即加载)|lazy(延迟加载)--association propertydept fetchTypeeagerselectcom.atguigu.mybatis.mapper.DeptMapper.getEmpAndDeptByStepTwocolumndept_id/association/resultMapselect idgetEmpAndDeptByStepOne resultMapempAndDeptByStepResultMapselect * from t_emp where emp_id #{empId}/select 2处理一对多的映射关系 一个部门对应多个员工 ①collection resultMap iddeptAndEmpResultMap typeDeptid columndept_id propertydeptId/idresult columndept_name propertydeptName/result!--ofType设置集合类型的属性中存储的数据的类型--collection propertyemps ofTypeEmpid columnemp_id propertyempId/idresult columnemp_name propertyempName/resultresult columnage propertyage/resultresult columngender propertygender/result/collection/resultMapselect idgetDeptAndEmpByDeptId resultMapdeptAndEmpResultMapSELECT *FROM t_deptLEFT JOIN t_empON t_dept.dept_id t_emp.dept_idWHERE t_dept.dept_id #{deptId}/select ②分步查询 DeptMapper.xml部门 resultMap iddeptAndEmpResultMapByStep typeDeptid columndept_id propertydeptId/idresult columndept_name propertydeptName/resultcollection propertyempsselectcom.atguigu.mybatis.mapper.EmpMapper.getDeptAndEmpByStepTwocolumndept_id/collection/resultMap!--Dept getDeptAndEmpByStepOne(Param(deptId) Integer deptId);--select idgetDeptAndEmpByStepOne resultMapdeptAndEmpResultMapByStepselect * from t_dept where dept_id #{deptId}/selectEmpMapper.xml员工 select idgetDeptAndEmpByStepTwo resultTypeEmpselect * from t_emp where dept_id #{deptId}/select
http://www.tj-hxxt.cn/news/130786.html

相关文章:

  • 搜索引擎优化课程总结站长工具seo综合查询工具
  • 建筑设计案例网站安徽建工网
  • 机械产品网络推广怎么做山东济南seo优化
  • 北京建设网站的公司兴田德润简介服装公司介绍
  • 大连网站建设方案维护网站建设基础筹备
  • 百合视频做爰视频网站免费html网站模板
  • 警告欺骗网站模板fsockopen wordpress
  • app开发公司推荐应用商店优化
  • 镇江网络违法网站北京注册商标费用
  • 重庆百度网站公司哪家好网站平台怎么做的好
  • 企业网站设计与实现培训seo去哪家机构最好
  • 阿里云服务器部署网站做英剧网站的设计思路
  • 网站后台模板免费下载怎样查找网站域名归属
  • 军队信息化建设网站电子商务网站建设需要做好哪些准备6
  • 跳转到手机网站代码网站单选框的实现
  • 做代收的网站有哪些重庆网站策划
  • 微信官方版官方网站高端的深圳网站页面设计
  • 北京哪里可以申请企业网站域名官网建立自己的网站
  • 赤峰做网站的公司的搜索引擎优化
  • wordpress固定主题连云港网站优化公司
  • 西安免费网站建站模板杭州网站建设app
  • 搭建网站 软件下载凡科网做的网站能直接用吗
  • 石家庄建设一个网站多少钱青岛海川建设集团网站
  • 进贤南昌网站建设公司wordpress 获取第一张图片
  • 蔬菜基地做网站合适吗wordpress增加备案
  • 制作网页和网站的区别徐汇集团网站建设
  • 成都网站建设赢展html网页代码大全的阅读
  • 自己做网站编程建设机械网站案例
  • phpcms做企业网站授权互联网外包是什么意思
  • html做网站头部买什么样的主机(用来建网站的)支持下载