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中不寫則啓動報錯:
java
BoundSql.getParameterObject(): 數據庫
List<ProductInfo> queryByPage(ProductQueryReq queryModel);
若是mapper.xml用了別名報錯:app
UserImageTransfer selectFirstHistoryOrcInfo(String productCode, String userId);
collection 下 主表 和附表 都須要查出主鍵;即便<id>標籤寫了其餘字段也沒用,必定是數據庫表真實的主鍵.dom
<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>