All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.generator.Service.vm Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
package ${package}.${moduleName}.service;

import ${package}.${moduleName}.dao.${className}Dao;
import ${package}.${moduleName}.entity.${className};
import com.github.hdy.common.result.Results;
import com.github.hdy.common.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ${comments}
 *
 * @author ${author}
 * @date ${datetime}
 */
@Service
public class ${className}Service {

    @Autowired
    private ${className}Dao ${className}Dao;

    public Results page(${className} ${classname}, Integer pageNumber, Integer pageSize) {
        return Results.success(${className}Dao.page(${classname}, pageNumber, pageSize));
    }

    public Results insert(${className} ${classname}) {
        ${classname} =${className}Dao.insert(${classname});
        if (${classname} ==null)
            return Results.fail();
        return Results.success();
    }

    public Results update(${className} ${classname}) {
        ${classname} =${className}Dao.update(${classname});
        if (${classname} ==null)
            return Results.fail();
        return Results.success();
    }

    public Results delete(${className} ${classname}) {
        if (Strings.isNull(${classname}.getId()))
            return Results.fail("参数缺失");
        int k = ${className}Dao.delete(${classname}.getId());
        if (k > 0)
            return Results.success();
        return Results.fail();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy