diff --git a/controller/meetingController.js b/controller/meetingController.js index a596a90..5f399a1 100644 --- a/controller/meetingController.js +++ b/controller/meetingController.js @@ -170,7 +170,6 @@ meetingController.prototype.getMeeting = async(ctx,next) =>{ let page = ctx.header.page ? Number(ctx.header.page):ctx.header.page; let pageno = ctx.header.pageno ? Number(ctx.header.pageno):ctx.header.pageno; var meetingData = await meetingService.getMeeting(meetingbody,page,pageno); - console.log(meetingData.meetingInfo) return meetingData; } catch (error) { throw error; diff --git a/controller/studentMeetingController.js b/controller/studentMeetingController.js index 071bb83..6c6dae6 100644 --- a/controller/studentMeetingController.js +++ b/controller/studentMeetingController.js @@ -47,4 +47,15 @@ studentMeetingController.prototype.getStudentMeetingCount = async(ctx, next) =>{ } +studentMeetingController.prototype.queryStudentMeeting = async(ctx, next)=>{ + let teacherName = ctx.params.teacherName; + if(!teacherName){ + return status.paramError('teacherName'); + } + let page = ctx.header.page ? Number(ctx.header.page):ctx.header.page; + let pageno = ctx.header.pageno ? Number(ctx.header.pageno):ctx.header.pageno; + let sn = await studentMeetingService.queryStudentMeeting(teacherName,page,pageno); + return sn +} + module.exports = new studentMeetingController(); \ No newline at end of file diff --git a/routes/studentMeeting.js b/routes/studentMeeting.js index e732402..a9ba4d3 100644 --- a/routes/studentMeeting.js +++ b/routes/studentMeeting.js @@ -29,6 +29,25 @@ router.get('/getStudentMeetingCount/:meetingId',async (ctx, next) => { status.catchError(ctx,400,e.message); } }) +router.get('/delStudentMeeting/:studentMeetingId',async (ctx, next) => { + try{ + var data = await studentMeetingController.delStudentMeeting(ctx, next); + status.successTemp(ctx,200,data); + }catch(e){ + console.log(e) + status.catchError(ctx,400,e.message); + } +}) + +router.get('/queryStudentMeeting/:teacherName',async (ctx, next) => { + try{ + var data = await studentMeetingController.queryStudentMeeting(ctx, next); + status.successTemp(ctx,200,data); + }catch(e){ + console.log(e) + status.catchError(ctx,400,e.message); + } +}) module.exports = router; \ No newline at end of file diff --git a/services/studentMeetingService.js b/services/studentMeetingService.js index 46a249d..f39e611 100644 --- a/services/studentMeetingService.js +++ b/services/studentMeetingService.js @@ -53,4 +53,25 @@ sutudentMeetingService.prototype.getStudentMeetingCount = async(meetingId) =>{ } } + +sutudentMeetingService.prototype.queryStudentMeeting = async(teacherName,page=1,pageno=8)=>{ + try { + let querySql = `SELECT + 3u.*, 3meet.meeting_name, + 3meet.create_user teacherName + FROM + 3m_student_meeting 3sm + LEFT JOIN 3m_user 3u ON 3u.id = 3sm.student_id + LEFT JOIN 3m_meeting 3meet ON 3meet.id = 3sm.meeting_id + WHERE + 3meet.create_user = '` +teacherName+"'";; + querySql += ' ORDER BY 3sm.create_time DESC LIMIT '+(page-1)*pageno+' , ' +pageno + let sm = await sequelize.query(querySql); + return sm[0]; + } catch (error) { + console.log(error) + throw error; + } +} + module.exports = new sutudentMeetingService(); \ No newline at end of file