zoukankan      html  css  js  c++  java
  • 【service调用dao层传参的三种方式】

    第一种方案:默认数组角标:

    service

    Public User selectUser(String name,String area);

    mapper:

    <select id="selectUser" resultMap="BaseResultMap">
        select  from user_user_t   where user_name = #{0} and user_area=#{1}
    </select>
     
    第二种方案:map集合传参:
     
    service:
    Map paramMap=new hashMap();
    paramMap.put(“userName”,”对应具体的参数值”);
    paramMap.put(“userArea”,”对应具体的参数值”);
    Public User selectUser(Map paramMap);
     
    mapper:
    <select id=" selectUser" resultMap="BaseResultMap">
       select  from user_user_t   where user_name = #{userName,jdbcType=VARCHAR} and user_area=#{userArea,jdbcType=VARCHAR}
    </select>
     
    第三种方案:参数修正
    service
    Public User selectUser(@param(“userName”)Stringname,@param(“userArea”)String area);
     
    mapper:
    <select id=" selectUser" resultMap="BaseResultMap">
       select  from user_user_t   where user_name = #{userName,jdbcType=VARCHAR} and user_area=#{userArea,jdbcType=VARCHAR}
    </select>
     
     
     
     
     
  • 相关阅读:
    编译内核开始的小问题Unable to find the Ncurses libraries
    qq for linux Ubuntu 64位兼容
    ubuntu下安装lighttpd
    搭建boa服务器
    INI file and Iniparser
    kernel常用.gitignore配置
    光谱学习
    jump to case label fpermissive
    Qt通用方法及类库5
    Qt通用方法及类库1
  • 原文地址:https://www.cnblogs.com/yangjian-java/p/6877645.html
Copyright © 2011-2022 走看看