[2025.05.30] admin 로그인, initData 작업 중 (1)

This commit is contained in:
kangsunlee
2025-05-30 18:18:10 +09:00
parent 38342fee48
commit 64ba09e086
37 changed files with 822 additions and 599 deletions

View File

@@ -50,6 +50,13 @@ spring:
thymeleaf:
cache: false # 타임리프 캐시 비활성화 (개발 모드)
# 초기 스키마 생성 SQL 경로 설정
sql:
init:
schema-locations:
- classpath:sql/drop-all.sql
- classpath:sql/create-all.sql
# ==============================================
# 암호화 설정
# ==============================================

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.core.usecase.adminResearch.getAdmin.adapters.persistence.GetAdminMapper">
<select id="findById"
resultType="app.module.core.usecase.adminResearch.getAdmin.ports.application.domain.GetAdmin">
/* findById : 관리자 상세 조회 */
SELECT
a.seq,
a.id,
a.password,
a.name,
a.contact,
a.inspection_area_code,
a.password_updated_at,
a.account_disabled,
a.login_fail_cnt,
a.account_locked,
a.created_at,
a.created_by,
a.updated_at,
a.updated_by
FROM admin_research a
WHERE id = #{id}
AND a.is_deleted = false
</select>
<resultMap id="AdminRoleHasPrivilegesMap" type="app.module.core.config.adapters.web.security.domain.CoreRole">
<id property="id" column="role_id"/>
<result property="description" column="role_description"/>
<collection property="privileges" ofType="app.module.core.config.adapters.web.security.domain.CorePrivilege">
<id property="id" column="privilege_id"/>
</collection>
</resultMap>
<select id="findRoleHasPrivilegesByAdminId" resultMap="AdminRoleHasPrivilegesMap">
/* findRoleHasPrivilegesByAdminId : 관리자 권한, 역할 조회 */
SELECT
r.id AS role_id,
r.description AS role_description,
p.id AS privilege_id
FROM admin_research_has_role ahr
JOIN role r ON ahr.role_id = r.id AND r.is_deleted = false
LEFT JOIN role_has_privilege rhp ON r.id = rhp.role_id AND rhp.is_deleted = false
LEFT JOIN privilege p ON rhp.privilege_id = p.id AND p.is_deleted = false
WHERE ahr.admin_seq = #{seq}
AND ahr.is_deleted = false
</select>
</mapper>

View File

@@ -58,8 +58,7 @@
<update id="deleteAdminRolesByAdminId">
/* deleteAdminRolesByAdminId : 관리자 역할 매핑 정보 수정 */
UPDATE admin_has_role
SET is_deleted = true
<include refid="common.fields.DeleteBaseSet"/>
SET <include refid="common.fields.DeleteBaseSet"/>
WHERE admin_id = #{adminId}
</update>
</mapper>

View File

@@ -7,7 +7,7 @@
<select id="findByHouseholdNum"
resultType="app.module.core.usecase.household.getHousehold.ports.application.domain.GetHousehold">
SELECT
id,
seq,
household_num,
owner_name,
owner_age,

View File

@@ -15,7 +15,7 @@
city = #{city},
address_detail = #{addressDetail},
<include refid="common.fields.UpdateBaseSet" />
WHERE id = ${id}
WHERE seq = ${seq}
</update>
</mapper>

View File

@@ -6,4 +6,13 @@
<delete id="deleteAll">
DELETE FROM article
</delete>
<delete id="deleteAllFiles">
DELETE FROM article_has_upload_file
</delete>
<delete id="deleteAllComments">
DELETE FROM article_comment
</delete>
</mapper>

View File

@@ -0,0 +1,5 @@
-- test
CREATE TABLE my_first_table (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL
);

View File

@@ -0,0 +1,2 @@
-- test
DROP TABLE IF EXISTS my_first_table;