zx 4 years ago
parent f653ca96de
commit 0376f471f3

@ -2,4 +2,3 @@
2.写了就git add . 2.写了就git add .
3.git commit -m "当前是第几次提交就写几,总次数" 3.git commit -m "当前是第几次提交就写几,总次数"
4.git push origin master 4.git push origin master

@ -52,7 +52,7 @@ public class OrderController {
//更新订单状态 //更新订单状态
@ResponseBody @ResponseBody
@GetMapping("/updateorder") @GetMapping("/updateorder")
public Result updateOrder(@RequestParam("orderid")String orderid,@RequestParam("state")int states){ public Result updateOrder(@RequestParam("orderid")int orderid,@RequestParam("state")int states){
int state=orderMapper.updateOrder(orderid,states); int state=orderMapper.updateOrder(orderid,states);
if(state>0){ if(state>0){
res.setCode(0); res.setCode(0);
@ -88,7 +88,7 @@ public class OrderController {
//删除订单>>根据订单号删除对应订单 //删除订单>>根据订单号删除对应订单
@ResponseBody @ResponseBody
@GetMapping("/deleteorder") @GetMapping("/deleteorder")
public Result deleteOrder(@RequestParam("orderid")String orderid){ public Result deleteOrder(@RequestParam("orderid")int orderid){
int state=orderMapper.deleteOrder(orderid); int state=orderMapper.deleteOrder(orderid);
if(state>0){ if(state>0){
res.setCode(0); res.setCode(0);

@ -6,7 +6,7 @@ import java.sql.Date;
@Data @Data
public class Order { public class Order {
String id; int id;
String username; String username;
Date ortime; Date ortime;
int state; int state;

@ -20,10 +20,12 @@ public interface BookMapper {
@Select("select * from book") @Select("select * from book")
Book[] getAll(); Book[] getAll();
@Select("select * from book where bookname=#{bookname}") @Select("select * from book where bookname like '%${bookname}%' ")
Book[] searchBooks(String bookname); Book[] searchBooks(String bookname);
@Delete("delete from book where bookname=#{bookname}") @Delete("delete from book where bookname=#{bookname}")
int deleteByBookName(String bookname); int deleteByBookName(String bookname);
@Insert("insert into book (bookname,kind,price) values (#{bookname},#{kind},#{price})") @Insert("insert into book (bookname,kind,price) values (#{bookname},#{kind},#{price})")
int Insert(Book book); int Insert(Book book);
@Select("select * from book where bookname=#{bookname}")
Book searchBookbyName(String bookname);
} }

@ -7,8 +7,8 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
@Mapper @Mapper
public interface CartMapper { public interface CartMapper {
@Insert("insert into cart (username,bookname) values (#{username},#{bookname})") @Insert("insert into cart (username,bookname,price,count) values (#{username},#{bookname},#{price},1)")
int insertItem(String username,String bookname); int insertItem(String username,String bookname,float price);
@Delete("delete from cart where username=#{username}") @Delete("delete from cart where username=#{username}")
void clearCart(String username); void clearCart(String username);
@Select("select * from cart where username=#{username}") @Select("select * from cart where username=#{username}")

@ -14,7 +14,7 @@ public interface OrderMapper {
@Insert("insert into orders(username,state) values(#{username},0)") @Insert("insert into orders(username,state) values(#{username},0)")
int createOrder(String username); int createOrder(String username);
@Delete("delete from orders where id=#{orderid}") @Delete("delete from orders where id=#{orderid}")
int deleteOrder(String orderid); int deleteOrder(int orderid);
@Update("update orders set state=#{states} where id=#{orderid}") @Update("update orders set state=#{states} where id=#{orderid}")
int updateOrder(String orderid,int states); int updateOrder(int orderid, int states);
} }

@ -1,6 +1,6 @@
server.port=8090 server.port=8090
spring.datasource.url=jdbc:mysql://localhost:3306/bookstore?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8 spring.datasource.url=jdbc:mysql://localhost:3306/test02?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=root spring.datasource.password=root

Loading…
Cancel
Save