fix(mybatis): quote camelCase SQL aliases — PG folds unquoted identifiers to lowercase

PostgreSQL lowercases unquoted aliases (AS userId -> userid), so every
Map-returning @Select lost its camelCase keys at runtime: secure login
always returned UNAUTHORIZED (passwordHash null), login-slide imageUrl/
sortOrder null, and the new aggregation APIs would have returned 0/null.
Quoted 191 aliases across 22 mappers (text blocks verbatim, string
literals escaped), matching the proven UserMapper.xml convention.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
zio 2026-07-12 04:06:56 +09:00
parent a657f9516a
commit 89bf2ce30d
22 changed files with 118 additions and 118 deletions

View File

@ -17,24 +17,24 @@ public interface AdminDashboardMapper {
@Select("""
SELECT
(SELECT count(*) FROM event
WHERE start_date <= CURRENT_DATE AND end_date >= CURRENT_DATE) AS ongoingEvents,
WHERE start_date <= CURRENT_DATE AND end_date >= CURRENT_DATE) AS "ongoingEvents",
(SELECT count(DISTINCT ha.hall_id) FROM hall_assignment ha JOIN event e ON e.id = ha.event_id
WHERE e.start_date <= CURRENT_DATE AND e.end_date >= CURRENT_DATE) AS hallsInUse,
(SELECT count(*) FROM app_user WHERE status = 'ACTIVE') AS activeUsers,
WHERE e.start_date <= CURRENT_DATE AND e.end_date >= CURRENT_DATE) AS "hallsInUse",
(SELECT count(*) FROM app_user WHERE status = 'ACTIVE') AS "activeUsers",
(SELECT count(*) FROM company) AS companies,
(SELECT count(*) FROM event
WHERE start_date > CURRENT_DATE) AS upcomingEvents
WHERE start_date > CURRENT_DATE) AS "upcomingEvents"
""")
Map<String, Object> findKpiCounts();
/** 진행 중(라이브) 행사 — 대표 홀·부스 수·홀 수용량. 최대 20건. */
@Select("""
SELECT e.id AS eventId,
SELECT e.id AS "eventId",
e.name,
COALESCE(h.label, '') AS hall,
e.status,
(SELECT count(*) FROM booth b JOIN layout l ON l.id = b.layout_id
WHERE l.event_id = e.id) AS boothCount,
WHERE l.event_id = e.id) AS "boothCount",
COALESCE((SELECT sum(h2.booth_capacity) FROM hall_assignment ha2
JOIN hall h2 ON h2.id = ha2.hall_id WHERE ha2.event_id = e.id), 0) AS capacity
FROM event e

View File

@ -23,8 +23,8 @@ public interface AnalyticsMapper {
/** 행사 부스 총 판매면적(㎡)·부스 수. */
@Select("""
SELECT COALESCE(sum(ST_Area(b.geom)), 0) AS salesArea,
count(*) AS boothCount
SELECT COALESCE(sum(ST_Area(b.geom)), 0) AS "salesArea",
count(*) AS "boothCount"
FROM booth b JOIN layout l ON l.id = b.layout_id
WHERE l.event_id = #{eventId}
""")
@ -34,7 +34,7 @@ public interface AnalyticsMapper {
@Select("""
<script>
SELECT to_char(b.created_at, 'YYYY-MM') AS period,
COALESCE(sum(ST_Area(b.geom)), 0) AS salesArea,
COALESCE(sum(ST_Area(b.geom)), 0) AS "salesArea",
count(*) AS booths
FROM booth b JOIN layout l ON l.id = b.layout_id
WHERE l.event_id = #{eventId}

View File

@ -23,12 +23,12 @@ public interface EventCatalogMapper {
<script>
SELECT e.id,
e.name,
to_char(e.start_date, 'YYYY-MM-DD') AS startDate,
to_char(e.end_date, 'YYYY-MM-DD') AS endDate,
to_char(e.start_date, 'YYYY-MM-DD') AS "startDate",
to_char(e.end_date, 'YYYY-MM-DD') AS "endDate",
e.status,
h.label AS hallLabel,
h.label AS "hallLabel",
CAST(NULL AS varchar) AS category,
CAST(NULL AS integer) AS estVisitors
CAST(NULL AS integer) AS "estVisitors"
FROM event e
LEFT JOIN LATERAL (
SELECT ha.hall_id

View File

@ -22,9 +22,9 @@ public interface AuditLogMapper {
@Select("""
<script>
SELECT id, actor_id AS actorId, actor_name AS actorName, action, target_type AS targetType,
target_id AS targetId, event_id AS eventId, summary, result,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, actor_id AS "actorId", actor_name AS "actorName", action, target_type AS "targetType",
target_id AS "targetId", event_id AS "eventId", summary, result,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM audit_log
<where>
<if test="action != null and action != ''">AND action = #{action}</if>

View File

@ -16,8 +16,8 @@ public interface DashboardMapper {
/** 행사 헤더(마일스톤 파생용 시작/종료일). 없으면 null. */
@Select("""
SELECT to_char(start_date, 'YYYY-MM-DD') AS startDate,
to_char(end_date, 'YYYY-MM-DD') AS endDate,
SELECT to_char(start_date, 'YYYY-MM-DD') AS "startDate",
to_char(end_date, 'YYYY-MM-DD') AS "endDate",
name
FROM event WHERE id = #{eventId}
""")
@ -27,23 +27,23 @@ public interface DashboardMapper {
@Select("""
SELECT
(SELECT count(*) FROM booth b JOIN layout l ON l.id = b.layout_id
WHERE l.event_id = #{eventId}) AS boothCount,
WHERE l.event_id = #{eventId}) AS "boothCount",
(SELECT COALESCE(sum(h.booth_capacity), 0) FROM hall_assignment ha
JOIN hall h ON h.id = ha.hall_id WHERE ha.event_id = #{eventId}) AS targetBooths,
JOIN hall h ON h.id = ha.hall_id WHERE ha.event_id = #{eventId}) AS "targetBooths",
(SELECT count(*) FROM booth b JOIN layout l ON l.id = b.layout_id
JOIN design_plan dp ON dp.booth_id = b.id
WHERE l.event_id = #{eventId} AND dp.status = 'approved') AS designApproved,
WHERE l.event_id = #{eventId} AND dp.status = 'approved') AS "designApproved",
(SELECT count(*) FROM design_plan dp JOIN booth b ON b.id = dp.booth_id
JOIN layout l ON l.id = b.layout_id WHERE l.event_id = #{eventId}) AS designTotal,
(SELECT count(*) FROM utility_order u WHERE u.event_id = #{eventId}) AS utilityOrders,
(SELECT count(*) FROM render_job r WHERE r.event_id = #{eventId} AND r.status = 'DONE') AS renderDone
JOIN layout l ON l.id = b.layout_id WHERE l.event_id = #{eventId}) AS "designTotal",
(SELECT count(*) FROM utility_order u WHERE u.event_id = #{eventId}) AS "utilityOrders",
(SELECT count(*) FROM render_job r WHERE r.event_id = #{eventId} AND r.status = 'DONE') AS "renderDone"
""")
Map<String, Object> findKpiCounts(@Param("eventId") String eventId);
/** 참가업체 부스 현황(최신 설계안 상태 조인). 최대 100건. */
@Select("""
SELECT b.booth_no AS boothNo,
b.assigned_company_name AS companyName,
SELECT b.booth_no AS "boothNo",
b.assigned_company_name AS "companyName",
COALESCE(dp.status, 'draft') AS status
FROM booth b
JOIN layout l ON l.id = b.layout_id
@ -61,8 +61,8 @@ public interface DashboardMapper {
@Select("""
SELECT r.id,
r.status,
r.shot_preset AS shotPreset,
r.booth_id AS boothId,
r.shot_preset AS "shotPreset",
r.booth_id AS "boothId",
to_char(r.updated_at AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS"Z"') AS at
FROM render_job r
WHERE r.event_id = #{eventId}

View File

@ -16,7 +16,7 @@ public interface OpsMapper {
/** 행사 배정 홀 목록(대표 홀 우선 정렬). */
@Select("""
SELECT h.id AS hallId, h.label
SELECT h.id AS "hallId", h.label
FROM hall_assignment ha
JOIN hall h ON h.id = ha.hall_id
WHERE ha.event_id = #{eventId}

View File

@ -17,17 +17,17 @@ public interface AccountSecurityMapper {
/** 이메일 → 인증+보안 행(자격검증·2FA 분기용). 없으면 null. */
@Select("""
SELECT id AS userId, display_name AS displayName, password_hash AS passwordHash,
hall_manager AS hallManager, otp_enabled AS otpEnabled, otp_secret AS otpSecret,
role_code AS roleCode, failed_login_count AS failedCount, locked_until AS lockedUntil
SELECT id AS "userId", display_name AS "displayName", password_hash AS "passwordHash",
hall_manager AS "hallManager", otp_enabled AS "otpEnabled", otp_secret AS "otpSecret",
role_code AS "roleCode", failed_login_count AS "failedCount", locked_until AS "lockedUntil"
FROM app_user WHERE email = #{email} AND status = 'ACTIVE'
""")
Map<String, Object> findAuthSecurityByEmail(@Param("email") String email);
/** userId → 보안 요약(마이페이지 OTP 상태·발급 라벨). */
@Select("""
SELECT id AS userId, email, display_name AS displayName, hall_manager AS hallManager,
otp_enabled AS otpEnabled, otp_secret AS otpSecret, role_code AS roleCode
SELECT id AS "userId", email, display_name AS "displayName", hall_manager AS "hallManager",
otp_enabled AS "otpEnabled", otp_secret AS "otpSecret", role_code AS "roleCode"
FROM app_user WHERE id = #{userId}
""")
Map<String, Object> findSecurityById(@Param("userId") String userId);

View File

@ -9,12 +9,12 @@ import java.util.Map;
@Mapper
public interface CommonCodeMapper {
@Select("SELECT grp_code AS grpCode, grp_name AS grpName, description, use_yn AS useYn, "
+ "sort_order AS sortOrder FROM common_code_group ORDER BY sort_order, grp_code")
@Select("SELECT grp_code AS \"grpCode\", grp_name AS \"grpName\", description, use_yn AS \"useYn\", "
+ "sort_order AS \"sortOrder\" FROM common_code_group ORDER BY sort_order, grp_code")
List<Map<String, Object>> findGroups();
@Select("SELECT grp_code AS grpCode, code, code_name AS codeName, code_value AS codeValue, "
+ "sort_order AS sortOrder, use_yn AS useYn, attr1 FROM common_code "
@Select("SELECT grp_code AS \"grpCode\", code, code_name AS \"codeName\", code_value AS \"codeValue\", "
+ "sort_order AS \"sortOrder\", use_yn AS \"useYn\", attr1 FROM common_code "
+ "WHERE grp_code = #{grpCode} AND use_yn = 'Y' ORDER BY sort_order, code")
List<Map<String, Object>> findCodes(@Param("grpCode") String grpCode);

View File

@ -9,9 +9,9 @@ import java.util.Map;
@Mapper
public interface LoginSlideMapper {
String COLS = "id, image_url AS imageUrl, title, caption, sort_order AS sortOrder, "
+ "is_active AS active, to_char(created_at, 'YYYY-MM-DD HH24:MI') AS createdAt, "
+ "to_char(updated_at, 'YYYY-MM-DD HH24:MI') AS updatedAt";
String COLS = "id, image_url AS \"imageUrl\", title, caption, sort_order AS \"sortOrder\", "
+ "is_active AS active, to_char(created_at, 'YYYY-MM-DD HH24:MI') AS \"createdAt\", "
+ "to_char(updated_at, 'YYYY-MM-DD HH24:MI') AS \"updatedAt\"";
/** 공개 노출용 — 활성만, 최신 등록순 최대 {limit}건. */
@Select("SELECT " + COLS + " FROM login_slide WHERE is_active = true "

View File

@ -9,8 +9,8 @@ import java.util.Map;
@Mapper
public interface MenuMapper {
@Select("SELECT id, parent_id AS parentId, menu_name AS menuName, menu_path AS menuPath, icon, "
+ "prg_type AS prgType, required_role AS requiredRole, sort_order AS sortOrder, use_yn AS useYn "
@Select("SELECT id, parent_id AS \"parentId\", menu_name AS \"menuName\", menu_path AS \"menuPath\", icon, "
+ "prg_type AS \"prgType\", required_role AS \"requiredRole\", sort_order AS \"sortOrder\", use_yn AS \"useYn\" "
+ "FROM sys_menu ORDER BY sort_order, id")
List<Map<String, Object>> findAll();

View File

@ -9,11 +9,11 @@ import java.util.Map;
@Mapper
public interface RoleMapper {
@Select("SELECT role_code AS roleCode, role_name AS roleName, description, use_yn AS useYn "
@Select("SELECT role_code AS \"roleCode\", role_name AS \"roleName\", description, use_yn AS \"useYn\" "
+ "FROM sys_role ORDER BY role_code")
List<Map<String, Object>> findRoles();
@Select("SELECT perm_code AS permCode, perm_name AS permName, description "
@Select("SELECT perm_code AS \"permCode\", perm_name AS \"permName\", description "
+ "FROM sys_permission ORDER BY perm_code")
List<Map<String, Object>> findPermissions();

View File

@ -9,12 +9,12 @@ import java.util.Map;
@Mapper
public interface SettingMapper {
@Select("SELECT setting_key AS settingKey, setting_value AS settingValue, value_type AS valueType, "
+ "description, secret_yn AS secretYn FROM sys_setting ORDER BY setting_key")
@Select("SELECT setting_key AS \"settingKey\", setting_value AS \"settingValue\", value_type AS \"valueType\", "
+ "description, secret_yn AS \"secretYn\" FROM sys_setting ORDER BY setting_key")
List<Map<String, Object>> findAll();
@Select("SELECT setting_key AS settingKey, setting_value AS settingValue, value_type AS valueType, "
+ "description, secret_yn AS secretYn FROM sys_setting WHERE setting_key = #{key}")
@Select("SELECT setting_key AS \"settingKey\", setting_value AS \"settingValue\", value_type AS \"valueType\", "
+ "description, secret_yn AS \"secretYn\" FROM sys_setting WHERE setting_key = #{key}")
Map<String, Object> findByKey(@Param("key") String key);
@Insert("INSERT INTO sys_setting (setting_key, setting_value, value_type, description, secret_yn, updated_by) "

View File

@ -21,9 +21,9 @@ public interface SysUserMapper {
/** 사용자 목록(검색·페이징) — 민감 컬럼 제외. */
@Select("""
<script>
SELECT id AS userId, email, display_name AS displayName, hall_manager AS hallManager,
role_code AS roleCode, dept_id AS deptId, status, otp_enabled AS otpEnabled,
to_char(last_login_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS lastLoginAt
SELECT id AS "userId", email, display_name AS "displayName", hall_manager AS "hallManager",
role_code AS "roleCode", dept_id AS "deptId", status, otp_enabled AS "otpEnabled",
to_char(last_login_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "lastLoginAt"
FROM app_user
<where>
<if test="keyword != null and keyword != ''">
@ -56,8 +56,8 @@ public interface SysUserMapper {
@Param("roleCode") String roleCode);
@Select("""
SELECT id AS userId, email, display_name AS displayName, hall_manager AS hallManager,
role_code AS roleCode, dept_id AS deptId, status, otp_enabled AS otpEnabled
SELECT id AS "userId", email, display_name AS "displayName", hall_manager AS "hallManager",
role_code AS "roleCode", dept_id AS "deptId", status, otp_enabled AS "otpEnabled"
FROM app_user WHERE id = #{userId}
""")
Map<String, Object> findById(@Param("userId") String userId);

View File

@ -11,10 +11,10 @@ public interface MeetingMapper {
@Select("""
<script>
SELECT id, event_id AS eventId, title, location,
to_char(meeting_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS meetingAt,
organizer_id AS organizerId, organizer_name AS organizerName, content, minutes,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", title, location,
to_char(meeting_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "meetingAt",
organizer_id AS "organizerId", organizer_name AS "organizerName", content, minutes,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM meeting
<where>
<if test="eventId != null and eventId != ''">AND event_id = #{eventId}</if>
@ -33,10 +33,10 @@ public interface MeetingMapper {
long count(Map<String, Object> q);
@Select("""
SELECT id, event_id AS eventId, title, location,
to_char(meeting_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS meetingAt,
organizer_id AS organizerId, organizer_name AS organizerName, content, minutes,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", title, location,
to_char(meeting_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "meetingAt",
organizer_id AS "organizerId", organizer_name AS "organizerName", content, minutes,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM meeting WHERE id = #{id}
""")
Map<String, Object> findById(@Param("id") String id);
@ -63,8 +63,8 @@ public interface MeetingMapper {
int delete(@Param("id") String id, @Param("organizerId") String organizerId);
@Select("""
SELECT id, meeting_id AS meetingId, seq, action_item AS actionItem, assignee_id AS assigneeId,
to_char(due_date,'YYYY-MM-DD') AS dueDate, status
SELECT id, meeting_id AS "meetingId", seq, action_item AS "actionItem", assignee_id AS "assigneeId",
to_char(due_date,'YYYY-MM-DD') AS "dueDate", status
FROM meeting_action WHERE meeting_id=#{meetingId} ORDER BY seq
""")
List<Map<String, Object>> findActions(@Param("meetingId") String meetingId);

View File

@ -18,10 +18,10 @@ public interface MessageMapper {
int insertRecipient(Map<String, Object> p);
@Select("""
SELECT m.id, m.sender_id AS senderId, m.sender_name AS senderName, m.title, m.content,
r.recv_type AS recvType,
to_char(r.read_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS readAt,
to_char(m.created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT m.id, m.sender_id AS "senderId", m.sender_name AS "senderName", m.title, m.content,
r.recv_type AS "recvType",
to_char(r.read_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "readAt",
to_char(m.created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM message_recipient r JOIN message m ON m.id = r.message_id
WHERE r.recipient_id = #{userId} AND r.deleted = false
ORDER BY m.created_at DESC LIMIT #{size} OFFSET #{offset}
@ -37,8 +37,8 @@ public interface MessageMapper {
long unreadCount(@Param("userId") String userId);
@Select("""
SELECT m.id, m.sender_id AS senderId, m.sender_name AS senderName, m.title, m.content,
to_char(m.created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT m.id, m.sender_id AS "senderId", m.sender_name AS "senderName", m.title, m.content,
to_char(m.created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM message m WHERE m.sender_id = #{userId}
ORDER BY m.created_at DESC LIMIT #{size} OFFSET #{offset}
""")

View File

@ -11,10 +11,10 @@ public interface NoticeMapper {
@Select("""
<script>
SELECT id, event_id AS eventId, category, title, content, pinned,
author_id AS authorId, author_name AS authorName, view_count AS viewCount,
to_char(published_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS publishedAt,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", category, title, content, pinned,
author_id AS "authorId", author_name AS "authorName", view_count AS "viewCount",
to_char(published_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "publishedAt",
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM notice
<where>
<if test="eventId != null and eventId != ''">AND event_id = #{eventId}</if>
@ -39,10 +39,10 @@ public interface NoticeMapper {
long count(Map<String, Object> q);
@Select("""
SELECT id, event_id AS eventId, category, title, content, pinned,
author_id AS authorId, author_name AS authorName, view_count AS viewCount,
to_char(published_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS publishedAt,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", category, title, content, pinned,
author_id AS "authorId", author_name AS "authorName", view_count AS "viewCount",
to_char(published_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "publishedAt",
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM notice WHERE id = #{id}
""")
Map<String, Object> findById(@Param("id") String id);

View File

@ -11,10 +11,10 @@ public interface NotificationMapper {
@Select("""
<script>
SELECT id, recipient_id AS recipientId, event_id AS eventId, noti_type AS notiType,
SELECT id, recipient_id AS "recipientId", event_id AS "eventId", noti_type AS "notiType",
title, message, link,
to_char(read_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS readAt,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
to_char(read_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "readAt",
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM notification
WHERE recipient_id = #{userId}
<if test="unreadOnly">AND read_at IS NULL</if>

View File

@ -11,9 +11,9 @@ public interface OpinionMapper {
@Select("""
<script>
SELECT id, event_id AS eventId, category, title, content, status,
author_id AS authorId, author_name AS authorName, secret_yn AS secretYn,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", category, title, content, status,
author_id AS "authorId", author_name AS "authorName", secret_yn AS "secretYn",
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM opinion
<where>
<if test="eventId != null and eventId != ''">AND event_id = #{eventId}</if>
@ -36,9 +36,9 @@ public interface OpinionMapper {
long count(Map<String, Object> q);
@Select("""
SELECT id, event_id AS eventId, category, title, content, status,
author_id AS authorId, author_name AS authorName, secret_yn AS secretYn,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", category, title, content, status,
author_id AS "authorId", author_name AS "authorName", secret_yn AS "secretYn",
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM opinion WHERE id = #{id}
""")
Map<String, Object> findById(@Param("id") String id);
@ -57,8 +57,8 @@ public interface OpinionMapper {
int delete(@Param("id") String id, @Param("authorId") String authorId);
@Select("""
SELECT id, opinion_id AS opinionId, author_id AS authorId, author_name AS authorName, content,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, opinion_id AS "opinionId", author_id AS "authorId", author_name AS "authorName", content,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM opinion_comment WHERE opinion_id = #{opinionId} ORDER BY created_at
""")
List<Map<String, Object>> findComments(@Param("opinionId") String opinionId);

View File

@ -11,10 +11,10 @@ public interface ReportMapper {
@Select("""
<script>
SELECT id, event_id AS eventId, report_type AS reportType,
to_char(period_from,'YYYY-MM-DD') AS periodFrom, to_char(period_to,'YYYY-MM-DD') AS periodTo,
title, content, author_id AS authorId, author_name AS authorName,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", report_type AS "reportType",
to_char(period_from,'YYYY-MM-DD') AS "periodFrom", to_char(period_to,'YYYY-MM-DD') AS "periodTo",
title, content, author_id AS "authorId", author_name AS "authorName",
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM report
<where>
<if test="eventId != null and eventId != ''">AND event_id = #{eventId}</if>
@ -39,10 +39,10 @@ public interface ReportMapper {
long count(Map<String, Object> q);
@Select("""
SELECT id, event_id AS eventId, report_type AS reportType,
to_char(period_from,'YYYY-MM-DD') AS periodFrom, to_char(period_to,'YYYY-MM-DD') AS periodTo,
title, content, author_id AS authorId, author_name AS authorName,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", report_type AS "reportType",
to_char(period_from,'YYYY-MM-DD') AS "periodFrom", to_char(period_to,'YYYY-MM-DD') AS "periodTo",
title, content, author_id AS "authorId", author_name AS "authorName",
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM report WHERE id = #{id}
""")
Map<String, Object> findById(@Param("id") String id);

View File

@ -11,12 +11,12 @@ public interface ScheduleMapper {
@Select("""
<script>
SELECT id, event_id AS eventId, owner_id AS ownerId, owner_name AS ownerName, title,
schedule_type AS scheduleType, importance,
to_char(start_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS startAt,
to_char(end_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS endAt,
all_day AS allDay, location, content, color,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", owner_id AS "ownerId", owner_name AS "ownerName", title,
schedule_type AS "scheduleType", importance,
to_char(start_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "startAt",
to_char(end_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "endAt",
all_day AS "allDay", location, content, color,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM schedule
<where>
<if test="mineOnly">AND owner_id = #{userId}</if>
@ -30,12 +30,12 @@ public interface ScheduleMapper {
List<Map<String, Object>> search(Map<String, Object> q);
@Select("""
SELECT id, event_id AS eventId, owner_id AS ownerId, owner_name AS ownerName, title,
schedule_type AS scheduleType, importance,
to_char(start_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS startAt,
to_char(end_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS endAt,
all_day AS allDay, location, content, color,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt
SELECT id, event_id AS "eventId", owner_id AS "ownerId", owner_name AS "ownerName", title,
schedule_type AS "scheduleType", importance,
to_char(start_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "startAt",
to_char(end_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "endAt",
all_day AS "allDay", location, content, color,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt"
FROM schedule WHERE id = #{id}
""")
Map<String, Object> findById(@Param("id") String id);

View File

@ -18,7 +18,7 @@ public interface SearchMapper {
<script>
SELECT * FROM (
SELECT 'WORKLOG' AS type, id, title,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt, created_at AS ord
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt", created_at AS ord
FROM worklog
WHERE title ILIKE '%'||#{q}||'%' <if test="seeAll == false">AND writer_id = #{userId}</if>
UNION ALL

View File

@ -11,11 +11,11 @@ public interface WorklogMapper {
@Select("""
<script>
SELECT id, event_id AS eventId, writer_id AS writerId, writer_name AS writerName,
to_char(work_date,'YYYY-MM-DD') AS workDate, title, work_type AS workType,
SELECT id, event_id AS "eventId", writer_id AS "writerId", writer_name AS "writerName",
to_char(work_date,'YYYY-MM-DD') AS "workDate", title, work_type AS "workType",
progress, status, content, hours,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt,
to_char(updated_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS updatedAt
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt",
to_char(updated_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "updatedAt"
FROM worklog
<where>
<if test="mineOnly">AND writer_id = #{userId}</if>
@ -45,11 +45,11 @@ public interface WorklogMapper {
long count(Map<String, Object> q);
@Select("""
SELECT id, event_id AS eventId, writer_id AS writerId, writer_name AS writerName,
to_char(work_date,'YYYY-MM-DD') AS workDate, title, work_type AS workType,
SELECT id, event_id AS "eventId", writer_id AS "writerId", writer_name AS "writerName",
to_char(work_date,'YYYY-MM-DD') AS "workDate", title, work_type AS "workType",
progress, status, content, hours,
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS createdAt,
to_char(updated_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS updatedAt
to_char(created_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "createdAt",
to_char(updated_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "updatedAt"
FROM worklog WHERE id = #{id}
""")
Map<String, Object> findById(@Param("id") String id);