ServiceImplTemplate.ftl
2.84 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package ${basePackage}.service.impl;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import ${basePackage}.bean.entity.${entityClassSimpleName};
import ${basePackage}.repository.${repositoryClassSimpleName};
import ${basePackage}.service.${serviceClassSimpleName};
import com.taover.util.UtilLog;
import com.taover.util.bean.ResultInfo;
import com.taover.util.bean.UtilResultInfo;
@Service
public class ${serviceImplClassSimpleName} implements ${serviceClassSimpleName} {
@Resource
private ${repositoryClassSimpleName} ${repositoryClassFieldName};
@Override
public ResultInfo getListV1(List<Object[]> condition, Integer page, Integer size) {
try {
return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.getVoPage(condition, page, size));
} catch (Exception e) {
UtilLog.errorForException(e, this.getClass());
return UtilResultInfo.getFailure(e.getMessage());
}
}
@Override
public ResultInfo getOneV1(String ssid) {
try {
return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.getVoBySsid(ssid));
} catch (Exception e) {
UtilLog.errorForException(e, this.getClass());
return UtilResultInfo.getFailure(e.getMessage());
}
}
@Override
public ResultInfo getListManage(List<Object[]> condition, Integer page, Integer size) {
try {
return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.getVoPage(condition, page, size));
} catch (Exception e) {
UtilLog.errorForException(e, this.getClass());
return UtilResultInfo.getFailure(e.getMessage());
}
}
@Override
public ResultInfo getOneManage(String ssid) {
try {
return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.getVoBySsid(ssid));
} catch (Exception e) {
return UtilResultInfo.getFailure(e.getMessage());
}
}
@Override
public ResultInfo putManage(String ssid, List<Object[]> updateList) {
try{
this.${repositoryClassFieldName}.updateEntityBySsid(ssid, updateList);
}catch(Exception e){
UtilLog.errorForException(e, this.getClass());
return UtilResultInfo.getFailure(e.getMessage());
}
return UtilResultInfo.getSuccess("更新成功");
}
@Override
public ResultInfo deleteManage(String ssid) {
try{
this.${repositoryClassFieldName}.deleteEntityBySsid(ssid);
}catch(Exception e){
UtilLog.errorForException(e, this.getClass());
return UtilResultInfo.getFailure(e.getMessage());
}
return UtilResultInfo.getSuccess("删除成功");
}
@Override
public ResultInfo postManage(Map<String, Object> data) {
try {
return UtilResultInfo.getSuccess("创建成功", this.${repositoryClassFieldName}.addEntityByMap(data));
} catch (Exception e) {
UtilLog.errorForException(e, this.getClass());
return UtilResultInfo.getFailure(e.getMessage());
}
}
}