1 使用map <select id="selectRole" parameterType="map" resultType="RoleMap"> SELECT id, roleName, note FROM role WHERE roleName LIKE Concat('%',#{roleName},'%') and note like Concat('%',#{note},'%') </select> 在接口中如下定…
动态sql where if where可以自动处理第一个and. <!-- 根据id查询用户信息 --> <!-- public User findUserById(int id); --> <select id="findUserById" parameterType="user" resultType="user"> select * from user <!-- 当有if条件成立时,where会自…
Available parameters are [2, 1, 0, param1, param2, param3] <select id="loginByTeacher" parameterType="String" resultType="User"> SELECT * FROM `user` WHERE LoginID=#{0} and LoginPwd=#{1} AND Role=2 </select>…