[BO] 임산물현황 등록 작업
This commit is contained in:
@@ -4,9 +4,10 @@
|
||||
<mapper
|
||||
namespace="app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.adapters.persistence.GetForestProductsStatusMapper">
|
||||
|
||||
<select id="getMonthlyStatus" resultType="java.lang.String">
|
||||
<select id="getMonthlyStatus" resultType="app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetMonthlyForestProductsStatus">
|
||||
/* getMonthlyStatus : 임산물 현황 등록 상태 조회 */
|
||||
SELECT forest_product_status
|
||||
SELECT id,
|
||||
forest_product_status
|
||||
FROM monthly_input_status mis
|
||||
WHERE household_seq = #{householdSeq}
|
||||
AND month = #{recordMonth}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?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.household.tab.forestProduct.saveForestProduct.adapters.persistence.SaveForestProductMapper">
|
||||
<insert id="createForestProduct">
|
||||
/* createForestProduct : 임산물 현황 등록 */
|
||||
INSERT INTO forest_product
|
||||
(
|
||||
household_seq,
|
||||
month,
|
||||
street_num,
|
||||
land_type,
|
||||
town,
|
||||
crop_name,
|
||||
land_area,
|
||||
available_area,
|
||||
main_yield,
|
||||
main_yield_unit_code,
|
||||
main_yield_unit,
|
||||
main_sale_amount,
|
||||
main_sale_unit_code,
|
||||
main_sale_unit,
|
||||
sub_yield,
|
||||
sub_yield_unit_code,
|
||||
sub_yield_unit,
|
||||
sub_sale_amount,
|
||||
sub_sale_unit_code,
|
||||
sub_sale_unit,
|
||||
monthly_input_status_id,
|
||||
<include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{householdSeq},
|
||||
#{recordMonth},
|
||||
#{streetNum},
|
||||
#{landType},
|
||||
#{town},
|
||||
#{cropName},
|
||||
#{landArea},
|
||||
#{availableArea},
|
||||
#{mainYield},
|
||||
#{mainYieldUnitCode},
|
||||
#{mainYieldUnit},
|
||||
#{mainSaleAmount},
|
||||
#{mainSaleUnitCode},
|
||||
#{mainSaleUnit},
|
||||
#{subYield},
|
||||
#{subYieldUnitCode},
|
||||
#{subYieldUnit},
|
||||
#{subSaleAmount},
|
||||
#{subSaleUnitCode},
|
||||
#{subSaleUnit},
|
||||
#{monthlyInputStatusId},
|
||||
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateForestProduct">
|
||||
/* updateForestProduct : 임산물 현황 수정 */
|
||||
UPDATE forest_product
|
||||
SET
|
||||
household_seq = #{householdSeq},
|
||||
street_num = #{streetNum},
|
||||
land_type = #{landType},
|
||||
town = #{town},
|
||||
available_area = #{availableArea},
|
||||
crop_name = #{cropName},
|
||||
land_area = #{landArea},
|
||||
month = #{recordMonth},
|
||||
main_yield = #{mainYield},
|
||||
main_yield_unit_code = #{mainYieldUnitCode},
|
||||
main_yield_unit = #{mainYieldUnit},
|
||||
main_sale_amount = #{mainSaleAmount},
|
||||
main_sale_unit_code = #{mainSaleUnitCode},
|
||||
main_sale_unit = #{mainSaleUnit},
|
||||
sub_yield = #{subYield},
|
||||
sub_yield_unit_code = #{subYieldUnitCode},
|
||||
sub_yield_unit = #{subYieldUnit},
|
||||
sub_sale_amount = #{subSaleAmount},
|
||||
sub_sale_unit_code = #{subSaleUnitCode},
|
||||
sub_sale_unit = #{subSaleUnit},
|
||||
monthly_input_status_id = #{monthlyInputStatusId},
|
||||
<include refid="common.fields.UpdateBaseSet"/>
|
||||
WHERE id = #{forestProductId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -8,6 +8,7 @@
|
||||
<input type="hidden" name="forestProductId">
|
||||
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||
<input type="hidden" name="recordMonth">
|
||||
<input type="hidden" name="monthlyInputStatusId">
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-forest-product" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
@@ -229,7 +230,7 @@
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary">
|
||||
<button type="button" class="btn btn-primary" onclick="goForestProductSave();">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -249,6 +250,7 @@
|
||||
const showForestProductModal = (id) => {
|
||||
const f = document.reqForestProductForm;
|
||||
f.recordMonth.value = document.reqForm.recordMonth.value;
|
||||
f.monthlyInputStatusId.value = document.reqForm.monthlyInputStatusId.value;
|
||||
|
||||
resetForestProductForm();
|
||||
|
||||
@@ -261,6 +263,8 @@
|
||||
(response) => {
|
||||
console.log("임산물현황 상세 응답값 : ", response);
|
||||
setForestProductFormData(response);
|
||||
|
||||
document.querySelector(".modal-forest-product").ui.open();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
@@ -268,9 +272,9 @@
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
} else {
|
||||
document.querySelector(".modal-forest-product").ui.open();
|
||||
}
|
||||
|
||||
document.querySelector(".modal-forest-product").ui.open();
|
||||
}
|
||||
|
||||
// 임산물현황등록 상세 값 set
|
||||
@@ -332,21 +336,47 @@
|
||||
const form = document.reqForestProductForm;
|
||||
if (!form) return;
|
||||
|
||||
// 모든 input 초기화
|
||||
form.querySelectorAll('input').forEach((input) => {
|
||||
input.value = '';
|
||||
const skipInputs = ['forestProductId', 'householdSeq', 'recordMonth', 'monthlyInputStatusId'];
|
||||
|
||||
// 단위 직접입력는 다시 비활성화하고 클래스 추가
|
||||
if (input.closest('.unit-self-input')) {
|
||||
input.disabled = true;
|
||||
input.closest('.unit-self-input').classList.add('input-disabled');
|
||||
form.querySelectorAll('input').forEach((el) => {
|
||||
if (!skipInputs.includes(el.name)) {
|
||||
el.value = '';
|
||||
if (el.closest('.unit-self-input')) {
|
||||
el.disabled = true;
|
||||
el.closest('.unit-self-input').classList.add('input-disabled');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 모든 select 초기화
|
||||
form.querySelectorAll('select').forEach((select) => {
|
||||
select.selectedIndex = 0;
|
||||
});
|
||||
form.querySelectorAll('select').forEach((el) => el.selectedIndex = 0);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 임산물 현황 저장 및 수정
|
||||
const goForestProductSave = () => {
|
||||
const f = document.reqForestProductForm;
|
||||
if (!f) return;
|
||||
|
||||
let dataOj = $(f).serializeObject();
|
||||
console.log("dataOj", dataOj);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/forestProduct/save',
|
||||
JSON.stringify(dataOj),
|
||||
(response) => { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
document.querySelector(".modal-forest-product").ui.close();
|
||||
getForestProductsStatus();
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseJSON[0].defaultMessage);
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
{ handle422Type: 'alert' }
|
||||
);
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
getVisitInfo();
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
if(code == 422) alert(rstData.responseJSON[0].defaultMessage);
|
||||
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
||||
},
|
||||
'post',
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<div class="layer-wrap" th:fragment="tabFragment">
|
||||
<input type="hidden" name="monthlyInputStatusId">
|
||||
|
||||
<div class="tab-content forest-product" data-tab-value="tab2">
|
||||
<div class="content-inner">
|
||||
<section class="table-group">
|
||||
@@ -68,12 +70,15 @@
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("임산물 현황 리스트 조회 : ", response);
|
||||
|
||||
// 임산물 현황 등록 상태 id set
|
||||
f.monthlyInputStatusId.value = response.monthlyStatus.id;
|
||||
const tbody = $('.tab-content.forest-product tbody');
|
||||
|
||||
tbody.empty();
|
||||
|
||||
if(response.forestProducts.length === 0) {
|
||||
noDataMonthly(tbody, response.status, 15);
|
||||
noDataMonthly(tbody, response.monthlyStatus.status, 15);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,9 +168,6 @@
|
||||
<button type="button" class="btn">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<button type="button" class="btn">
|
||||
<span class="btn-txt">인쇄 <i class="ico-print" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user