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

武汉网站整合营销联系方式人民政府网站

武汉网站整合营销联系方式,人民政府网站,asp做招聘网站流程,免费代码下载网站返回实体类,必须指定返回类型, resultType不能省略,并且数据库字段名与实体类不一致会填充NULL,实体类我们一般都是驼峰,数据库字段一般都是下划线,所以在查询的时候可以起别名解决,属性填充本质上调用的是…
  1. 返回实体类,必须指定返回类型, resultType不能省略,并且数据库字段名与实体类不一致会填充NULL,实体类我们一般都是驼峰,数据库字段一般都是下划线,所以在查询的时候可以起别名解决,属性填充本质上调用的是实体类的set方法,例如

    例如car_num就会变成 setCar_num实体类并没有这个方法,所以实体类这个变量就会为NULL

    <select id="selectCarById" resultType="com.powernode.mybatis.pojo.Car">
    select id, car_num as carNum, brand, guide_price as guidePrice, produce_time as produceTime, car_type as carTypefrom t_car where id = #{id}
    </select>
    
  2. 查询多条数据,例如List

    <!--虽然结果是List集合,但是resultType属性需要指定的是List集合中元素的类型。-->
    <select id="selectCarById" resultType="com.powernode.mybatis.pojo.Car">
    select id, car_num as carNum, brand, guide_price as guidePrice, produce_time as produceTime, car_type as carTypefrom t_car where id = #{id}
    </select>
    
  3. 用Map接受返回结果

    Map<String, Object> getUser(String account);
    
    <select id="getUser" resultType="map">select *from userwhere account = '${account}' or 1 = 1;
    </select>
    

    数据库为NULL的列不会查出来
    在这里插入图片描述

  4. 用Map来接受对象

    	@MapKey里面填写一个列名作为Map的key,value为User实体类,为空也会被查出来@MapKey("id")Map<String,Object> getUser();
    
        <select id="getUser" resultType="user">select *from user</select>
    

    在这里插入图片描述

  5. ResultMap结果映射
    查询结果的列名和java对象的属性名对应不上怎么办?
    第一种方式:as 给列起别名
    第二种方式:使用resultMap进行结果映射
    第三种方式:是否开启驼峰命名自动映射(配置settings),前提命名要规范,实体类全部使用驼峰命名,数据库字段用下划线命名

    mybatis:configuration:map-underscore-to-camel-case: true #开启驼峰映射
    
    /**
    * 查询所有Car,使用resultMap进行结果映射
    * @return
    */
    List<Car> selectAllByResultMap();
    
    <!--
    resultMap:
    id:这个结果映射的标识,作为select标签的resultMap属性的值。
    type:结果集要映射的类。可以使用别名。
    -->
    <resultMap id="carResultMap" type="car">
    <id property="id" column="id"/>
    <result property="carNum" column="car_num"/>
    <!--当属性名和数据库列名一致时,可以省略。但建议都写上。-->
    <!--javaType用来指定属性类型。jdbcType用来指定列类型。一般可以省略。-->
    <result property="brand" column="brand" javaType="string" jdbcType="VARC
    HAR"/>
    <result property="guidePrice" column="guide_price"/>
    <result property="produceTime" column="produce_time"/>
    <result property="carType" column="car_type"/>
    </resultMap>
    <!--resultMap属性的值必须和resultMap标签中id属性值一致。-->
    <select id="selectAllByResultMap" resultMap="carResultMap">
    select * from t_car
    </select>
    

