ServiceImplTemplate.ftl
1.27 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
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(Long id) {
try {
return UtilResultInfo.getSuccess("查询成功", this.${repositoryClassFieldName}.findEntityByID(id));
} catch (Exception e) {
UtilLog.errorForException(e, this.getClass());
return UtilResultInfo.getFailure(e.getMessage());
}
}
}