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

代码优化哈尔滨网络推广优化

代码优化,哈尔滨网络推广优化,企业网站规划书范文,企业网站设计模板免费下载40_resultMap基础和Results注解 resultType和resultMapresultMap.../元素项目0501resultMap Results注解项目0502resultMap注解#xff08;Results) 【总结】 resultType和resultMap resultType指定结果集每条记录要映射的对象类型。resultMap表明使用自定义的映射规… 40_resultMap基础和Results注解 resultType和resultMapresultMap.../元素项目0501resultMap Results注解项目0502resultMap注解Results) 【总结】 resultType和resultMap resultType指定结果集每条记录要映射的对象类型。resultMap表明使用自定义的映射规则resultMap属性值为一个resultMap…/元素的id属性值   resultMap比指定resultType要稍微复杂一些但它的功能更强大 resultMap…/元素 resultMap专门定义一个映射规则完成结果集与Java对象之间的映射关系 必须指定如下属性 - id指定该resultMap…/的唯一标识。 - type指定该resultMap…/映射的Java对象的类型。 resultMap…/的两个常用子元素id…/和result…/ id…/元素映射标识属性列result…/映射普通列 它们都可指定以下属性 - column指定列名。 - property指定对应的属性名。 - javaType指定属性的Java类型。一般无需指定MyBatis可以自动推断。 - jdbcType指定该列的JDBC类型。一般无需指定MyBatis可以自动推断。 - typeHandler为该数据列与属性值之间的转换指定类型处理器。 项目0501resultMap ?xml version1.0 encodingUTF-8 ? !DOCTYPE mapperPUBLIC -//mybatis.org//DTD Mapper 3.0//ENhttp://mybatis.org/dtd/mybatis-3-mapper.dtd !-- 根元素是mapper该元素的namespace属性值相当于该mapper的唯一标识 -- mapper namespaceorg.itcheng.app.dao.NewsMapper!-- SQL的id需要与Mapper接口的方法名相同 --insert idsaveNewsinsert into news_inf values (null, #{title}, #{content})/insert!-- 定义SQL语句 --update idupdateNewsupdate news_inf set news_title #{title}, news_content #{content}where news_id#{id}/update!-- SQL的id需要与Mapper接口的方法名相同 --delete iddeleteNewsdelete from news_inf where news_id #{xyz} /delete!-- 使用resultMap来完成结果集与Java对象之间的映射关系--select idfindNews resultMapnewsMapselect * from news_inf where news_id #{id} /select!-- resultMap专门定义一个映射规则完成结果集与Java对象之间的映射关系 --resultMap typenews idnewsMap id columnnews_id propertyid /!-- 映射映射标识属性 数据库的表字段news_id对应news对象的 id属性 --result columnnews_title propertytitle/!-- 映射映射普通属性 --result columnnews_content propertycontent/!-- 映射映射普通属性 --/resultMap/mapperResults注解 resultMap…/元素对应于Results注解 该注解的value属性可指定多个Result注解 Result相当于 id…/和result…/的综合体当它的id属性为true代表id…/元素。 项目0502resultMap注解Results) package org.itcheng.app.dao;import java.util.List;import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import org.itcheng.app.domain.News;// Mapper组件相当于DAO组件 public interface NewsMapper {Insert(insert into news_inf values (null, #{title}, #{content}))int saveNews(News news);Update(update news_inf set news_title #{title}, news_content #{content}\r\n where news_id#{id})int updateNews(News news);Delete(delete from news_inf where news_id #{xyz})void deleteNews(Integer id);Select(select * from news_inf where news_id #{id})Results({// id true相当于id.../子元素Result(column news_id, property id, id true),//表字段news_id对应news对象的 id属性Result(column news_title, property title),Result(column news_content, property content)})ListNews findNews(Integer id);} 【总结】 resultMap…/等同于Results注解 id…/或 result …/等同于Result注解
http://www.hkea.cn/news/14558811/

相关文章:

  • 邢台专业网站建设公司深圳专业做网站和seo的公司
  • 做暖暖网站seo关键词排名优
  • 湖北外贸网站建设价格优化方案英语必修二电子版
  • 网站建设销售找客户话术钢丝网片每平米价格
  • 全网模板建站系统wordpress加dz
  • 活动手机网站开发2017做网站怎么赚钱
  • 无聊网站建设网站建设项目经验
  • 自己建网站的流程阿里云服务器可以做几个网站
  • 网站开发的开题报告模板泰钢材企业网站源码
  • 网站seo诊断评分45怎样说服企业做网站建设推广
  • 有哪些做排球比赛视频网站滕州做网站
  • 做物流的网站微网站运营
  • 新闻客户端网站开发让别人做网站应注意什么
  • 东莞长安网站优化公司北京海淀建设部大院小区
  • 通用模板做的网站不收录织梦cms收费不交有事吗
  • 如何制作网站免费建站深圳网页制作与网站建设服务器
  • 如何设计服装网站首页什么网站做顶置便宜
  • 渭南网站建设电话广告制作合同模板免费
  • 杭州酒店网站建设漯河seo公司
  • 让人做网站需要准备什么条件网站开发报价单模板
  • 建设 互动 网站 模式哪里可以发广告
  • 新闻视频网站开发ux主题 wordpress
  • 家具网站建设需求网站建设的需求要素
  • 优化网站结构上海企业名录地址电话
  • 网站建设专业公司哪家好学做网站需要学那些程序
  • php源码网站后台面密码忘了在哪能找回密码商城网站制作需要多少费用
  • 天津百度网站排名优化实用又有创意的设计
  • 网站开发asp软件有哪些一个小程序开发费用
  • 湘潭网站建设工作室360网页游戏大全
  • 如何做热词网站镇江市网站