<select id="selectQuickConsultDoctorList" resultMap="BaseResultMap" parameterType="java.util.List"> SELECT doc.* FROM user_doctor doc LEFT JOIN bas_professional pro ON pro. NAME = doc.profession_field WHERE doc.`approved` = 2 AND (doc.consultprice = 0 or doc.consulttoll = 3) <if test="list != null"> AND doc.doctorID in <foreach collection="list" open="(" close=")" separator="," item="doctorid"> #{doctorid,jdbcType=INTEGER} </foreach> </if> </select>
List<UserDoctor> selectQuickConsultDoctorList(List<Integer> paramList);
结果:
SELECT doc.* FROM user_doctor doc LEFT JOIN bas_professional pro ON pro. NAME = doc.profession_field WHERE doc.`approved` = 2 AND ( doc.consultprice = 0 OR doc.consulttoll = 3 ) AND doc.doctorID IN (?, ?, ?, ?, ?, ?, ?, ?, ?)
补充:diseaseIds : "8,19"
@Override public List<Map<String,String>> getMedicinal(String diseaseIds ,Integer userId) { UserSession session = usrUserService.getUserSession(userId); Map<String,Object> paramMap = new HashMap<String,Object>(); paramMap.put("diseaseIds", diseaseIds.split(",")); paramMap.put("hospitalId", String.valueOf(session.getHosId())); List<Map<String,String>> list = basMedicinalMapper.getMedicinal(paramMap); return list; }
List<Map<String,String>> getMedicinal(Map<String,Object> paramMap);
WHERE mdl.disease_id in <foreach collection="diseaseIds" open="(" close=")" item="item" separator=","> #{item,jdbcType=INTEGER} </foreach>
WHERE mdl.disease_id in ( ? , ? )
Parameters: 8(String), 19(String)