1.controllersql
const {ctx,service} = this;
let id = ctx.query.id // 获取GET的参数
let body = ctx.request.body // 获取POST的参数
2.service中的增删改查this
let insertAuth = await ctx.basmodel.query(sql,{type:'INSERT'})
let insertAuth = await ctx.basmodel.query(sql,{type:'UPDATE'})
let insertAuth = await ctx.basmodel.query(sql,{type:'DELETE'})
let insertAuth = await ctx.basmodel.query(sql,{type:'SELECT'})
3.Sequelize经常使用方法:spa
let insert = await ctx.basmodel.GoodsCategoryModel.create()//添加
let insert = await ctx.basmodel.GoodsCategoryModel.update({where:id})//修改
let insert = await ctx.basmodel.GoodsCategoryModel.destroy({where:id})//删除
let insert = await ctx.basmodel.GoodsCategoryModel.findAll({where:id})//查询