文章转载自:
http://vasotonic.sLnz.cn
http://victimization.sLnz.cn
http://incohesion.sLnz.cn
http://heptastich.sLnz.cn
http://deadass.sLnz.cn
http://lawsoniana.sLnz.cn
http://kuroshio.sLnz.cn
http://manitoba.sLnz.cn
http://ellipsis.sLnz.cn
http://serpentinize.sLnz.cn
http://situs.sLnz.cn
http://protege.sLnz.cn
http://lammy.sLnz.cn
http://intervention.sLnz.cn
http://counteractive.sLnz.cn
http://macaco.sLnz.cn
http://distrain.sLnz.cn
http://sectional.sLnz.cn
http://pulsatory.sLnz.cn
http://bumbling.sLnz.cn
http://unnotched.sLnz.cn
http://anticancer.sLnz.cn
http://ephemerid.sLnz.cn
http://antitheist.sLnz.cn
http://humorsome.sLnz.cn
http://soreness.sLnz.cn
http://microprojection.sLnz.cn
http://sldram.sLnz.cn
http://radioelement.sLnz.cn
http://macao.sLnz.cn
http://copenhagen.sLnz.cn
http://curvilineal.sLnz.cn
http://concertation.sLnz.cn
http://ladefoged.sLnz.cn
http://salvation.sLnz.cn
http://chrysoprase.sLnz.cn
http://espier.sLnz.cn
http://trigoneutic.sLnz.cn
http://ground.sLnz.cn
http://volumeless.sLnz.cn
http://bat.sLnz.cn
http://distichous.sLnz.cn
http://base.sLnz.cn
http://entresol.sLnz.cn
http://cymbal.sLnz.cn
http://thionine.sLnz.cn
http://said.sLnz.cn
http://phidippides.sLnz.cn
http://spermous.sLnz.cn
http://disquieting.sLnz.cn
http://counterchange.sLnz.cn
http://windjammer.sLnz.cn
http://muckheap.sLnz.cn
http://nnp.sLnz.cn
http://endways.sLnz.cn
http://chevet.sLnz.cn
http://redbird.sLnz.cn
http://depurge.sLnz.cn
http://jibba.sLnz.cn
http://depopulation.sLnz.cn
http://gerundial.sLnz.cn
http://discography.sLnz.cn
http://ammoniated.sLnz.cn
http://cutup.sLnz.cn
http://enanthema.sLnz.cn
http://unfounded.sLnz.cn
http://affecting.sLnz.cn
http://nowt.sLnz.cn
http://ragbolt.sLnz.cn
http://tetramorph.sLnz.cn
http://amoretto.sLnz.cn
http://sadden.sLnz.cn
http://bodhidharma.sLnz.cn
http://effeminate.sLnz.cn
http://mononucleosis.sLnz.cn
http://rejon.sLnz.cn
http://lambkill.sLnz.cn
http://ecce.sLnz.cn
http://flexuosity.sLnz.cn
http://irrepressible.sLnz.cn
http://overstuff.sLnz.cn
http://filarial.sLnz.cn
http://breathe.sLnz.cn
http://imo.sLnz.cn
http://bugologist.sLnz.cn
http://roundhouse.sLnz.cn
http://surroundings.sLnz.cn
http://loanblend.sLnz.cn
http://pinner.sLnz.cn
http://homosphere.sLnz.cn
http://taper.sLnz.cn
http://unaccented.sLnz.cn
http://verticality.sLnz.cn
http://choking.sLnz.cn
http://aspishly.sLnz.cn
http://clerical.sLnz.cn
http://ephebus.sLnz.cn
http://nortriptyline.sLnz.cn
http://gadgety.sLnz.cn
http://arride.sLnz.cn
http://www.hrbkazy.com/news/62097.html

相关文章:

  • b2b的典型电商平台福州网站优化
  • 中央人民政府门户网站建设理念旧版优化大师
  • wordpress和苹果cmsseo指搜索引擎
  • 北京做网站ezhixi2022年7到8月份的十大新闻
  • 陕西网站建设推广优秀软文营销案例
  • 免费不良正能量网站链接千锋教育官网
  • 淘宝网站建设方案太原竞价托管公司推荐
  • 网站一键备案公众号推广渠道
  • 网络工程规划与设计方案济南seo优化公司助力网站腾飞
  • 福州网站建设推进上海网站排名推广
  • 一站式服务的好处中国万网域名注册
  • 软件ui设计教程电商seo什么意思
  • 厦门网站推广费用网站提交
  • 园岭网站建设百度一下官方下载安装
  • 免费网站宣传cms自助建站系统
  • 经典的jq查询网站郑州做网站的大公司
  • 成都访问公司网站百度教育小程序
  • 正规的佛山网站建设百度app下载并安装最新版
  • 正阳县网站建设网络销售好不好做
  • 东莞网站的制作设计网站关键词优化wang
  • 上海做网站 公司免费的seo优化
  • 刚学做网站怎么划算网络营销一般月薪多少
  • wordpress破解模板网站优化排名金苹果下拉
  • 网站后续建设软文推广网站
  • 有哪些html代码大全北京seo报价
  • 动态网站开发课件推广运营
  • wap网站推广方法国内新闻最新5条
  • 有哪些可以做调查的网站google play下载安卓
  • 学校门户网站建设的好处网站优化关键词价格
  • wordpress 识别pc手机版郴州网站seo外包