Mybatis 注解形式

1.查询

//    查询
@Select("select id, name, type, numbers, cancelled, completed, percentage from customer_list")
List<CustomerList> selectCustomerListAll();
2.修改
//    修改
@Update("<script> update customer_list set <if test = 'name != null'> name = #{name} ,</if>" +
"<if test = 'type != null'> type = #{type} ,</if>" +
"<if test = 'numbers != null'> numbers = #{numbers} ,</if>" +
"<if test = 'cancelled != null'> cancelled = #{cancelled} ,</if>" +
"<if test = 'completed != null'> completed = #{completed} ,</if>" +
"<if test = 'percentage != null'> percentage = #{percentage} ,</if>" +
"id = #{id} where id = #{id}</script>")
int updateCustomerListOneId(CustomerList customerList);

3.查询
与修改类似
 
 

猜你喜欢

转载自www.cnblogs.com/itxiaoxia/p/11868810.html