Mybatis 动态查询、插入、修改操作

简单的记一下吧
insert操作特别注意里面的判断语句,一般都是用包装类最好,另外 String类型最好加上一个判断!= ''

insert into item_info pid, batch_name, faculty, item_type, item_rank, item_apply_status, item_middle_status, item_conclusion_status, item_sumMoney, item_balanceMoney, apply_time, item_introduce, #{pid}, #{batch_name}, #{faculty}, #{item_type}, #{item_rank}, #{item_apply_status}, #{item_middle_status}, #{item_conclusion_status}, #{item_sumMoney}, #{item_balanceMoney}, #{apply_time}, #{item_introduce},



【Mybatis 动态查询、插入、修改操作】select 操作还是自己要去注意where标签的用法
select * from item_info faculty = #{faculty} and item_type = #{item_type} and item_rank = #{item_rank} and pid = #{pid} and item_id = #{item_id} and 1=1


update这里有一个set标签的用法
update student studName = #{studName,jdbcType=VARCHAR}, stud_faculty = #{stud_faculty,jdbcType=VARCHAR}, className = #{className,jdbcType=VARCHAR}, qq = #{qq,jdbcType=VARCHAR}, sex = #{sex,jdbcType=VARCHAR}, phoneNumber = #{phoneNumber,jdbcType=VARCHAR}, studNum = #{studNum,jdbcType=VARCHAR}, where item_id = #{item_id,jdbcType=INTEGER} and sign = #{sign}


    推荐阅读