Toggle navigation
Toggle navigation
This project
Loading...
Sign in
육현진
/
DBproject
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
육현진
2020-12-10 00:31:00 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
16ca96e36bbe2dd1f43e096c0e27224443a723f2
16ca96e3
1 parent
fddfb89f
add usermode page
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
45 deletions
client/.eslintcache
client/src/App.js
client/src/components/StudentAdd.js
client/src/components/StudentDelete.js
server.js
코드.txt
client/.eslintcache
View file @
16ca96e
This diff is collapsed. Click to expand it.
client/src/App.js
View file @
16ca96e
...
...
@@ -16,17 +16,16 @@ import Toolbar from '@material-ui/core/Toolbar';
import
IconButton
from
'@material-ui/core/IconButton'
;
import
Typography
from
'@material-ui/core/Typography'
;
import
InputBase
from
'@material-ui/core/InputBase'
;
import
{
fade
}
from
'@material-ui/core/styles/colorManipulator
'
;
import
{
fade
,
makeStyles
}
from
'@material-ui/core/styles
'
;
import
MenuIcon
from
'@material-ui/icons/Menu'
;
import
SearchIcon
from
'@material-ui/icons/Search'
;
const
styles
=
theme
=>
({
root
:
{
width
:
'100%'
,
minWidth
:
1080
},
table
:
{
paper
:
{
marginLeft
:
18
,
marginRight
:
18
},
...
...
@@ -96,8 +95,8 @@ const styles = theme => ({
const
students
=
[
{
'st_Code'
:
6666
,
'st_Name'
:
'육현진'
,
'st_Id'
:
2018102210
,
//
'st_Name': '육현진',
//
'st_Id': 2018102210,
'st_Major'
:
'컴퓨터공학과'
,
'st_Midscore'
:
100
,
'st_Finalscore'
:
100
,
...
...
@@ -107,8 +106,8 @@ const students = [
},
{
'st_Code'
:
1111
,
'st_Name'
:
'김창동'
,
'st_Id'
:
2020021120
,
//
'st_Name': '김창동',
//
'st_Id': 2020021120,
'st_Major'
:
'컴퓨터공학과'
,
'st_Midscore'
:
79
,
'st_Finalscore'
:
85
,
...
...
@@ -174,8 +173,8 @@ class App extends Component{
return
<
Student
stateRefresh
=
{
this
.
stateRefresh
}
key
=
{
c
.
st_Code
}
st_Code
=
{
c
.
st_Code
}
st_Name
=
{
c
.
st_Name
}
st_Id
=
{
c
.
st_Id
}
//
st_Name={c.st_Name}
//
st_Id={c.st_Id}
st_Major
=
{
c
.
st_Major
}
st_Midscore
=
{
c
.
st_Midscore
}
st_Finalscore
=
{
c
.
st_Finalscore
}
...
...
@@ -186,7 +185,7 @@ class App extends Component{
}
const
{
classes
}
=
this
.
props
;
const
cellList
=
[
"코드번호"
,
"이름"
,
"학번"
,
"전공"
,
"중간"
,
"기말"
,
"과제"
,
"출석"
,
"설정"
];
const
cellList
=
[
"코드번호"
,
"이름"
,
"학번"
,
"전공"
,
"중간"
,
"기말"
,
"과제"
,
"출석"
,
"
성적"
,
"
설정"
];
return
(
<
div
className
=
{
classes
.
root
}
>
<
AppBar
position
=
"static"
>
...
...
@@ -200,8 +199,9 @@ class App extends Component{
<
MenuIcon
/>
<
/IconButton
>
<
Typography
className
=
{
classes
.
title
}
variant
=
"h6"
noWrap
>
학생
성적
관리
프로그램
성적
조회
프로그램
<
/Typography
>
<
div
className
=
{
classes
.
search
}
>
<
div
className
=
{
classes
.
searchIcon
}
>
<
SearchIcon
/>
...
...
@@ -212,14 +212,15 @@ class App extends Component{
root
:
classes
.
inputRoot
,
input
:
classes
.
inputInput
,
}}
n
ame
=
"searchKeyword"
st_N
ame
=
"searchKeyword"
value
=
{
this
.
state
.
searchKeyword
}
onChange
=
{
this
.
handleValueChange
}
//
inputProps={{ 'aria-label': 'search' }}
inputProps
=
{{
'aria-label'
:
'search'
}}
/
>
<
/div
>
<
/Toolbar
>
<
/AppBar
>
<
div
className
=
{
classes
.
menu
}
>
<
StudentAdd
stateRefresh
=
{
this
.
stateRefresh
}
/
>
<
/div
>
...
...
client/src/components/StudentAdd.js
View file @
16ca96e
...
...
@@ -36,8 +36,8 @@ class StudentAdd extends React.Component{
super
(
props
);
this
.
state
=
{
st_Code
:
''
,
st_Name
:
''
,
st_Id
:
''
,
//
st_Name:'',
//
st_Id:'',
st_Major
:
''
,
st_Midscore
:
''
,
st_Finalscore
:
''
,
...
...
@@ -57,8 +57,8 @@ class StudentAdd extends React.Component{
})
this
.
setState
({
st_Code
:
''
,
st_Name
:
''
,
st_Id
:
''
,
//
st_Name:'',
//
st_Id:'',
st_Major
:
''
,
st_Midscore
:
''
,
st_Finalscore
:
''
,
...
...
@@ -80,8 +80,8 @@ class StudentAdd extends React.Component{
const
url
=
'/api/students'
;
const
formData
=
new
FormData
();
formData
.
append
(
'st_Code'
,
this
.
state
.
st_Code
);
formData
.
append
(
'st_Name'
,
this
.
state
.
st_Name
);
formData
.
append
(
'st_Id'
,
this
.
state
.
st_Id
);
//
formData.append('st_Name',this.state.st_Name);
//
formData.append('st_Id',this.state.st_Id);
formData
.
append
(
'st_Major'
,
this
.
state
.
st_Major
);
formData
.
append
(
'st_Midscore'
,
this
.
state
.
st_Midscore
);
formData
.
append
(
'st_Finalscore'
,
this
.
state
.
st_Finalscore
);
...
...
@@ -106,8 +106,8 @@ class StudentAdd extends React.Component{
handleClose
=
()
=>
{
this
.
setState
({
st_Code
:
''
,
st_Name
:
''
,
st_Id
:
''
,
//
st_Name:'',
//
st_Id:'',
st_Major
:
''
,
st_Midscore
:
''
,
st_Finalscore
:
''
,
...
...
@@ -123,20 +123,22 @@ class StudentAdd extends React.Component{
return
(
<
div
>
<
Button
variant
=
"contained"
color
=
"primary"
onClick
=
{
this
.
handleClickOpen
}
>
학생
추가하기
등수확인
<
/Button
>
<
Dialog
open
=
{
this
.
state
.
open
}
onClose
=
{
this
.
handleClose
}
>
<
DialogTitle
>
학생
추가
<
/DialogTitle
>
<
DialogTitle
>
학생
추가
<
/DialogTitle
>
<
DialogContent
>
<
Textfield
label
=
"코드 번호"
type
=
"text"
name
=
"st_Code"
value
=
{
this
.
state
.
st_Code
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"이름"
name
=
"st_Name"
value
=
{
this
.
state
.
st_Name
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"학번"
name
=
"st_Id"
value
=
{
this
.
state
.
st_Id
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"전공"
name
=
"st_Major"
value
=
{
this
.
state
.
st_Major
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"중간 점수"
name
=
"st_Midscore"
value
=
{
this
.
state
.
st_Midscore
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"기말 점수"
name
=
"st_Finalscore"
value
=
{
this
.
state
.
st_Finalscore
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"과제 점수"
name
=
"st_Assignscore"
value
=
{
this
.
state
.
st_Assignscore
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"출석 점수"
name
=
"st_Attendscore"
value
=
{
this
.
state
.
st_Attendscore
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"학점"
name
=
"st_Score"
value
=
{
this
.
state
.
st_Score
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"전공"
type
=
"text"
name
=
"st_Major"
value
=
{
this
.
state
.
st_Major
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"중간 점수"
type
=
"text"
name
=
"st_Midscore"
value
=
{
this
.
state
.
st_Midscore
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"기말 점수"
type
=
"text"
name
=
"st_Finalscore"
value
=
{
this
.
state
.
st_Finalscore
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"과제 점수"
type
=
"text"
name
=
"st_Assignscore"
value
=
{
this
.
state
.
st_Assignscore
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"출석 점수"
type
=
"text"
name
=
"st_Attendscore"
value
=
{
this
.
state
.
st_Attendscore
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
Textfield
label
=
"학점"
type
=
"text"
name
=
"st_Score"
value
=
{
this
.
state
.
st_Score
}
onChange
=
{
this
.
handleValueChange
}
/><br/
>
<
/DialogContent
>
<
DialogActions
>
<
Button
varient
=
"contained"
color
=
"primary"
onClick
=
{
this
.
handleFormSubmit
}
>
추가
<
/Button
>
...
...
@@ -144,6 +146,12 @@ class StudentAdd extends React.Component{
<
/DialogActions
>
<
/Dialog
>
<
/div
>
)
}
}
export
default
withStyles
(
styles
)(
StudentAdd
);
/*
<form onSubmit={this.handleFormSubmit}>
<h1>학생 추가</h1>
...
...
@@ -159,9 +167,4 @@ class StudentAdd extends React.Component{
<button type="submit">추가하기</button>
</form>
*/
)
}
}
export
default
withStyles
(
styles
)(
StudentAdd
);
\ No newline at end of file
*/
\ No newline at end of file
...
...
client/src/components/StudentDelete.js
View file @
16ca96e
...
...
@@ -52,7 +52,7 @@ class StudentDelete extends React.Component{
return
(
<
div
>
<
Button
variant
=
"contained"
color
=
"secondary"
onClick
=
{
this
.
handleClickOpen
}
>
삭제
<
/Button
>
<
Dialog
open
=
{
this
.
state
.
open
}
onClose
=
{
this
.
handleClose
}
>
<
DialogTitle
onClose
=
{
this
.
handleClose
}
>
삭제
경고
...
...
server.js
View file @
16ca96e
...
...
@@ -29,6 +29,7 @@ app.get('/api/students', (req, res)=>{
"SELECT * FROM dbproject.Students WHERE isDeleted=0"
,
(
err
,
rows
,
fields
)
=>
{
res
.
send
(
rows
);
console
.
log
(
err
);
}
);
});
...
...
@@ -36,10 +37,10 @@ app.get('/api/students', (req, res)=>{
app
.
use
(
'/image'
,
express
.
static
(
'./upload'
));
app
.
post
(
'/api/students'
,
upload
.
single
(
'image'
),
(
req
,
res
)
=>
{
let
sql
=
'INSERT INTO dbproject.Students VALUES (?,?,?,?,?,?,?,?,?,now
(),0
)'
;
let
sql
=
'INSERT INTO dbproject.Students VALUES (?,?,?,?,?,?,?,?,?,now)'
;
let
st_Code
=
req
.
body
.
st_Code
;
let
st_Name
=
req
.
body
.
st_Name
;
let
st_Id
=
req
.
body
.
st_Id
;
//
let st_Name = req.body.st_Name;
//
let st_Id = req.body.st_Id;
let
st_Major
=
req
.
body
.
st_Major
;
let
st_Midscore
=
req
.
body
.
st_Midscore
;
let
st_Finalscore
=
req
.
body
.
st_Finalscore
;
...
...
@@ -47,8 +48,8 @@ app.post('/api/students',upload.single('image'), (req, res) =>{
let
st_Attendscore
=
req
.
body
.
st_Attendscore
;
let
st_Score
=
req
.
body
.
st_Score
;
console
.
log
(
st_Code
);
console
.
log
(
st_Name
);
console
.
log
(
st_Id
);
//
console.log(st_Name);
//
console.log(st_Id);
console
.
log
(
st_Major
);
console
.
log
(
st_Midscore
);
console
.
log
(
st_Finalscore
);
...
...
@@ -56,8 +57,9 @@ app.post('/api/students',upload.single('image'), (req, res) =>{
console
.
log
(
st_Attendscore
);
console
.
log
(
st_Score
);
let
params
=
[
st_Code
,
st_Name
,
st_Id
,
let
params
=
[
st_Code
,
//st_Name,
//st_Id,
st_Major
,
st_Midscore
,
st_Finalscore
,
...
...
코드.txt
0 → 100644
View file @
16ca96e
st_Code:'',
st_Name
st_Id
st_Major
st_Midscore
st_Finalscore
st_Assignscore
st_Attendscore
st_Score
this.state.students.map(c=>{
return (
<Student stateRefresh={this.stateRefresh}
key={c.st_Code}
st_Code={c.st_Code}
st_Name={c.st_Name}
st_Id={c.st_Id}
st_Major={c.st_Major}
st_Midscore={c.st_Midscore}
st_Finalscore={c.st_Finalscore}
st_Assignscore={c.st_Assignscore}
st_Attendscore={c.st_Attendscore}
st_Score={c.st_Score}
/>
);
//<Button variant="contained" color = "secondary" onClick={this.handleClickOpen}>삭제</Button>
<Textfield label="이름" type="text" name="st_Name" value={this.state.st_Name} onChange={this.handleValueChange}/><br/>
<Textfield label="학번" type="text" name="st_Id" value={this.state.st_Id} onChange={this.handleValueChange}/><br/>
SELECT @RNUM := @RNUM + 1 AS ROWNUM, t.*
FROM
(
SELECT *
FROM dbproject.Students
ORDER BY st_Score
) t,
( SELECT @RNUM := 0 ) R
\ No newline at end of file
Please
register
or
login
to post a comment