<!-- 方法1,构建查询对象; QueryCondition qc = new QueryCondition(); qc.setGender(1); qc.setBirthday(new Date()); --> <select id="selectPersonByParams" parameterType="com.stone.model.QueryCondition" resultMap="BaseResultMap"> <![CDATA[ select * from person t where t.gender=#{gender} and t.birthday <#{birthday} ]]> </select> <!-- 方法2,使用map; map.put("gender",1); map.put("birthday",new Date()); --> <select id="selectPersonByParams" parameterType="java.util.Map" resultMap="BaseResultMap"> <![CDATA[ select * from person t where t.gender=#{gender} and t.birthday <#{birthday} ]]> </select>
时间: 2024-10-13 17:49:52