Showing
5 changed files
with
37 additions
and
5 deletions
1 | -[{"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\index.js":"1","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\App.js":"2","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\reportWebVitals.js":"3","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\Student.js":"4","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\StudentAdd.js":"5"},{"size":500,"mtime":499162500000,"results":"6","hashOfConfig":"7"},{"size":3848,"mtime":1607448454756,"results":"8","hashOfConfig":"7"},{"size":362,"mtime":499162500000,"results":"9","hashOfConfig":"7"},{"size":2433,"mtime":1607363898200,"results":"10","hashOfConfig":"7"},{"size":3467,"mtime":1607448276867,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"14"},"15hdric",{"filePath":"15","messages":"16","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"14"},{"filePath":"19","messages":"20","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"21","usedDeprecatedRules":"14"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\index.js",[],["24","25"],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\App.js",["26","27","28"],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\reportWebVitals.js",[],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\Student.js",["29","30","31"],"import React from 'react';\r\nimport TableRow from '@material-ui/core/TableRow';\r\nimport TableCell from '@material-ui/core/TableCell';\r\n\r\nclass Student extends React.Component{\r\n render(){\r\n return(\r\n <TableRow>\r\n <TableCell> {this.props.st_Code} </TableCell>\r\n <TableCell> {this.props.st_Name} </TableCell>\r\n <TableCell> {this.props.st_Id} </TableCell>\r\n <TableCell> {this.props.st_Major} </TableCell>\r\n <TableCell> {this.props.st_Midscore} </TableCell>\r\n <TableCell> {this.props.st_Finalscore} </TableCell>\r\n <TableCell> {this.props.st_Assignscore} </TableCell>\r\n <TableCell> {this.props.st_Attendscore} </TableCell>\r\n <TableCell> {this.props.st_Score} </TableCell>\r\n\r\n </TableRow>\r\n \r\n /*<div>\r\n \r\n <Searchscores st_Midscore={this.props.st_Midscore} \r\n st_Finalscore = {this.props.st_Finalscore}\r\n st_Assignscore = {this.props.st_Assignscore}\r\n st_Attendscore = {this.props.st_Attendscore}/>\r\n\r\n <Searchscore st_Score={this.props.st_Score}/>\r\n\r\n <Searchothers st_Midscore={this.props.st_Midscore} \r\n st_Finalscore = {this.props.st_Finalscore}\r\n st_Assignscore = {this.props.st_Assignscore}\r\n st_Attendscore = {this.props.st_Attendscore}\r\n st_Score = {this.props.st_Score}/>\r\n\r\n </div>*/\r\n\r\n )\r\n }\r\n}\r\n\r\nclass Searchscores extends React.Component{\r\n render(){\r\n return(\r\n <div>\r\n\r\n <p>{this.props.st_Midscore}</p>\r\n <p>{this.props.st_Finalscore}</p>\r\n <p>{this.props.st_Assignscore}</p>\r\n <p>{this.props.st_Attendscore}</p>\r\n\r\n </div> \r\n )\r\n }\r\n}\r\n\r\n\r\nclass Searchscore extends React.Component{\r\n render(){\r\n return(\r\n <div>\r\n <p>{this.props.st_Score}</p>\r\n </div> \r\n )\r\n }\r\n}\r\n\r\nclass Searchothers extends React.Component{\r\n render(){\r\n return(\r\n <div>\r\n <p>{this.props.st_Midscore}</p>\r\n <p>{this.props.st_Finalscore}</p>\r\n <p>{this.props.st_Assignscore}</p>\r\n <p>{this.props.st_Attendscore}</p>\r\n <p>{this.props.st_Score}</p>\r\n </div> \r\n )\r\n }\r\n}\r\n\r\nexport default Student;","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\StudentAdd.js",[],{"ruleId":"32","replacedBy":"33"},{"ruleId":"34","replacedBy":"35"},{"ruleId":"36","severity":1,"message":"37","line":1,"column":27,"nodeType":"38","messageId":"39","endLine":1,"endColumn":37},{"ruleId":"36","severity":1,"message":"40","line":12,"column":8,"nodeType":"38","messageId":"39","endLine":12,"endColumn":24},{"ruleId":"36","severity":1,"message":"41","line":29,"column":7,"nodeType":"38","messageId":"39","endLine":29,"endColumn":15},{"ruleId":"36","severity":1,"message":"42","line":42,"column":7,"nodeType":"38","messageId":"39","endLine":42,"endColumn":19},{"ruleId":"36","severity":1,"message":"43","line":58,"column":7,"nodeType":"38","messageId":"39","endLine":58,"endColumn":18},{"ruleId":"36","severity":1,"message":"44","line":68,"column":7,"nodeType":"38","messageId":"39","endLine":68,"endColumn":19},"no-native-reassign",["45"],"no-negated-in-lhs",["46"],"no-unused-vars","'components' is defined but never used.","Identifier","unusedVar","'curcularProgress' is defined but never used.","'students' is assigned a value but never used.","'Searchscores' is defined but never used.","'Searchscore' is defined but never used.","'Searchothers' is defined but never used.","no-global-assign","no-unsafe-negation"] | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +[{"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\index.js":"1","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\App.js":"2","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\reportWebVitals.js":"3","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\Student.js":"4","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\StudentAdd.js":"5","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\StudentDelete.js":"6"},{"size":500,"mtime":499162500000,"results":"7","hashOfConfig":"8"},{"size":3923,"mtime":1607450260952,"results":"9","hashOfConfig":"8"},{"size":362,"mtime":499162500000,"results":"10","hashOfConfig":"8"},{"size":2602,"mtime":1607450773121,"results":"11","hashOfConfig":"8"},{"size":3467,"mtime":1607448276867,"results":"12","hashOfConfig":"8"},{"size":439,"mtime":1607450769585,"results":"13","hashOfConfig":"8"},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},"15hdric",{"filePath":"17","messages":"18","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"19","messages":"20","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"21","messages":"22","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\index.js",[],["27","28"],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\App.js",["29","30","31"],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\reportWebVitals.js",[],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\Student.js",["32","33","34"],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\StudentAdd.js",[],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\StudentDelete.js",[],{"ruleId":"35","replacedBy":"36"},{"ruleId":"37","replacedBy":"38"},{"ruleId":"39","severity":1,"message":"40","line":1,"column":27,"nodeType":"41","messageId":"42","endLine":1,"endColumn":37},{"ruleId":"39","severity":1,"message":"43","line":12,"column":8,"nodeType":"41","messageId":"42","endLine":12,"endColumn":24},{"ruleId":"39","severity":1,"message":"44","line":29,"column":7,"nodeType":"41","messageId":"42","endLine":29,"endColumn":15},{"ruleId":"39","severity":1,"message":"45","line":43,"column":7,"nodeType":"41","messageId":"42","endLine":43,"endColumn":19},{"ruleId":"39","severity":1,"message":"46","line":59,"column":7,"nodeType":"41","messageId":"42","endLine":59,"endColumn":18},{"ruleId":"39","severity":1,"message":"47","line":69,"column":7,"nodeType":"41","messageId":"42","endLine":69,"endColumn":19},"no-native-reassign",["48"],"no-negated-in-lhs",["49"],"no-unused-vars","'components' is defined but never used.","Identifier","unusedVar","'curcularProgress' is defined but never used.","'students' is assigned a value but never used.","'Searchscores' is defined but never used.","'Searchscore' is defined but never used.","'Searchothers' is defined but never used.","no-global-assign","no-unsafe-negation"] | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -109,6 +109,7 @@ class App extends Component{ | ... | @@ -109,6 +109,7 @@ class App extends Component{ |
109 | <TableCell>과제</TableCell> | 109 | <TableCell>과제</TableCell> |
110 | <TableCell>출석</TableCell> | 110 | <TableCell>출석</TableCell> |
111 | <TableCell>학점</TableCell> | 111 | <TableCell>학점</TableCell> |
112 | + <TableCell>설정</TableCell> | ||
112 | </TableRow> | 113 | </TableRow> |
113 | </TableHead> | 114 | </TableHead> |
114 | 115 | ||
... | @@ -117,7 +118,7 @@ class App extends Component{ | ... | @@ -117,7 +118,7 @@ class App extends Component{ |
117 | this.state.students ? | 118 | this.state.students ? |
118 | this.state.students.map(c=>{ | 119 | this.state.students.map(c=>{ |
119 | return ( | 120 | return ( |
120 | - <Student | 121 | + <Student stateRefresh={this.stateRefresh} |
121 | key={c.st_Code} | 122 | key={c.st_Code} |
122 | st_Code={c.st_Code} | 123 | st_Code={c.st_Code} |
123 | st_Name={c.st_Name} | 124 | st_Name={c.st_Name} | ... | ... |
1 | import React from 'react'; | 1 | import React from 'react'; |
2 | import TableRow from '@material-ui/core/TableRow'; | 2 | import TableRow from '@material-ui/core/TableRow'; |
3 | import TableCell from '@material-ui/core/TableCell'; | 3 | import TableCell from '@material-ui/core/TableCell'; |
4 | +import StudentDelete from './StudentDelete'; | ||
4 | 5 | ||
5 | class Student extends React.Component{ | 6 | class Student extends React.Component{ |
6 | render(){ | 7 | render(){ |
... | @@ -15,7 +16,7 @@ class Student extends React.Component{ | ... | @@ -15,7 +16,7 @@ class Student extends React.Component{ |
15 | <TableCell> {this.props.st_Assignscore} </TableCell> | 16 | <TableCell> {this.props.st_Assignscore} </TableCell> |
16 | <TableCell> {this.props.st_Attendscore} </TableCell> | 17 | <TableCell> {this.props.st_Attendscore} </TableCell> |
17 | <TableCell> {this.props.st_Score} </TableCell> | 18 | <TableCell> {this.props.st_Score} </TableCell> |
18 | - | 19 | + <TableCell><StudentDelete stateRefresh={this.props.stateRefresh} st_Code={this.props.st_Code}/></TableCell> |
19 | </TableRow> | 20 | </TableRow> |
20 | 21 | ||
21 | /*<div> | 22 | /*<div> | ... | ... |
client/src/components/StudentDelete.js
0 → 100644
1 | +import React from 'react'; | ||
2 | +class StudentDelete extends React.Component{ | ||
3 | + | ||
4 | + deleteStudent(st_Code){ | ||
5 | + const url='/api/students/'+st_Code; | ||
6 | + fetch(url,{ | ||
7 | + method:'DELETE' | ||
8 | + }); | ||
9 | + this.props.stateRefresh(); | ||
10 | + } | ||
11 | + | ||
12 | + render(){ | ||
13 | + return( | ||
14 | + <button onClick={(e)=>{this.deleteStudent(this.props.st_Code)}}>삭제</button> | ||
15 | + ) | ||
16 | + } | ||
17 | +} | ||
18 | + | ||
19 | +export default StudentDelete; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -26,7 +26,7 @@ const upload = multer({dest:'./upload'}) | ... | @@ -26,7 +26,7 @@ const upload = multer({dest:'./upload'}) |
26 | 26 | ||
27 | app.get('/api/students', (req, res)=>{ | 27 | app.get('/api/students', (req, res)=>{ |
28 | connection.query( | 28 | connection.query( |
29 | - "SELECT * FROM dbproject.Students", | 29 | + "SELECT * FROM dbproject.Students WHERE isDeleted=0", |
30 | (err,rows,fields)=>{ | 30 | (err,rows,fields)=>{ |
31 | res.send(rows); | 31 | res.send(rows); |
32 | } | 32 | } |
... | @@ -36,7 +36,7 @@ app.get('/api/students', (req, res)=>{ | ... | @@ -36,7 +36,7 @@ app.get('/api/students', (req, res)=>{ |
36 | app.use('/image', express.static('./upload')); | 36 | app.use('/image', express.static('./upload')); |
37 | 37 | ||
38 | app.post('/api/students',upload.single('image'), (req, res) =>{ | 38 | app.post('/api/students',upload.single('image'), (req, res) =>{ |
39 | - let sql = 'INSERT INTO dbproject.Students VALUES (?,?,?,?,?,?,?,?,?)'; | 39 | + let sql = 'INSERT INTO dbproject.Students VALUES (?,?,?,?,?,?,?,?,?,now(),0)'; |
40 | let st_Code= req.body.st_Code; | 40 | let st_Code= req.body.st_Code; |
41 | let st_Name = req.body.st_Name; | 41 | let st_Name = req.body.st_Name; |
42 | let st_Id = req.body.st_Id; | 42 | let st_Id = req.body.st_Id; |
... | @@ -72,4 +72,15 @@ app.post('/api/students',upload.single('image'), (req, res) =>{ | ... | @@ -72,4 +72,15 @@ app.post('/api/students',upload.single('image'), (req, res) =>{ |
72 | ); | 72 | ); |
73 | }); | 73 | }); |
74 | 74 | ||
75 | +app.delete('/api/students/:st_Code',(req,res)=>{ | ||
76 | + let sql='UPDATE dbproject.Students SET isDeleted =1 WHERE st_Code = ?'; | ||
77 | + let params =[req.params.st_Code]; | ||
78 | + connection.query(sql, params, | ||
79 | + (err,rows,fields)=>{ | ||
80 | + res.send(rows); | ||
81 | + console.log(err); | ||
82 | + } | ||
83 | + ); | ||
84 | +}); | ||
85 | + | ||
75 | app.listen(port, () => console.log(`Listening on port ${port}`)); | 86 | app.listen(port, () => console.log(`Listening on port ${port}`)); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment