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

怎么建设网站临汾惠州酒店网站建设

怎么建设网站临汾,惠州酒店网站建设,厦门做网站公司有哪些,网站建设属于什么岗位代码下载 解决字段名与属性名不一致 ①使用别名emp_name empName解决字段名和属性名不一致 select idgetAllEmpOld resultTypeEmp!--①使用别名emp_name empName解决字段名和属性名不一致--select eid,emp_name empName,age,sex,em…代码下载 解决字段名与属性名不一致 ①使用别名emp_name empName解决字段名和属性名不一致 select idgetAllEmpOld resultTypeEmp!--①使用别名emp_name empName解决字段名和属性名不一致--select eid,emp_name empName,age,sex,email from t_emp;/select②在全局配置文件中添加全局配置 settings!-- 将_自动映射为驼峰emp_nameempName--setting namemapUnderscoreToCamelCase valuetrue//settings③使用resultMap !--resultMap设置自定义映射关系id唯一标识type设置映射关系中的实体类类型id设置主键属性property设置映射关系中的属性名必须是type属性所设置的实体类类型中的属性名column设置映射关系中的字段名必须是SQL语句查询出的字段名--resultMap idempResultMap typeEmpid propertyeid columneid/id propertyempName columnemp_name/id propertyage columnage/id propertysex columnsex/id propertyemail columnemail//resultMap!--③使用resultMap解决字段名和属性名不一致--select idgetAllEmp resultMapempResultMapselect * from t_emp;/select多对一映射关系 ①级联属性赋值 resultMap idempAndDeptResultMapOne typeEmpid propertyeid columneid/id propertyempName columnemp_name/id propertyage columnage/id propertysex columnsex/id propertyemail columnemail/id propertydept.did columndid/id propertydept.deptName columndept_name//resultMap!--Emp getEmpAndDept(Param(eid) Integer eid);--select idgetEmpAndDept resultMapempAndDeptResultMapOneselect * from t_emp left join t_dept on t_emp.did t_dept.did where t_emp.eid#{eid}/select②使用association resultMap idempAndDeptResultMapTwo typeEmpid propertyeid columneid/id propertyempName columnemp_name/id propertyage columnage/id propertysex columnsex/id propertyemail columnemail/!-- association处理多对一的映射关系javaType该属性的类型--association propertydept javaTypeDeptid propertydid columndid/id propertydeptName columndept_name//association/resultMap!--Emp getEmpAndDept(Param(eid) Integer eid);--select idgetEmpAndDept resultMapempAndDeptResultMapTwoselect * from t_emp left join t_dept on t_emp.did t_dept.did where t_emp.eid#{eid}/select mapper namespacecom.lotus.mybatis.mapper.DeptMapper!--Dept getEmpAndDeptByStepTwo(Param(did) Integer did);--select idgetEmpAndDeptByStepTwo resultTypeDeptselect * from t_dept where did#{did}/select /mapper③分步查询 resultMap idempAndDeptByStepResultMap typeEmpid propertyeid columneid/id propertyempName columnemp_name/id propertyage columnage/id propertysex columnsex/id propertyemail columnemail/!--select设置分步查询的SQL唯一标识(namespace,SQLID或mapper接口的全类名.方法名)column设置分步查询的条件fetchType(eager|lazy)当开启全局延迟加载后通过此属性手动控制延迟加载的效果,eager表示立即加载--association propertydept selectcom.lotus.mybatis.mapper.DeptMapper.getEmpAndDeptByStepTwocolumndid fetchTypeeager/association/resultMap!-- Emp getEmpAndDeptByStepOne(); --select idgetEmpAndDeptByStepOne resultMapempAndDeptByStepResultMapselect * from t_emp where eid#{eid}/selectpublic interface EmpMapper { /*** 通过分步查询查询员工以及员工所对应部门信息* 第一步查询员工信息*/Emp getEmpAndDeptByStepOne(Param(eid) Integer eid);}public interface DeptMapper {/*** 通过分步查询查询员工以及员工所对应部门信息* 第一步通过did查询员工对应的部门信息*/Dept getEmpAndDeptByStepTwo(Param(did) Integer did); }一对多映射关系 ①使用collection标签 resultMap iddeptAndEmpResultMap typeDeptid propertydid columndid/id propertydeptName columndept_name/collection propertyemps ofTypeEmpid propertyeid columneid/id propertyempName columnemp_name/id propertyage columnage/id propertysex columnsex/id propertyemail columnemail//collection/resultMap!--Dept getDeptAndEmp(Param(did) Integer did);--select idgetDeptAndEmp resultMapdeptAndEmpResultMapselect * from t_dept left join t_emp on t_dept.did t_emp.did where t_dept.did#{did}/select/*** 获取部门及部门中所有员工信息*/Dept getDeptAndEmp(Param(did) Integer did); //测试代码Testpublic void testGetDeptAndEmp() {SqlSession sqlSession SqlSessionUtils.getSqlSession();DeptMapper mapper sqlSession.getMapper(DeptMapper.class);Dept dept mapper.getDeptAndEmp(1);System.out.println(dept);}②使用分步查询 !---DeptMapper.xml resultMap iddeptAndEmpByStepResultMap typeDeptid propertydid columndid/result propertydeptName columndept_name/collection propertyempsselectcom.lotus.mybatis.mapper.EmpMapper.getDeptAndEmpByStepTwocolumndid/collection/resultMap!--Dept getDeptAndEmpByStepOne(Param(did) Integer did);--select idgetDeptAndEmpByStepOne resultMapdeptAndEmpByStepResultMapselect * from t_dept where did#{did}/select !-- EmpMapper.xml -- !--ListEmp getDeptAndEmpByStepTwo(Param(did) Integer did);--select idgetDeptAndEmpByStepTwo resultTypeEmpselect * from t_emp where did#{did}/select//----DeptMapper /*** 分步查询①查询部门信息*/Dept getDeptAndEmpByStepOne(Param(did) Integer did); //----EmpMapper /*** 分步查询②根据did查询员工信息*/ ListEmp getDeptAndEmpByStepTwo(Param(did) Integer did);//测试代码Testpublic void testGetDeptAndEmpStep() {SqlSession sqlSession SqlSessionUtils.getSqlSession();DeptMapper mapper sqlSession.getMapper(DeptMapper.class);Dept dept mapper.getDeptAndEmpByStepOne(1);System.out.println(dept);}
http://www.w-s-a.com/news/947480/

