add: 添加事务
This commit is contained in:
@@ -4,7 +4,6 @@ import jakarta.annotation.Resource;
|
||||
import org.dromara.common.Result;
|
||||
import org.dromara.domain.Cls;
|
||||
import org.dromara.service.IClsService;
|
||||
import org.dromara.service.impl.ClsService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@@ -6,6 +6,7 @@ import org.dromara.domain.Student;
|
||||
import org.dromara.mapper.StudentMapper;
|
||||
import org.dromara.service.IStudentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@Service
|
||||
@@ -13,22 +14,27 @@ public class StudentService implements IStudentService {
|
||||
@Resource
|
||||
private StudentMapper studentMapper;
|
||||
|
||||
@Transactional
|
||||
public void add(Student student) {
|
||||
studentMapper.insert(student);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void update(Student student) {
|
||||
studentMapper.updateById(student);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteById(Integer id) {
|
||||
studentMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Student> selectAll(Student student) {
|
||||
return studentMapper.selectAll(student);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Student selectById( Integer id) {
|
||||
return studentMapper.selectById(id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user