1 //基本类型 2 3 @Override 4 public String queryItemNumber(String packId) throws Exception { 5 // TODO Auto-generated method stub 6 return dao.findForObject("SetMealMapper.queryItemNumber", packId).toString(); 7 } 8 9 10 <select id="queryItemNumber" parameterType="String" resultType="int" > 11 select count(1) from busi_repairpackage_detail where pak_m_id = #{packId} 12 </select>
//List数组 /** * 保存套餐项目到Map数据库表 * @param pd * @throws Exception */ @Override public void saveRepairItemMap(List<BusiRepairPackageMap> item_list) throws Exception { // TODO Auto-generated method stub dao.save("SetMealMapper.saveRepairItemMap", item_list); } <insert id="saveRepairItemMap" parameterType="java.util.List"> insert into busi_repairpackage_detail (pak_m_id,item_id) values <foreach collection="list" item="item" index="index" separator=","> (#{item.pack_id},#{item.item_id}) </foreach> </insert>
//自定义pd对象 @Override public void updateRepairItemList(PageData pd) throws Exception { // TODO Auto-generated method stub dao.update("SetMealMapper.updateRepairItemList", pd); } <update id="updateRepairItemList" parameterType="pd"> update BUSI_REPAIRPACKAGE_INFO set pack_name = ${pack_name} ,pack_sort = ${pack_sort} where PAK_M_ID = ${pack_id} and GARAGE_ID = ${GARAGE_ID} </update>