task03
This commit is contained in:
parent
48b58c544e
commit
5da79544a7
|
@ -0,0 +1,12 @@
|
|||
package com.hnucm.springboot.springboot1.dao;
|
||||
|
||||
import com.hnucm.springboot.springboot1.model.Orders;
|
||||
import com.hnucm.springboot.springboot1.model.StuCard;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface OrdersMapper {
|
||||
public List<Orders> findOrdersByPersonId(int personId);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.hnucm.springboot.springboot1.dao;
|
||||
|
||||
import com.hnucm.springboot.springboot1.model.Person;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PersonMapper {
|
||||
public List<Person> getAllPersonStuCard();
|
||||
public List<Person> getAllPerson();
|
||||
//int 表示增加的条数
|
||||
public int addPerson(Person person);
|
||||
public int deletePerson(int id);
|
||||
public int updatePerson(Person person);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.hnucm.springboot.springboot1.dao;
|
||||
|
||||
import com.hnucm.springboot.springboot1.model.Person;
|
||||
import com.hnucm.springboot.springboot1.model.StuCard;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface StuCardMapper {
|
||||
//根据学生证的主键查询对应的学生证信息
|
||||
public StuCard getStuCardById(int id);
|
||||
//增加成功的条数
|
||||
public int addStuCard(StuCard stuCard);
|
||||
// 删除学生卡 根据id
|
||||
public int deleteStuCard(int id);
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package com.hnucm.springboot.springboot1.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class Orders {
|
||||
private int id;
|
||||
private String orderinfo;
|
||||
private int orderprice;
|
||||
private int personid;
|
||||
private List<Product> productList;
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package com.hnucm.springboot.springboot1.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class Person {
|
||||
private int id;
|
||||
private String name;
|
||||
private int age;
|
||||
private StuCard stuCard;
|
||||
private List<Orders> ordersList;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.hnucm.springboot.springboot1.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Product {
|
||||
private int id;
|
||||
private String productname;
|
||||
private String productprice;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.hnucm.springboot.springboot1.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StuCard {
|
||||
private int id;
|
||||
private String stuid;
|
||||
private String classname;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.hnucm.springboot.springboot1.model;
|
||||
|
||||
import lombok.Data;
|
||||
// Data set+ get
|
||||
@Data
|
||||
public class User {
|
||||
private int id;
|
||||
private String name;
|
||||
private int age;
|
||||
}
|
|
@ -13,10 +13,10 @@ import java.util.List;
|
|||
@Service
|
||||
public class PersonServiceImpl implements PersonService {
|
||||
@Autowired
|
||||
private PersonMapper personMapper2;
|
||||
private PersonMapper personMapper3;
|
||||
|
||||
@Autowired
|
||||
StuCardMapper stuCardMapper2;
|
||||
StuCardMapper stuCardMapper3;
|
||||
|
||||
@Override
|
||||
public List<Person> getAllPerson() {
|
||||
|
@ -29,7 +29,7 @@ public class PersonServiceImpl implements PersonService {
|
|||
stuCardMapper.addStuCard(person.getStuCard());
|
||||
return personMapper.addPerson(person);
|
||||
}
|
||||
// 事务 -》 增删改 多张表 同时操作
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public int deletePerson(int id, int stuid) {
|
||||
|
|
Loading…
Reference in New Issue