728x90
๋ฐ˜์‘ํ˜•

2024/11 4

[JAVA] LocalDate ์ฐจ์ด ๊ตฌํ•˜๊ธฐ

LocalDate๋‘ ๊ฐ์ฒด ์‚ฌ์ด์˜ ์ •ํ™•ํ•œ ๋‚ ์งœ ์ฐจ์ด๋ฅผ ์–ป์œผ๋ ค๋ฉดChronoUnit.DAYS.between, import java.time.LocalDate;import java.time.format.DateTimeFormatter;import java.time.temporal.ChronoUnit;// ํ–‰์‚ฌ๊ธฐ๊ฐ„ ๊ณ„์‚ฐString usagSdt = crInfo.getUsagSdt();String usagEdt = crInfo.getUsagEdt();// ๋ฌธ์ž์—ด์„ LocalDate๋กœ ๋ณ€ํ™˜DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");LocalDate startDate = LocalDate.parse(usagSdt, formatter);L..

JAVA 2024.11.05

[JAVA] Period ๋กœ +1์ผ ๋”ํ•˜๊ธฐ

Period์—ฌ์ „ํžˆ ์ฐจ์ด๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ,Period'์˜ ๋ฐฉ๋ฒ•์€ ํ•ด๋‹น ์›” ๋‚ด์˜getDays() ์ผ์ˆ˜ ์ฐจ์ด๋งŒ ์ œ๊ณตํ•˜๋ฉฐ ,๋‚ ์งœ๊ฐ€ ์—ฌ๋Ÿฌ ๋‹ฌ ๋˜๋Š” ์—ฌ๋Ÿฌ ํ•ด์— ๊ฑธ์ณ ์žˆ๋Š” ๊ฒฝ์šฐ ์˜คํ•ด์˜ ์†Œ์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.๊ณ„์† ์‚ฌ์šฉํ•˜๋ ค๋ฉด  ์ผ์ˆ˜ ๊ธฐ์ค€์œผ๋กœ ์ „์ฒด ์ฐจ์ด๋ฅผ ๊ณ„์‚ฐํ•˜๊ณ  ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ชจ๋“  ๊ฒƒ์„ ์ผ์ˆ˜๋กœ ๋ณ€ํ™˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.// ํ–‰์‚ฌ๊ธฐ๊ฐ„ ๊ณ„์‚ฐString usagSdt = crInfo.getUsagSdt();String usagEdt = crInfo.getUsagEdt();// ๋ฌธ์ž์—ด์„ LocalDate๋กœ ๋ณ€ํ™˜DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");LocalDate startDate = LocalDate.parse(usagSdt, forma..

JAVA 2024.11.04

[Mybatis] ์ˆซ์ž ์ปฌ๋Ÿผ์ธ๋ฐ ๊ฐ’์ด 0์ผ๋•Œ ์ปฌ๋Ÿผ๊ฐ’ != null and ์ปฌ๋Ÿผ๊ฐ’ !='' ์„ ํ†ต๊ณผํ•˜์ง€ ๋ชปํ•ด์„œ ๊ฐ’์ด ์—†๋Š” ๊ฒƒ์œผ๋กœ ์ฒ˜๋ฆฌ๋ ๋•Œ

์„ ์‚ฌ์šฉํ•ด์„œ ์•ˆ์— ์ปฌ๋Ÿผ ๊ฐ’์ด ์ „๋ถ€  ์ฒ˜๋ฆฌํ•ด์„œ ๊ฐ’์ด null ์ด๋‚˜ ๋นˆ๋ฌธ์ž์—ด์ด ์•„๋‹ˆ๋ฉด update ํ•˜๋ ค๊ณ  ์ž‘์„ฑ์„ ํ•˜์˜€๋Š”๋ฐ,๊ฐ’์ด ์ „๋ถ€ 0 ์ด๋‹ˆ๊นŒ ์•„๋ฌด ๊ฐ’๋„ ์—†๋Š” ๊ฒƒ์œผ๋กœ ๋‚˜์™€์„œ update ๋ฌธ์— SET ์ด ๋น ์ง„ ๊ฒƒ์œผ๋กœ ๊ฐ„์ฃผ๋˜์–ด ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค.์–ด์ฐจํ”ผ null ์ด๋ฉด 0์œผ๋กœ ์ž…๋ ฅํ•œ๋‹ค๋Š”  COALESCE(TO_NUMBER(NULL),0) ์œผ๋กœ ์ž‘์„ฑํ•ด ๋‘ฌ์„œ if๋ฌธ์„ ๋‹ค ๋บ๋‹ค. MyBatis์—์„œ `` ๋ฌธ์—์„œ ๊ฐ’์„ ํ‰๊ฐ€ํ•  ๋•Œ `null`, `""` (๋นˆ ๋ฌธ์ž์—ด), ๋•Œ๋กœ๋Š” `0`๊ณผ ๊ฐ™์€ ํŠน์ • ๊ฐ’์ด "falsy"๋กœ ๋™์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฆ‰, ํŠนํžˆ ํ‘œํ˜„์‹์ด ๋ถ€์šธ ๊ฒ€์‚ฌ์™€ ์œ ์‚ฌํ•œ ๊ฒฝ์šฐ ์กฐ๊ฑด ๊ฒ€์‚ฌ๋ฅผ ํ†ต๊ณผํ•˜์ง€ ๋ชปํ•ฉ๋‹ˆ๋‹ค. ### MyBatis์—์„œ Falsy ๊ฐ’๊ณผ `0`์— ๋Œ€ํ•œ ์„ค๋ช… **JavaScript**์™€ ๊ฐ™์€ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์—์„œ `n..

DB 2024.11.03

dbeaver์—์„œ ๊ธ€๊ผด ํฌ๊ธฐ ์กฐ์ •ํ•˜๋Š” ๋‹จ์ถ•ํ‚ค

DBeaver์—์„œ ๊ธ€๊ผด ํฌ๊ธฐ๋ฅผ ์กฐ์ •ํ•˜๋Š” ๋‹จ์ถ•ํ‚ค๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:๊ธ€๊ผด ํฌ๊ธฐ ํ‚ค์šฐ๊ธฐ: Ctrl + + (์ˆซ์ž ํŒจ๋“œ์˜ + ํ‚ค)๊ธ€๊ผด ํฌ๊ธฐ ์ค„์ด๊ธฐ: Ctrl + - (์ˆซ์ž ํŒจ๋“œ์˜ - ํ‚ค)๊ธฐ๋ณธ ํฌ๊ธฐ๋กœ ์ดˆ๊ธฐํ™”: Ctrl + 0 (์ˆซ์ž ํŒจ๋“œ์˜ 0 ํ‚ค)์œ„ ๋‹จ์ถ•ํ‚ค๊ฐ€ ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ, ์•„๋ž˜์™€ ๊ฐ™์ด ์„ค์ •์„ ํ†ตํ•ด ๊ธ€๊ผด ํฌ๊ธฐ๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.DBeaver ์„ค์ •์œผ๋กœ ์ด๋™: Window > PreferencesEditors > Text Editors์—์„œ Font ์„น์…˜์„ ์ฐพ์€ ํ›„, ์›ํ•˜๋Š” ๊ธ€๊ผด ํฌ๊ธฐ๋ฅผ ์„ค์ •

IT์ง€์‹ 2024.11.02
728x90
๋ฐ˜์‘ํ˜•