zx 5 years ago
parent 5dcf891496
commit e60e5a3ff4

@ -1,18 +1,19 @@
package com.book.demo.mapper;
import com.book.demo.entity.Cart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
@Repository
@Mapper
public interface CartMapper {
@Select("select * from user_cart where id=#{id} and username=#{username}")
int insertItem(String username,int id);
@Insert("insert into user_cart values (#{username},#{bookname})")
int insertItem(String username,String bookname);
@Delete("delete from user_cart where username=#{username}")
void clearCart(String username);
@Select("select * from user_cart where username=#{username}")
Cart queryByName(String username);
@Update({"update user_cart set username=#{username}", "update user_cart set bookname=#{bookname}", "update user_cart set count=#{count}"})
int updateCount(String username,String bookname,int count);
}

Loading…
Cancel
Save