forked from t-hong/springboot-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemoService.java
More file actions
65 lines (55 loc) · 1.11 KB
/
DemoService.java
File metadata and controls
65 lines (55 loc) · 1.11 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.hong.service;
import com.hong.dao.DemoDao;
import com.hong.domain.Demo;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by hong on 2017/4/25.
*/
@Service
public class DemoService {
@Autowired
private DemoDao demoDao;
/**
* 添加
*
* @param demo
*/
public Demo add(Demo demo) {
return demoDao.save(demo);
}
/**
* 添加一组demo
* @param demoList
* @return
*/
public List<Demo> addMemoList(List<Demo> demoList) {
return demoDao.save(demoList);
}
/**
* 更新
* @param demo
* @return
*/
public Demo update(Demo demo) {
return demoDao.save(demo);
}
/**
* 查找所有demo
* @return
*/
public List<Demo> findDemoAll() {
return demoDao.findAll();
}
/**
* 根据id 删除一条记录
* @param id
* @return
*/
public int del(Long id) {
demoDao.delete(id);
return 1;
}
}