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