MySQL 확인 -> book_mst
book_name(중복확인)
SELECT
book_name,
count(*) as book_cnt
FROM
book_mst
group by
book_name
having
book_cnt > 1
author_tb
book_img_tb
book_list_tb
book_tb
category_tb
publisher_tb
전체 테이블
author_tb
insert into author_tb
SELECT
0,
author_name
FROM
book_list_tb
group by
author_name;
publisher_tb
insert into publisher_tb
select
0,
publisher_name
from
book_list_tb
group by
publisher_name;
category_tb
insert into category_tb
select
0,
category_name
from
book_list_tb
group by
category_name;
모든 ID값 JOIN
select
*
from
book_list_tb bl
left outer join author_tb a on(a.author_name = bl.author_name)
left outer join publisher_tb ps on(ps.publisher_name = bl.publisher_name)
left outer join category_tb cg on(cg.category_name = bl.category_name)
order by
book_list_id
book_tb
insert into book_tb
select
0 as book_id,
book_name,
author_id,
publisher_id,
category_id
from
book_list_tb bl
left outer join author_tb a on(a.author_name = bl.author_name)
left outer join publisher_tb ps on(ps.publisher_name = bl.publisher_name)
left outer join category_tb cg on(cg.category_name = bl.category_name)
group by
book_id,
book_name,
author_id,
publisher_id,
category_id
book_tb(수정)
insert into book_tb
select
0 as book_id,
book_name,
author_id,
publisher_id,
category_id,
cover_img_url
from
(select
row_number() over(partition by
book_name,
author_id,
publisher_id,
category_id order by book_name) as num,
book_name,
author_id,
publisher_id,
category_id,
cover_img_url
from
book_list_tb bl
left outer join author_tb a on(a.author_name = bl.author_name)
left outer join publisher_tb ps on(ps.publisher_name = bl.publisher_name)
left outer join category_tb cg on(cg.category_name = bl.category_name)
) book_list
where
num = 1
book_list_tb
edit > preferences > SQL Editor
update
book_list_tb bl
left outer join author_tb a on (a.author_name = bl.author_name)
left outer join publisher_tb ps on(ps.publisher_name = bl.publisher_name)
left outer join category_tb cg on(cg.category_name = bl.category_name)
left outer join book_tb b on (
b.book_name = bl.book_name
and b.author_id = a.author_id
and b.publisher_id = ps.publisher_id
and b.category_id = cg.category_id)
set
bl.book_id = b.book_id
book_list_tb (수정) 및 registe_date 랜덤 날짜 넣기
update book_list_tb
set registe_date = DATE_ADD(
DATE_ADD(
DATE_ADD(
CURDATE(),
INTERVAL - cast(RAND()*(4-1)+1 as unsigned)
DAY),
INTERVAL - cast(RAND()*(4-1)+1 as unsigned)
MONTH),
INTERVAL - cast(RAND()*(4-1)+1 as unsigned)
YEAR)
user_tb 생성
role_tb 생성
authority_tb
Ctrl + Shift + ` -> 터미널 오픈
node -v
npx create-react-app book_management
cd book_management
npm start
npm i @emotion/react
npm i react-router-dom
npm i axios
src > styles > Global > reset.js
import { css } from '@emotion/react';
export const Reset = css`
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
* {
box-sizing: border-box;
}
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
margin: 0px auto;
width: 768px;
height: 1024px;
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
`;
public > index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Book Management</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
src > components > UI > atoms > Input
/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react'
import React from 'react';
const InputBox = css`
border-bottom: 1px solid #dbdbdb;
padding: 5px 10px 5px 50px ;
width: 100%;
height: 40px;
`;
const Input = ( type ) => {
return (
<div CSS={InputBox}>
<input type="{type}"/>
</div>
);
};
export default Input;
pages > Login >Login.js
import React from 'react';
import Input from '../../components/UI/atoms/Input/Input';
const Login = () => {
return (
<div>
<header>
<h1>Login</h1>
</header>
<main>
<div>
<Input type="text"/>
</div>
<div></div>
<div></div>
<div></div>
</main>
<footer>
<div></div>
</footer>
</div>
);
};
export default Login;