相关文章:

  • 为网站网站做推广各类最牛网站建设
  • 网站用自己的电脑做服务器佛山做网站制作公司
  • 一个网站如何做cdn加速器如何上传网站数据库
  • 汝州住房和城乡建设局新网站营销网站定位
  • yy直播官网seo引擎优化是什
  • 做影视网站违法莫品牌营销是什么
  • 全网最稳最低价自助下单网站wordpress电影网站主题
  • 域名更换网站温州建设工程网站
  • 网站如何优化推广连锁店管理网站开发
  • 伊宁市做网站功能性质网站
  • 北京哪个网站制作公司优化大师免费安装下载
  • 同江佳木斯网站设计做网站联系电话
  • 设计上海展会2023seo网站模板下载
  • 开发一个卖东西的网站多少站长工具永久
  • 公司网站怎么突然多了好多友情链接如何删除宁波有几个区
  • 临沂seo网站推广wordpress新编辑器
  • c2c网站设计店面logo设计制作
  • 网站建设任务执行书重庆今天新闻事件
  • 怎样发布自己的网站南宁制作网站公司
  • wordpress装多站点百度查一下
  • 怎么优化一个网站搭建网站免费空间
  • 山东建设和城乡建设厅注册中心网站首页wordpress安装教材
  • 个人风采网站制作毕节网站开发公司电话
  • 网络网站销售设计主题和设计理念
  • 做网站一般用什么服务器承德专业做网站
  • 松北区建设局网站网站建设分为几种
  • 网站建设的合同 体会智联招聘网站建设情况
  • 记的网站域名wordpress地方信息主题
  • 淄博好的建网站公司网站建设 海口
  • 有人做网站花了10几万2017做啥网站能致富