constSQL='SELECT child_type.childTypeId, child_type.childTypeName, child_type.typeId FROM child_type INNER JOIN type ON child_type.typeId = type.typeId WHERE type.typeId = ?'
Mysql.query(SQL,[typeId],(err,result)=>{
if(err){
res.send({
success:false,
err
})
}
res.send({
success:true,
data:result
})
})
});
router.get('/queryToolBox',(req,res)=>{
let{isFollow,typeId}=req.query
letSQL=`SELECT toolbox.*, type_childtype_toolbox.childTypeId FROM type_childtype_toolbox INNER JOIN toolbox ON type_childtype_toolbox.toolBoxId = toolbox.toolBoxId WHERE type_childtype_toolbox.typeId = ?`
if(!isFollow&&!typeId){
SQL=`SELECT * FROM toolBox`
}
if(isFollow){
typeId=JSON.parse(typeId)
SQL='SELECT * FROM toolbox WHERE toolboxId IN (?)'
constSQL='SELECT child_type.childTypeId, child_type.childTypeName, child_type.typeId, type.typeName FROM child_type INNER JOIN type ON child_type.typeId = type.typeId'