<%
var parentPkgName=GetGParamValue('EZGEN_ROOT_PKGNAME'); //上级包名
if(!parentPkgName)parentPkgName='com.ezdml.codegen.ezdmlcodegendemo';

var tb=curTable; //当前表
var ClsName=AutoCapProc(tb.name,'ClassName'); //类名（驼峰命名，首字母大写）
var tbName=AutoCapProc(tb.name,'FieldName'); //字段名（驼峰命名，首字母小写）
var dispName=tb.UIDisplayName; //逻辑显示名
%>package ${parentPkgName}.${AutoCapProc(curModel.name,'JavaPackageName')}.${AutoCapProc(tb.name,'JavaPackageName')};

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ${ClsName}ServiceImpl implements ${ClsName}Service {

    @Autowired
    private ${ClsName}Repository ${tbName}Repository;

    @Override
    public List<${ClsName}> findAll() {
        return ${tbName}Repository.findAll();
    }

    @Override
    public List<${ClsName}> findByIds(Iterable<Long> ids) {
        return ${tbName}Repository.findAllById(ids);
    }

    @Override
    public ${ClsName} findById(Long id) {
        return ${tbName}Repository.getById(id);
    }

    @Override
    public long count() {
        return ${tbName}Repository.count();
    }

    @Override
    public ${ClsName} add(${ClsName} ${tbName}) {
        return ${tbName}Repository.save(${tbName});
    }

    @Override
    public ${ClsName} update(${ClsName} ${tbName}) {
        return ${tbName}Repository.save(${tbName});
    }

    @Override
    public void delete(${ClsName} ${tbName}) {
        ${tbName}Repository.delete(${tbName});
    }

    @Override
    public void deleteById(Long id) {
        ${tbName}Repository.deleteById(id);
    }

    @Override
    public void deleteByIds(Iterable<Long> ids) {
        ${tbName}Repository.deleteAllById(ids);
    }
}
