zoukankan      html  css  js  c++  java
  • Mybatis多条件查询

    在Mybatis多条件查询中:

    1.参数如果是多条件,则需要将将添加到Map集合中进行传入。

    2.就是将其参数用有序数字进行代替。

    Mybatis单个String类型参数传递

    mysql文如下,传入参数为‘parentCategoryId’,运行报错为:There is no getter for property named 'parentCategoryId' in 'class java.lang.String

     

    <select id="selectCategoryList"  parameterType="java.lang.String" resultType="MstCategoryBean">   

     SELECT         category_id             AS  categoryId,          category_name           AS  categoryName,          view_orderby            AS  viewOrderby      FROM          mst_category      WHERE          del_flg =0      <if test="parentCategoryId!=null  and parentCategoryId!=''">      and          parent_category_id = #{parentCategoryId}      </if>  </select>  

    发现不能将参数设为bean里的名称,如果传入类型为String类型,则参数需统一修改为[_parameter],修改后的sql语句如下(不管你的参数是什么,都要改成"_parameter" 

     

          <select id="selectCategoryList" parametertype="java.lang.String" resulttype="MstCategoryBean">         

     SELECT              category_id             AS  categoryId,              category_name           AS  categoryName,              view_orderby            AS  viewOrderby          FROM              mst_category          WHERE              del_flg =0                    and             parent_category_id = #{_parameter}     

    </select>  

  • 相关阅读:
    python的各版本的不同
    keras中的early stopping
    NER的数据处理
    ner处理数据的方式
    python的数据处理一
    linux下的终端利器----tmux
    BiseNet学习笔记
    《Harnessing Synthesized Abstraction Images to Improve Facial Attribute Recognition》论文阅读笔记
    转:玩玩三维重建
    《Cascaded Pyramid Network for Multi-Person Pose Estimation》论文阅读及复现笔记
  • 原文地址:https://www.cnblogs.com/lhfyy/p/4047557.html
Copyright © 2011-2022 走看看