[BO] 커뮤니케이션 - 건의사항 작업
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?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.admin.usecase.communication.suggestion.getSuggestion.adapters.persistence.GetSuggestionMapper">
|
||||
<select id="getSuggestionById"
|
||||
resultType="app.module.admin.usecase.communication.suggestion.getSuggestion.ports.application.domain.GetSuggestion">
|
||||
/* getSuggestionById : 건의하기 상세 조회 */
|
||||
SELECT s.id,
|
||||
s.household_seq,
|
||||
h.household_num,
|
||||
h.owner_name,
|
||||
h.phone AS owner_phone,
|
||||
h.region_main_name,
|
||||
r.researcher_name,
|
||||
r.researcher_phone,
|
||||
s.content
|
||||
FROM suggestion s
|
||||
LEFT JOIN v_household_with_code h ON h.seq = s.household_seq
|
||||
LEFT JOIN v_household_researcher r ON h.seq = r.household_seq
|
||||
WHERE s.is_deleted = false
|
||||
AND s.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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.admin.usecase.communication.suggestion.getSuggestions.adapters.persistence.GetSuggestionsMapper">
|
||||
<select id="getSuggestions"
|
||||
resultType="app.module.admin.usecase.communication.suggestion.getSuggestions.ports.application.domain.GetSuggestions">
|
||||
/* getSuggestions : 건의사항 목록 조회 */
|
||||
SELECT s.id,
|
||||
s.household_seq,
|
||||
s.content,
|
||||
h.owner_name,
|
||||
h.phone,
|
||||
s.updated_by,
|
||||
TO_CHAR(s.updated_at, 'YYYY-MM-DD HH24:MI') AS updatedAt,
|
||||
COUNT(*) OVER () AS total
|
||||
FROM suggestion s
|
||||
LEFT JOIN household h
|
||||
ON h.seq = s.household_seq
|
||||
AND h.is_deleted = false
|
||||
WHERE s.is_deleted = false
|
||||
|
||||
<if test="cmd.recordMonth != null and cmd.recordMonth != ''">
|
||||
/* 날짜 검색 */
|
||||
AND TO_CHAR(s.created_at, 'YYYYMM') = #{cmd.recordMonth}
|
||||
</if>
|
||||
|
||||
<if test="cmd.ownerValue != null and cmd.ownerValue != ''">
|
||||
/* 경영주 검색 */
|
||||
<choose>
|
||||
<when test="cmd.ownerField == ''">
|
||||
AND (
|
||||
h.owner_name ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||
OR h.phone ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||
)
|
||||
</when>
|
||||
<when test="cmd.ownerField eq 'name'">
|
||||
AND h.owner_name ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||
</when>
|
||||
<when test="cmd.ownerField eq 'phone'">
|
||||
AND h.phone ILIKE '%' || #{cmd.ownerValue} || '%'
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
ORDER BY s.id DESC
|
||||
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user