<update id = "dishBatchSaleOrDown"> <if test="ids != null"> <if test="isDelete != null"> update dishData set isDelete = #{isDelete} where id IN <foreach collection="ids" item="id" open…
今天在工作时,使用MyBatis中向sql传递两个参数时,一直显示SQL语法错误,仔细检查,才发现传入的参数被加上了引号,导致传入的参数(要传入的参数是表名)附近出现语法错误. 错误写法: } a } b on a.config_id = b.config_id; 这种写法在控制台报错: select pro_type, name, b.info from ? a inner join ? b on a.config_id = b.config_id;### Cause: com.mysql.j…
第一种: Dao层的方法 public User selectUser(String name,String password); 对应的Mapper.xml <select id="selectUser" resultMap="BaseResultMap"> select * from t_user where user_name = #{0} and user_password=#{1} </select> 第二种: 该方法采用Map传多…