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 SELECT
(SELECT count(*) FROM event (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 (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, 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 app_user WHERE status = 'ACTIVE') AS "activeUsers",
(SELECT count(*) FROM company) AS companies, (SELECT count(*) FROM company) AS companies,
(SELECT count(*) FROM event (SELECT count(*) FROM event
WHERE start_date > CURRENT_DATE) AS upcomingEvents WHERE start_date > CURRENT_DATE) AS "upcomingEvents"
""") """)
Map<String, Object> findKpiCounts(); Map<String, Object> findKpiCounts();
/** 진행 중(라이브) 행사 — 대표 홀·부스 수·홀 수용량. 최대 20건. */ /** 진행 중(라이브) 행사 — 대표 홀·부스 수·홀 수용량. 최대 20건. */
@Select(""" @Select("""
SELECT e.id AS eventId, SELECT e.id AS "eventId",
e.name, e.name,
COALESCE(h.label, '') AS hall, COALESCE(h.label, '') AS hall,
e.status, e.status,
(SELECT count(*) FROM booth b JOIN layout l ON l.id = b.layout_id (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 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 JOIN hall h2 ON h2.id = ha2.hall_id WHERE ha2.event_id = e.id), 0) AS capacity
FROM event e FROM event e

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,11 +9,11 @@ import java.util.Map;
@Mapper @Mapper
public interface RoleMapper { 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") + "FROM sys_role ORDER BY role_code")
List<Map<String, Object>> findRoles(); 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") + "FROM sys_permission ORDER BY perm_code")
List<Map<String, Object>> findPermissions(); List<Map<String, Object>> findPermissions();

View File

@ -9,12 +9,12 @@ import java.util.Map;
@Mapper @Mapper
public interface SettingMapper { public interface SettingMapper {
@Select("SELECT setting_key AS settingKey, setting_value AS settingValue, value_type AS valueType, " @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") + "description, secret_yn AS \"secretYn\" FROM sys_setting ORDER BY setting_key")
List<Map<String, Object>> findAll(); List<Map<String, Object>> findAll();
@Select("SELECT setting_key AS settingKey, setting_value AS settingValue, value_type AS valueType, " @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}") + "description, secret_yn AS \"secretYn\" FROM sys_setting WHERE setting_key = #{key}")
Map<String, Object> findByKey(@Param("key") String 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) " @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(""" @Select("""
<script> <script>
SELECT id AS userId, email, display_name AS displayName, hall_manager AS hallManager, 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, 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 to_char(last_login_at AT TIME ZONE 'UTC','YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "lastLoginAt"
FROM app_user FROM app_user
<where> <where>
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
@ -56,8 +56,8 @@ public interface SysUserMapper {
@Param("roleCode") String roleCode); @Param("roleCode") String roleCode);
@Select(""" @Select("""
SELECT id AS userId, email, display_name AS displayName, hall_manager AS hallManager, 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 role_code AS "roleCode", dept_id AS "deptId", status, otp_enabled AS "otpEnabled"
FROM app_user WHERE id = #{userId} FROM app_user WHERE id = #{userId}
""") """)
Map<String, Object> findById(@Param("userId") String userId); Map<String, Object> findById(@Param("userId") String userId);

View File

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

View File

@ -18,10 +18,10 @@ public interface MessageMapper {
int insertRecipient(Map<String, Object> p); int insertRecipient(Map<String, Object> p);
@Select(""" @Select("""
SELECT m.id, m.sender_id AS senderId, m.sender_name AS senderName, m.title, m.content, SELECT m.id, m.sender_id AS "senderId", m.sender_name AS "senderName", m.title, m.content,
r.recv_type AS recvType, 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(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 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 FROM message_recipient r JOIN message m ON m.id = r.message_id
WHERE r.recipient_id = #{userId} AND r.deleted = false WHERE r.recipient_id = #{userId} AND r.deleted = false
ORDER BY m.created_at DESC LIMIT #{size} OFFSET #{offset} ORDER BY m.created_at DESC LIMIT #{size} OFFSET #{offset}
@ -37,8 +37,8 @@ public interface MessageMapper {
long unreadCount(@Param("userId") String userId); long unreadCount(@Param("userId") String userId);
@Select(""" @Select("""
SELECT m.id, m.sender_id AS senderId, m.sender_name AS senderName, m.title, m.content, 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 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} FROM message m WHERE m.sender_id = #{userId}
ORDER BY m.created_at DESC LIMIT #{size} OFFSET #{offset} ORDER BY m.created_at DESC LIMIT #{size} OFFSET #{offset}
""") """)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ public interface SearchMapper {
<script> <script>
SELECT * FROM ( SELECT * FROM (
SELECT 'WORKLOG' AS type, id, title, 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 FROM worklog
WHERE title ILIKE '%'||#{q}||'%' <if test="seeAll == false">AND writer_id = #{userId}</if> WHERE title ILIKE '%'||#{q}||'%' <if test="seeAll == false">AND writer_id = #{userId}</if>
UNION ALL UNION ALL

View File

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