Mybatis学习入门20150511

Public User selectUser(String name,String area);

<select id="selectUser" resultMap="BaseResultMap">

    select  *  from user_user_t   where user_name = #{0} and user_area=#{1}

</select>
Public User selectUser(Map paramMap);

<select id=" selectUser" resultMap="BaseResultMap">

   select  *  from user_user_t   where user_name = #{userName,jdbcType=VARCHAR} and user_area=#{userArea,jdbcType=VARCHAR}

</select>
Public User selectUser(@param(“userName”)String name,@param(“userArea”)String area);

<select id=" selectUser" resultMap="BaseResultMap">

   select  *  from user_user_t   where user_name = #{userName,jdbcType=VARCHAR} and user_area=#{userArea,jdbcType=VARCHAR}

</select> 
 <!-- 分页 -->
<select id="getDailyAppUserListByPage" resultMap="dailyAppUserMap"> <include refid="getDailyAppUserList"/> LIMIT #{offset}, #{limit} </select>
<select id="selectUsers" parameterType="int" resultType="com.someapp.model.User">

  select id, username, hashedPassword

  from some_table

  where id = #{id}

</select>
<!-- Result Map -->

    <!-- goods resultmap -->

    <resultMap id="goodsResultMap" type="com.qunar.scoresystem.bean.Goods">

        <id property="goodsId" column="goods_id" />

        <result property="goodsName" column="goods_name" />

        <result property="goodsStorageNum" column="goods_storage_num" />

        <result property="goodsScore" column="goods_score" />

        <result property="goodsDescription" column="goods_description" />

        <result property="goodsStatus" column="goods_status" />

        <collection property="goodsImgList" resultMap="goodsImgResult" />

    </resultMap>



    <!-- goodsimage resultmap -->

    <resultMap id="goodsImgResult" type="com.qunar.scoresystem.bean.GoodsImg">

        <id property="imgId" column="img_id" />

        <result property="goodsId" column="goods_id" />

        <result property="imgDir" column="img_dir" />

        <result property="imgSize" column="img_size" />

        <result property="imgName" column="img_name" />

    </resultMap>
<select id="findByIdsMap" resultMap="BaseResultMap">

    Select

    <include refid="Base_Column_List" />

     from jria where ID in

     <foreach item="item" index="index" collection="list" 

                    open="(" separator="," close=")">

                   #{item}

            </foreach>

 </select> 
<select id="findByIdsMap" resultMap="BaseResultMap">

 Select

 <include refid="Base_Column_List" />

 from jria where ID in

 <foreach item="item" index="index" collection="list" open="(" separator="," close=")">

  #{item}

 </foreach>

</select>
 <select id="findByIdsMap" resultMap="BaseResultMap">

 select

 <include refid="Base_Column_List" />

 from tabs where ID in

 <foreach item="item" index="index" collection="array" open="(" separator="," close=")">

  #{item}

 </foreach>

    </select>

 

你可能感兴趣的:(mybatis)