您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關(guān)mybatis使用經(jīng)驗(yàn)是怎樣的,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
List<ProductInfo> queryByPage(@Param("model") ProductQueryReq queryModel);
<select id="queryByPage" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from product_info where is_deleted='N' <if test= "model.productStatus != null"> and status = #{model.productStatus,jdbcType=INTEGER} </if> </select>
mapper.xml中不寫則啟動(dòng)報(bào)錯(cuò):
BoundSql.getParameterObject():
List<ProductInfo> queryByPage(ProductQueryReq queryModel);
如果mapper.xml用了別名報(bào)錯(cuò):
UserImageTransfer selectFirstHistoryOrcInfo(String productCode, String userId);
collection 下 主表 和附表 都需要查出主鍵;即使<id>標(biāo)簽寫了其他字段也沒用,一定是數(shù)據(jù)庫表真實(shí)的主鍵.
<resultMap id="BaseResultMap" type="com.noob.domain.CmbClaimPackage" > <id column="id" property="id" jdbcType="BIGINT" /> <result column="batch_no" property="batchNo" jdbcType="VARCHAR" /> <result column="product_code" property="productCode" jdbcType="VARCHAR" /> <result column="package_no" property="packageNo" jdbcType="VARCHAR" /> <result column="serial_no" property="serialNo" jdbcType="VARCHAR" /> <result column="amount" property="amount" jdbcType="DECIMAL" /> <result column="total_count" property="totalCount" jdbcType="DECIMAL" /> <result column="origin_info" property="originInfo" jdbcType="VARCHAR" /> <result column="trade_status" property="tradeStatus" jdbcType="INTEGER" /> <result column="return_info" property="returnInfo" jdbcType="VARCHAR" /> <result column="upload_sign" property="uploadSign" jdbcType="CHAR" /> <result column="last_upload_date" property="lastUploadDate" jdbcType="VARCHAR" /> <result column="remark" property="remark" jdbcType="VARCHAR" /> <result column="creator" property="creator" jdbcType="VARCHAR" /> <result column="gmt_created" property="gmtCreated" jdbcType="TIMESTAMP" /> <result column="modifier" property="modifier" jdbcType="VARCHAR" /> <result column="gmt_modified" property="gmtModified" jdbcType="TIMESTAMP" /> <result column="is_deleted" property="isDeleted" jdbcType="CHAR" /> </resultMap> <resultMap id="PackageModelResultMap" type="com.noob.model.CmbClaimPackageModel" extends="BaseResultMap"> <collection property="detailList" javaType="list" ofType="com.noob.domain.CmbClaimDetail"> <id column="d_id" property="id" jdbcType="BIGINT" /> <result column="d_batch_no" property="batchNo" jdbcType="VARCHAR" /> <result column="d_product_code" property="productCode" jdbcType="VARCHAR" /> <result column="d_amount" property="amount" jdbcType="DECIMAL" /> <result column="d_package_no" property="packageNo" jdbcType="VARCHAR" /> <result column="d_contract_no" property="contractNo" jdbcType="VARCHAR" /> <result column="d_policy_no" property="policyNo" jdbcType="VARCHAR" /> <result column="d_serial_no" property="serialNo" jdbcType="VARCHAR" /> <result column="d_trade_no" property="tradeNo" jdbcType="VARCHAR" /> <result column="d_report_amount" property="reportAmt" jdbcType="DECIMAL" /> <result column="d_trade_status" property="tradeStatus" jdbcType="INTEGER" /> <result column="d_resp_code" property="respCode" jdbcType="VARCHAR" /> <result column="d_resp_msg" property="respMsg" jdbcType="VARCHAR" /> <result column="d_report_no" property="reportNo" jdbcType="VARCHAR" /> <result column="d_claim_no" property="claimNo" jdbcType="VARCHAR" /> <result column="d_return_info" property="returnInfo" jdbcType="VARCHAR" /> <result column="d_agreed_repay_date" property="agreedRepayDate" jdbcType="VARCHAR" /> <result column="d_gmt_created" property="gmtCreated" jdbcType="TIMESTAMP" /> </collection> </resultMap> <select id="selectDoing" resultMap="PackageModelResultMap" parameterType="java.util.Date" > select p.id, p.batch_no, p.serial_no, p.product_code, p.package_no, p.amount, p.origin_info, p.trade_status, p.return_info, d.id d_id, d.product_code d_product_code, d.package_no d_package_no, d.batch_no d_batch_no, d.serial_no d_serial_no, d.amount d_amount, d.contract_no d_contract_no, d.policy_no d_policy_no, d.trade_no d_trade_no, d.report_amount d_report_amount, d.trade_status d_trade_status, d.resp_code d_resp_code, d.resp_msg d_resp_msg, d.report_no d_report_no, d.claim_no d_claim_no, d.agreed_repay_date d_agreed_repay_date, d.gmt_created d_gmt_created, d.return_info d_return_info from cmb_creditcard_claim_package p inner join cmb_creditcard_claim_detail d on p.batch_no = d.batch_no where p.gmt_created >= #{beginDate,jdbcType=TIMESTAMP} and <include refid="doing_condition"/> and <include refid="alive_condition"/> </select>
以上就是mybatis使用經(jīng)驗(yàn)是怎樣的,小編相信有部分知識點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。