const ServiceBase = require("../sve.base");

class EtemplatebusiService extends ServiceBase {
    constructor() {
        super(ServiceBase.getDaoName(EtemplatebusiService));
    }

    async getlist(qobj) {
        var sql = "SELECT * FROM c_etemplate_busi WHERE template_type = "+qobj.type+" AND template_id = " + qobj.id;
        var page = await this.customQuery(sql);
        return page;
    }

    async getinfo(qobj) {
        var sql = "SELECT * FROM c_etemplate_busi WHERE template_id = " + qobj.template_id + " AND busi_id = " + qobj.company_id;
        var page = await this.customQuery(sql);
        return page;
    }

    async deleteTetId(qobj) {
        let sql = "DELETE FROM c_etemplate_busi WHERE id = " + qobj.id;
        await this.customExecAddOrPutSql(sql);
        return 1;
    }

    async suggest(name, ownerIds) {
        return await this.dao.suggest(name, ownerIds);
    }

    async saveto(etebusi) {
        return await this.create(etebusi);

    }
}

module.exports = EtemplatebusiService;