var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;

class TemplatelinkCtl extends CtlBase {
    constructor() {
        super("templateinfomag", CtlBase.getServiceName(TemplatelinkCtl));
        this.templatelinkSve = system.getObject('service.template.templatelinkSve');
    }

    /**
     * 重写查询方法
     * @param pobj
     * @returns {Promise<{msg: string, data: *, bizmsg: string, status: number}>}
     */
    async findAndCountAll(pobj) {
        let result = await this.templatelinkSve.findAndCountAll(pobj);
        return result;
    }

    /**
     * 重写保存方法
     * @param pobj
     * @returns {Promise<void>}
     */
    async create(pobj){
        let result =  await this.templatelinkSve.createTemplateLink(pobj);
        return result;
    }

    /**
     * 修改投放状态
     * @param {*} pobj 
     */
    async updateLaunchStatus(pobj){
        let result =  await this.templatelinkSve.updateLaunchStatus(pobj);
        return result;
    }

    async delete(pobj, qobj, req) {
        const up = await this.templatelinkSve.deleteTemplateLink(pobj);
        return system.getResult(up);
    }
}

module.exports = TemplatelinkCtl;
