DataServiceImpl.java
1.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.eck.auto.service.impl;
import com.eck.auto.dao.AberrantDao;
import com.eck.auto.dao.DataDao;
import com.eck.auto.exception.MyException;
import com.eck.auto.model.Aberrant;
import com.eck.auto.service.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Created by Administrator on 2018/7/21.
*/
@Service
public class DataServiceImpl implements DataService {
//@Autowired
private DataDao dataDao;
@Autowired
private AberrantDao aberrantDao;
public List<Aberrant> find(Integer id){
List<Aberrant> list = aberrantDao.findAll();
return list;
}
/**
* 测试事务
*/
@Transactional
public void upate() {
aberrantDao.update();
if(1==1){
throw new MyException(HttpStatus.OK.value(),"xxxxx","主动异常");
}
}
}