단속현황 검색필터 추가

jiHyung 2022-11-09 17:48:55 +09:00
parent 58c776513f
commit b2fa46df9b
3 changed files with 15 additions and 2 deletions

View File

@ -83,6 +83,8 @@ public class CrackdownStatus extends CrackdownStatusBaseEntity {
@Transient @Transient
private String year; private String year;
@Transient @Transient
private String month;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate napoDate; private LocalDate napoDate;
@Transient @Transient

View File

@ -7,7 +7,10 @@
<sql id="selectCrackdownStatusListWhere"> <sql id="selectCrackdownStatusListWhere">
<where> <where>
<if test='year != null and year != ""'> <if test='year != null and year != ""'>
And EXTRACT(YEAR FROM pr.wrt_dt) = EXTRACT(YEAR FROM CAST(#{year} AS DATE)::TIMESTAMP) And EXTRACT(YEAR FROM pr.wrt_dt) = #{year}::NUMERIC
</if>
<if test='month != null and month != ""'>
And EXTRACT(MONTH FROM pr.wrt_dt) = #{month}::NUMERIC
</if> </if>
<if test='caseNum != null and caseNum != ""'> <if test='caseNum != null and caseNum != ""'>
AND caseNum = #{caseNum} AND caseNum = #{caseNum}

View File

@ -26,7 +26,15 @@
<select class="form-select form-select-sm" name="year"> <select class="form-select form-select-sm" name="year">
<option value="">연도</option> <option value="">연도</option>
<th:block th:each="year : ${#numbers.sequence(2020, 2030)}"> <th:block th:each="year : ${#numbers.sequence(2020, 2030)}">
<option th:value="${year + '-01-01'}" th:text="${year}" th:selected="${searchParams.year eq year}"></option> <option th:value="${year}" th:text="${year}" th:selected="${searchParams.year eq year}"></option>
</th:block>
</select>
</div>
<div class="col-auto">
<select class="form-select form-select-sm" name="month">
<option value=""></option>
<th:block th:each="month : ${#numbers.sequence(1, 12)}">
<option th:value="${month}" th:text="${month}" th:selected="${searchParams.month eq month}"></option>
</th:block> </th:block>
</select> </select>
</div> </div>