DAO层方法:
/**
*
* @param planPurchaseId
* @param goodsDbIdList
* @return
*/
List<ProjectPlanReqDetail> selectPlanReqDetail(@Param("planPurchaseId") String planPurchaseId, @Param("goodsDbIdList") List<String> goodsDbIdList);
<!-- -->
<select id="selectPlanReqDetail" resultMap="ProjectPlanReqDetailMap">
SELECT
PROJECT_PLAN_REQ_DETAIL.PLAN_DETAIL_ID,
PROJECT_PLAN_REQ_DETAIL.PLAN_PURCHASE_ID,
PROJECT_PLAN_REQ_DETAIL.PLAN_MAT_CODE,
PROJECT_PLAN_REQ_DETAIL.PLAN_REQ_NUM_NOW,
PROJECT_PLAN_REQ_DETAIL.PLAN_ALREADY_BUY_NUM,
PROJECT_PLAN_REQ_DETAIL.PLAN_SHOULD_BUY_NUM
FROM
PROJECT_PLAN_REQ_DETAIL
INNER JOIN GOODS_INFO ON GOODS_INFO.GOODS_MAT_CODE = PROJECT_PLAN_REQ_DETAIL.PLAN_MAT_CODE
AND GOODS_INFO.GOODS_MAT_CODE = PROJECT_PLAN_REQ_DETAIL.PLAN_MAT_CODE
WHERE
PROJECT_PLAN_REQ_DETAIL.PLAN_PURCHASE_ID = #{planPurchaseId}
AND
GOODS_INFO.GOODS_DBID IN
<foreach collection="goodsDbIdList" item="item" index="index" close="(" open=")" separator=",">
#{item}
</foreach>
SQL按条件批量查询