임산물현황 추가 팝업까지 + 값체크.

This commit is contained in:
주우성
2025-06-15 12:55:33 +09:00
parent 9723b58aa9
commit ecf5b83bba
39 changed files with 1257 additions and 85 deletions

View File

@@ -20,6 +20,9 @@
FROM monthly_input_status a
WHERE a.id = #{id}
AND a.is_deleted = false
<if test="householdSeq != null">
AND a.household_seq = #{householdSeq}
</if>
</if>
</select>

View File

@@ -0,0 +1,33 @@
<?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.monthly.getPrevMonthlyInputStatus.adapters.persistence.GetPrevMonthlyInputStatusMapper">
<select id="getPrevMonthlyInputStatus"
resultType="app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus">
<if test="id != null">
SELECT
a.id AS id,
a.household_seq AS householdSeq,
a.month AS month,
a.forest_product_status AS forestProductStatus,
a.bank_auto_transfer_status AS bankAutoTransferStatus,
a.created_at AS createdAt,
a.created_by AS createdBy,
a.updated_at AS updatedAt,
a.updated_by AS updatedBy
FROM monthly_input_status a
WHERE a.is_deleted = false
AND a.forest_product_status != 'NONE'
AND a.household_seq = #{householdSeq}
AND a.month = (
SELECT TO_CHAR(TO_DATE(month, 'YYYY-MM') - INTERVAL '1 month', 'YYYY-MM')
FROM monthly_input_status
WHERE is_deleted = false AND id = #{id}
);
</if>
</select>
</mapper>

View File

@@ -70,4 +70,9 @@
</if>
</select>
</mapper>

View File

@@ -0,0 +1,71 @@
<?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.product.getMonthlyForestProducts.adapters.persistence.GetMonthlyForestProductsMapper">
<select id="getMonthlyForestProducts"
resultType="app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence.model.GetMonthlyForestProductsDto">
/* getForestProducts : 게시물 리스트 */
SELECT
a.id AS id,
a.household_seq AS householdSeq,
a.street_num AS streetNum,
a.land_type AS landType,
a.town AS town,
a.available_area AS availableArea,
a.crop_name AS cropName,
a.crop_code AS cropCode,
a.land_area AS landArea,
a.month AS month,
a.main_yield AS mainYield,
a.main_yield_unit_code AS mainYieldUnitCode,
a.main_sale_amount AS mainSaleAmount,
a.main_sale_unit_code AS mainSaleUnitCode,
a.sub_yield AS subYield,
a.sub_yield_unit_code AS subYieldUnitCode,
a.sub_sale_amount AS subSaleAmount,
a.sub_sale_unit_code AS subSaleUnitCode,
a.monthly_input_status_id AS monthlyInputStatusId,
a.created_at AS createdAt,
a.created_by AS createdBy,
a.updated_at AS updatedAt,
a.updated_by AS updatedBy,
COUNT(*) OVER () AS total
FROM forest_product a
WHERE a.is_deleted = false
<if test="cmd.monthlyInputStatusId != null">
AND a.monthly_input_status_id = #{cmd.monthlyInputStatusId}
</if>
<if test="cmd.householdSeq != null">
AND a.household_seq = #{cmd.householdSeq}
</if>
<if test="pageable.sort != null and !pageable.sort.isEmpty()">
ORDER BY
<foreach collection="pageable.sort" item="order" separator=",">
<choose>
<when test="order.property eq 'household'">a.household_seq</when>
<when test="order.property eq 'updatedBy'">a.updated_by</when>
<when test="order.property eq 'updatedAt'">a.updated_at</when>
<when test="order.property eq 'createdBy'">a.created_by</when>
<when test="order.property eq 'createdAt'">a.created_at</when>
<otherwise>a.id</otherwise>
</choose>
<choose>
<when test="order.direction.toString() eq 'DESC'">DESC</when>
<otherwise>ASC</otherwise>
</choose>
</foreach>
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
</if>
</select>
</mapper>