タグの問い合わせを使用してMyBatisの

1.基本的なクエリー

  @Select( "メンバーここでID =#{ID} SELECT * FROM")
    パブリックメンバfindById(文字列ID)が例外をスローします。

2. 1のクエリ

  @Select( "注文SELECT * FROM")
    @Results({ 
            @Result(ID =真、プロパティ= "ID"、列は= "ID")、
            @Result(プロパティ= "orderNum"、列= "orderNum")、
            @Result(プロパティ= "orderTime"、列= "orderTime")、
            @Result(プロパティ= "オーダーステータス"欄= "オーダーステータス")、
            @Result(プロパティ= "peopleCount"、列= "peopleCount")、
            @Result (プロパティ= "peopleCount"、列= "peopleCount")、
            @Result(プロパティ= "payType"、列= "payType")、
            @Result(プロパティ= "orderDesc"、列= "orderDesc ")、
            @Result(プロパティ= "製品"、列= "商品コード"のJavaType = Product.class一= @One(選択= "com.ssm.dao.IProductDao.findById"))、 
    プライベート文字列商品名; //名称JavaType = Product.class一= @One(= "com.ssm.dao.IProductDao.findById"を選択)) 
    })
    公共の一覧<オーダー>のfindAll()は、例外がスローされます。

======实体
パブリッククラスオーダー{     
    プライベート文字列ID。
    プライベート文字列orderNum。
    プライベート日付orderTime。
    プライベート文字列orderTimeStr。
    プライベートint型オーダーステータス。
    プライベート文字列orderStatusStr。
    プライベートint型peopleCount。
    民間製品の製品。
} 
publicクラスの商品{ 
    プライベート文字列ID。//主键
    プライベート文字列productNum。//编号唯一
    プライベート文字列cityName。//出发城市
    @DateTimeFormat(パターン= "YYYY-MM-DD HH:MM")
    プライベート日付departureTime。//出发时间
    プライベート文字列departureTimeStr。
    プライベートダブルproductPrice; //価格
    プライベート文字列productDesc; //説明
    プライベート整数productStatus; //開いた状態0閉じ
    プライベート文字列productStatusStrを; 
} 

3.多くのクエリ

//多表操作
    @Select( "ID =#{ordersId}注文SELECT * FROM")
    @Results({ 
            @Result(ID =真、プロパティ= "ID"、列= "ID")、
            @Result(プロパティ= "orderNum"、列= "orderNum")、
            @Result(プロパティ= "orderTime"、列= "orderTime")、
            @Result(プロパティ= "オーダーステータス"欄= "オーダーステータス")、
            @Result(プロパティ= " peopleCount "列= "peopleCount")、
            = @Result(プロパティ"peopleCount"、列= "peopleCount")、
            @Result(プロパティ= "payType"、列= "payType")、 
            @Result(プロパティ="orderDesc」、列= "orderDesc")、
            @Result(プロパティ= "製品"、列= "商品コード"のJavaType = Product.class一= @One(選択= "com.ssm.dao.IProductDao.findById"))、
    プライベートint型オーダーステータス。
            @Result(プロパティ= "メンバー"、列= "MEMBERID"のJavaType = Member.class一= @One(選択= "com.ssm.dao.IMemberDao.findById"))、
            @Result(プロパティ= "旅行"カラム= "ID"、のJavaType = java.util.List.class、多く= @Many(選択= "com.ssm.dao.ITravellerDao.findByOrdersId"))
    })
    公共受注findById(文字列ordersId)は例外スロー。

== 
  パブリッククラスオーダー{ 
    プライベート文字列ID。
    プライベート文字列orderNum。
    プライベート日付orderTime。
    プライベート文字列orderTimeStr。
    プライベート文字列orderStatusStr。
    プライベートint型peopleCount。
    民間製品の製品。
    プライベートリスト<旅行>旅行者。
    プライベートメンバ部材と、
    プライベート整数payType。
    プライベート文字列payTypeStr。
    プライベート文字列orderDesc。
} 

4.追加と削除

  @Insert( "許可に挿入(permissionName、URL)の値(#{permissionName}、#{URL})")
    空隙保存(許可権限)例外をスローします。


    @Delete( "role_permissionから削除permissionId =#{ID}")
    空隙deleteFromRole_Permission(文字列ID)が例外をスローします。

    @Delete( "ID =#{ID}許可から削除")
    空隙deleteById(文字列ID)が例外をスローします。  

おすすめ

転載: www.cnblogs.com/liushisaonian/p/11208741.html