728x90
๋ฐ˜์‘ํ˜•

2024/09 30

[jQuery][Datatables] datatables ์˜ ๋ชจ๋“  ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ

$(document).ready(function() { var table = $('#example').DataTable(); // ํ…Œ์ด๋ธ”์˜ ๋ชจ๋“  ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๊ธฐ var data = table.rows().data(); // ๋ฐ์ดํ„ฐ๋ฅผ ์ถœ๋ ฅํ•˜๊ฑฐ๋‚˜ ์กฐ์ž‘ํ•  ์ˆ˜ ์žˆ์Œ data.each(function(value, index) { console.log('Row ' + index + ' data: ', value); });}); ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์„๋•Œ๋Š”, ๋ฐ์ดํ„ฐ๋กœ๋“œ ํ›„์— ํ˜ธ์ถœ๋˜๋„๋ก ์ˆ˜์ •ํ•˜๊ธฐ

Front/JS & jQuery 2024.09.10

[JAVA] stream anyMatch ์‚ฌ์šฉ

List resList = getList(listParam); // ์ฒ˜๋ฆฌ๊ฒฐ๊ณผ ๋“ฑ๋ก ์—ฌ๋ถ€๊ฐ€ ์ „์ฒด TRUE์ธ์ง€ ํ™•์ธ for( ResListDTO res : resList ) { rsltYn = res.getRsltYn(); if(!rsltYn) { break; } } // ์ฒ˜๋ฆฌ๊ฒฐ๊ณผ๊ฐ€ ์ „์ฒด TRUE์ด๋ฉด, ์ฒ˜๋ฆฌ๋กœ์ง if(rsltYn) { }boolean hasFalse = resVocList.stream() .anyMatch(dto -> !dto.getRsltYn());if (hasFalse) { // RsltYn์ด false์ธ ๊ฐ์ฒด๊ฐ€ ํ•˜๋‚˜๋ผ๋„ ์žˆ๋Š” ๊ฒฝ์šฐ ์ฒ˜๋ฆฌํ•  ๋กœ..

JAVA 2024.09.09

[CSS] ์ƒ์œ„์š”์†Œ ๋„ˆ๋น„ ์ด์ƒ์ด๋ฉด ์Šคํฌ๋กค ์ƒ์„ฑ

table์ด ์ƒ์œ„ ์š”์†Œ์˜ ๋„ˆ๋น„๋ฅผ ๋„˜์–ด๊ฐˆ ๋•Œ ์Šคํฌ๋กค์ด ์ƒ๊ธฐ๋„๋ก ํ•˜๋ ค๋ฉด,table์„ ๊ฐ์‹ธ๋Š” ์ปจํ…Œ์ด๋„ˆ์— CSS ์†์„ฑ์„ ์ถ”๊ฐ€ํ•˜์—ฌ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.  html ์ฝ”๋“œ  css ์ฝ”๋“œ.table-container { width: 100%; /* ์›ํ•˜๋Š” ๋„ˆ๋น„๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Œ */ overflow-x: auto; /* ๊ฐ€๋กœ ์Šคํฌ๋กค์ด ํ•„์š”ํ•  ๋•Œ๋งŒ ์ƒ์„ฑ */}table { width: 100%; /* ํ…Œ์ด๋ธ” ํฌ๊ธฐ ์กฐ์ ˆ์„ ์œ„ํ•ด width ์‚ฌ์šฉ */ min-width: 600px; /* ํ…Œ์ด๋ธ”์˜ ์ตœ์†Œ ๋„ˆ๋น„๋ฅผ ์„ค์ • (์˜ต์…˜) */ border-collapse: collapse;} overflow-x: auto ์†์„ฑ์€ ํ…Œ์ด๋ธ”์ด ์ปจํ…Œ์ด๋„ˆ ๋„ˆ๋น„๋ฅผ ๋„˜์–ด๊ฐˆ ๊ฒฝ์šฐ ๊ฐ€๋กœ ์Šคํฌ๋กค์„ ์ƒ์„ฑํ•ด ์ค๋‹ˆ๋‹ค.min-width..

Front/JS & jQuery 2024.09.08

[js] Promise ๊ฐ์ฒด ์ฒ˜๋ฆฌ

Promise ๊ฐ์ฒด๋ฅผ ์ฒ˜๋ฆฌํ•˜๋ ค๋ฉด then() ๋˜๋Š” async/await ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•˜์—ฌ Promise์˜ ๊ฒฐ๊ณผ๋ฅผ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.  1. then()์„ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•: this.rsltData .then(response => { // Promise๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ์ดํ–‰๋œ ๊ฒฝ์šฐ if (response.status === '000') { console.log({ status: response.status, msg: response.msg, result: response.result.data // data ๋ฐฐ์—ด๋งŒ ์ถœ๋ ฅ }); } else { console.log('์˜ค๋ฅ˜ ๋ฐœ์ƒ:', response.msg); } }) .catc..

Front/JS & jQuery 2024.09.07

[DB][Oracle] ๋‚ ์งœํ˜•์‹์œผ๋กœ TIMESTAMP ๋น„๊ตํ•˜๋Š” ๋ฐฉ๋ฒ•

ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ YYYY.MM.DD ํ˜•์‹์œผ๋กœ ์ „๋‹ฌ๋  ๋•Œ,์ด๋ฅผ TO_TIMESTAMP๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ๋‚ ์งœ์™€ ์‹œ๊ฐ„ ๋น„๊ต๋ฅผ ์ •ํ™•ํ•˜๊ฒŒ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. AND ( INS_DT >= TO_TIMESTAMP(#{searchSdate} || ' 00:00:00', 'YYYY.MM.DD HH24:MI:SS') AND INS_DT )

DB 2024.09.06

[DB][Oracle] ์ปฌ๋Ÿผ์ถ”๊ฐ€, ์›ํ•˜๋Š” ์œ„์น˜์— ์ปฌ๋Ÿผ์ถ”๊ฐ€ํ•˜๊ธฐ

์˜ค๋ผํด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ์ปฌ๋Ÿผ์„ ์ถ”๊ฐ€ํ•  ๋•Œ, ์ปฌ๋Ÿผ์ด ์›ํ•˜๋Š” ์ˆœ์„œ๋กœ ๋ฐฐ์น˜๋˜๋„๋ก ํ•˜๋Š” ๊ฒƒ์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ง€์›๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์˜ค๋ผํด์€ ์ปฌ๋Ÿผ์„ ์ถ”๊ฐ€ํ•  ๋•Œ, ๊ธฐ๋ณธ์ ์œผ๋กœ ํ…Œ์ด๋ธ”์˜ ๋งˆ์ง€๋ง‰์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์›ํ•˜๋Š” ์ˆœ์„œ๋กœ ์ปฌ๋Ÿผ์„ ๋ฐฐ์น˜ํ•˜๊ณ ์ž ํ•  ๊ฒฝ์šฐ, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:1. ํ…Œ์ด๋ธ” ์žฌ์ƒ์„ฑ (Recreate the Table): ๊ฐ€์žฅ ํ™•์‹คํ•œ ๋ฐฉ๋ฒ•์€ ์ƒˆ๋กœ์šด ํ…Œ์ด๋ธ”์„ ๋งŒ๋“ค๊ณ  ๋ฐ์ดํ„ฐ๋ฅผ ์ด์ „ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ด ๋ฐฉ๋ฒ•์€ ๊ฐ€์žฅ ๋งŽ์€ ์ž‘์—…์ด ํ•„์š”ํ•˜์ง€๋งŒ, ์›ํ•˜๋Š” ์ˆœ์„œ๋กœ ์ปฌ๋Ÿผ์„ ๋ฐฐ์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.-- ํ˜„์žฌ ํ…Œ์ด๋ธ”์˜ ์Šคํ‚ค๋งˆ์™€ ๋ฐ์ดํ„ฐ ๋ฐฑ์—…CREATE TABLE new_table AS SELECT * FROM old_table WHERE 1=2;-- ์ƒˆ ํ…Œ์ด๋ธ”์— ์›ํ•˜๋Š” ์ปฌ๋Ÿผ ์ˆœ์„œ๋กœ ์ถ”๊ฐ€ALTER TABLE new_tabl..

DB 2024.09.05

[Error] java.util.LinkedHashMap cannot be cast to class

Service Error: ์„œ๋น„์ŠคํŒŒ์ผ๋ช…, ํ•จ์ˆ˜๋ช…,Unrecognized field "ํ•„๋“œ๋ช…" (DTOํŒŒ์ผ๋ช…), not marked as ignorable (7 known properties: ....) ์ด ์˜ค๋ฅ˜๋Š” Unrecognized field "createdAt"JSON ์‘๋‹ต์—  ํ•ด๋‹น ์†์„ฑ์ด ์—†๋Š” ์ด๋ฆ„์ด ์ง€์ •๋œ ํ•„๋“œ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์Œ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. ํ•ด๊ฒฐ์ฑ…JSON ์‘๋‹ต ํ•„๋“œ์™€ DTO ํด๋ž˜์Šค์˜ ํ•„๋“œ ๊ฐ„์˜ ๋ถˆ์ผ์น˜๋ฅผ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. 1. DTO์— ๋ˆ„๋ฝ๋œ ํ•„๋“œ ์ถ”๊ฐ€createdAtํด๋ž˜์Šค ์— ํ•„๋“œ๊ฐ€ ์žˆ์–ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ ResYhIftkUserApiListDTO๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. 2. ์ธ์‹๋˜์ง€ ์•Š๋Š” ํ•„๋“œ ๋ฌด์‹œDTO ํด๋ž˜์Šค์— ์ •์˜๋˜์ง€ ์•Š์€ ํ•„๋“œ๋ฅผ ๋ฌด์‹œํ•˜๋ ค๋ฉด Jackson์„ ๊ตฌ์„ฑํ•˜์—ฌ ์•Œ ์ˆ˜ ์—†๋Š” ์†์„ฑ์„ ๋ฌด์‹œ..

Error 2024.09.04

[Spring] Stringtils equals/ equalsAny/ equalsIgnoreCase/ equalsAnyIgnoreCase

1.equals์„ค๋ช…: ๋‘ ๋ฌธ์ž์—ด์ด ๋™์ผํ•œ์ง€ ๋น„๊ตํ•ฉ๋‹ˆ๋‹ค.๊ตฌํ˜„: null ์ฒ˜๋ฆฌ๋ฅผ ํฌํ•จํ•˜๋ฉฐ, ๋‘ ๋ฌธ์ž์—ด์ด ๋ชจ๋‘ null์ด๋ฉด true๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ํ•˜๋‚˜๋งŒ null์ด๋ฉด false๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„: ๊ตฌ๋ถ„ํ•จ.StringUtils.equals("abc", "abc"); // trueStringUtils.equals("abc", "ABC"); // falseStringUtils.equals(null, "abc"); // falseStringUtils.equals(null, null); // true 2.equalsAny์„ค๋ช…: ์ฒซ ๋ฒˆ์งธ ๋ฌธ์ž์—ด์ด ๋‚˜๋จธ์ง€ ์ธ์ˆ˜ ๋ฌธ์ž์—ด ์ค‘ ํ•˜๋‚˜์™€ ๋™์ผํ•œ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.๊ตฌํ˜„: ์ฒซ ๋ฒˆ์งธ ๋ฌธ์ž์—ด์ด null์ผ ๊ฒฝ์šฐ, ๋‚˜๋จธ์ง€ ๋ฌธ์ž์—ด๋“ค ์ค‘ ํ•˜๋‚˜๋ผ๋„ null์ด๋ฉด true๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.๋Œ€์†Œ๋ฌธ..

JAVA/SPRING 2024.09.03

[JAVA] String ๋ฐฐ์—ด์—์„œ null๊ฐ’์„ ์ œ์™ธํ•˜๊ณ  ๋ฐ˜ํ™˜ํ•˜๊ธฐ

import java.util.Arrays;import java.util.stream.Collectors;public class Main { public static void main(String[] args) { String[] managers = {"Alice", null, "Bob", null, "Charlie"}; // ํ•„ํ„ฐ๋งํ•˜์—ฌ null ๊ฐ’์„ ์ œ์™ธํ•œ ๋ฐฐ์—ด ์ƒ์„ฑ String[] filteredManagers = Arrays.stream(managers) .filter(manager -> manager != null) ..

JAVA 2024.09.02

[JAVA] LocalDate minusDays

ํ•˜๋ฃจ ์ „ ๋‚ ์งœ๋ฅผ ๊ตฌํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” LocalDate ํด๋ž˜์Šค๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.LocalDate์—์„œ minusDays(1) ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด ํ•˜๋ฃจ ์ „์˜ ๋‚ ์งœ๋ฅผ ๊ตฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.import java.time.LocalDate;import java.time.format.DateTimeFormatter;public class DateExample { public static void main(String[] args) { // ์˜ค๋Š˜ ๋‚ ์งœ ๊ตฌํ•˜๊ธฐ LocalDate today = LocalDate.now(); // ํ•˜๋ฃจ ์ „ ๋‚ ์งœ ๊ตฌํ•˜๊ธฐ LocalDate yesterday = today.minusDays(1); // ๋‚ ์งœ๋ฅผ "yyyyMMdd" ํ˜•..

JAVA 2024.09.01
728x90
๋ฐ˜์‘ํ˜•