[BO] 임가현황 - 임산물현황 작업

This commit is contained in:
kangsunlee
2025-06-26 19:02:09 +09:00
parent eda81b0bfa
commit d923c3352f
42 changed files with 663 additions and 24 deletions

View File

@@ -0,0 +1,25 @@
<?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.removeForestProducts.adapters.persistence.RemoveForestProductsMapper">
<update id="removeForestProducts">
/* removeForestProducts : 임산물현황 삭제*/
UPDATE forest_product
SET <include refid="common.fields.DeleteBaseSet"/>
WHERE id IN
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="existsForestProduct" resultType="boolean">
/* existsForestProduct : 임산물현황 존재 여부 */
SELECT EXISTS (
SELECT 1
FROM forest_product
WHERE is_deleted = false
AND monthly_input_status_id = #{monthlyInputStatusId}
)
</select>
</mapper>

View File

@@ -3,13 +3,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.admin.usecase.household.tab.householdVisit.removeHouseholdVisitInfos.adapters.persistence.RemoveHouseholdVisitInfosMapper">
<update id="removeHouseholdVisitInfos">
/* removeHouseholdVisitInfos : 임가방문정보 삭제 */
UPDATE household_visit
SET <include refid="common.fields.DeleteBaseSet"/>
WHERE id IN
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="removeHouseholdVisitInfos">
/* removeHouseholdVisitInfos : 임가방문정보 삭제 */
UPDATE household_visit
SET <include refid="common.fields.DeleteBaseSet"/>
WHERE id IN
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@@ -3,6 +3,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.persistence.SaveForestProductMapper">
<select id="getForestProductStatus" resultType="java.lang.String">
/* getForestProductStatus : 임산물 현황 입력상태 조회 */
SELECT forest_product_status
FROM monthly_input_status
WHERE id = #{monthlyInputStatusId}
</select>
<insert id="createForestProduct">
/* createForestProduct : 임산물 현황 등록 */
INSERT INTO forest_product

View File

@@ -0,0 +1,13 @@
<?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.updateForestProductNone.adapters.persistence.UpdateForestProductNoneMapper">
<update id="removeForestProduct">
/* removeForestProduct : 임산물 현황 삭제 */
UPDATE forest_product
SET <include refid="common.fields.DeleteBaseSet" />
WHERE is_deleted = false
AND monthly_input_status_id = #{monthlyInputStatusId}
</update>
</mapper>

View File

@@ -0,0 +1,14 @@
<?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.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper">
<update id="updateForestProductStatus">
/* updateForestProductStatus : 임산물현황 입력상태 수정 */
UPDATE monthly_input_status
SET forest_product_status = #{status},
<include refid="common.fields.UpdateBaseSet"/>
WHERE is_deleted = false
AND id = #{id}
</update>
</mapper>

View File

@@ -19,3 +19,4 @@ operation.uri.move.cannot.before=\uB354\uC774\uC0C1 \uC774\uC804\uC73C\uB85C \uC
operation.uri.move.cannot.after=\uB354\uC774\uC0C1 \uB2E4\uC74C\uC73C\uB85C \uC774\uB3D9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
operation.role.save.choose.first=\uC800\uC7A5\uD560 '\uAD00\uB9AC\uC790 \uAD8C\uD55C' \uC744 \uBA3C\uC800 \uC120\uD0DD\uD558\uC138\uC694.
operation.orderNo.updated=\uC815\uB82C\uC21C\uC11C\uAC00 \uBCC0\uACBD\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
operation.common.update.done=\uC218\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4.

View File

@@ -25,6 +25,7 @@
<meta property="og:description" th:content="${currentURI.ogDesc}" th:if="${currentURI != null}"/>
<meta property="og:keywords" th:content="${currentURI.ogKeywords}" th:if="${currentURI != null}"/>
<meta property="og:image" th:content="${currentURI.ogImage}" th:if="${currentURI != null}"/>
<meta name="robots" content="noindex, nofollow" th:if="${@environment.getProperty('spring.profiles.active') != 'prod'}">
<!-- 부트스트랩 css 숨김 처리 -->
<!-- <link rel="stylesheet" th:href="@{/static/library/bootstrap/bootstrap.min.css}"/>-->

View File

@@ -364,7 +364,7 @@
ajaxUtil._ajaxMethod(
'/api/forestProduct/save',
JSON.stringify(dataOj),
(response) => { // 성공
() => { // 성공
alert("등록이 완료되었습니다.");
document.querySelector(".modal-forest-product").ui.close();

View File

@@ -13,12 +13,19 @@
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn small">
<span class="btn-txt">등록여부</span>
<span class="btn-txt">
<label class="radio-inner">
<span class="radio-item">
<span class="radio-txt">이번달 등록내용 없음</span>
</span>
<input type="checkbox" id="forestProductStatus" data-step="FOREST_PRODUCT" onclick="showForestProductNoneConfirm(this);">
</label>
</span>
</button>
<button type="button" class="btn small btn-secondary">
<button type="button" class="btn small btn-secondary" style="display: none;" onclick="showDeleteForestProductConfirm();">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary" onclick="showForestProductModal();">
<button type="button" class="btn small btn-primary" style="display: none;" onclick="showForestProductModal();">
<span class="btn-txt">추가</span>
</button>
</div>
@@ -73,8 +80,14 @@
// 임산물 현황 등록 상태 id set
f.monthlyInputStatusId.value = response.monthlyStatus.id;
const tbody = $('.tab-content.forest-product tbody');
// 이번달 등록내용 없음 체크 - NONE : 미등록, NOTHING : 이번달 등록내용 없음 , REGISTERED : 등록완료
$('#forestProductStatus').attr('checked', response.monthlyStatus.forestStatus === 'NOTHING');
// 이번달 등록내용 없음 에 따라 버튼 hide 처리
showForestProductNoneBtn();
const tbody = $('.tab-content.forest-product tbody');
tbody.empty();
if(response.forestProducts.length === 0) {
@@ -90,7 +103,7 @@
<td>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
<input type="checkbox" id="forestRemoveIds_${item.id}" name="forestRemoveIds" value="${item.id}">
</label>
</div>
</td>
@@ -123,6 +136,124 @@
'json'
);
}
// 금일 데이터 없음에 따라 버튼 hide/show 처리
const showForestProductNoneBtn = () => {
$('.table-tit-group').each(function(index, item) {
let checkedIndex = false;
$(item).find('[type="button"]').each(function(indexBtn, itemBtn) {
let $chkBox = $(itemBtn).find('input[type="checkbox"]');
if (($chkBox.length !== 0 && $chkBox.is(':disabled'))) {
checkedIndex = true;
}
if (checkedIndex) {
$(itemBtn).hide();
} else {
$(itemBtn).show();
}
if ($chkBox.length !== 0) {
checkedIndex = $chkBox.is(':checked') || $chkBox.is(':disabled');
}
});
});
}
// 데이터 초기화 Confirm
const showForestProductNoneConfirm = (el) => {
const todayNone = $(el).is(':checked') ? 'Y' : 'N';
const obj = $(f).serializeObject();
obj.todayNone = todayNone;
if (todayNone === 'Y') {
etUI.dialog.confirm({
title: '초기화 안내',
message: '등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
negativeCallback: function () {
$(el).prop('checked', todayNone !== 'Y');
},
positiveCallback: function () {
updateForestProductNone(obj);
},
});
} else {
updateForestProductNone(obj);
}
}
// 이번달 등록내용 없음 수정 처리
const updateForestProductNone = (obj) => {
console.log(obj);
ajaxUtil._ajaxMethod(
'/api/household/forestProduct/nothing',
JSON.stringify(obj),
() => {
if (obj.todayNone === 'Y') {
alert('데이터 초기화가 완료되었습니다.');
} else {
alert('등록 상태가 변경되었습니다.');
}
getForestProductsStatus();
},
function (code, rstData) {
},
'patch',
'json',
{ handle422Type: 'alert' }
);
}
// 임산물현황 삭제 Confirm
const showDeleteForestProductConfirm = () => {
const checkedIds = Array.from(
document.querySelectorAll('input[name="forestRemoveIds"]:checked')
).map(el => Number(el.value));
if(checkedIds.length <= 0) {
alert("임산물을 선택해주세요.");
return
}
etUI.dialog.confirm({
title: '삭제 안내',
message: '선택하신 내용을 삭제하시겠습니까?<br>삭제한 항목은 복구할 수 없습니다.',
negativeCallback: function () {
},
positiveCallback: function () {
goDeleteForestProduct(checkedIds);
},
});
}
// 임산물현황 삭제
const goDeleteForestProduct = (checkedIds) => {
const f = document.reqForm;
console.log("f.monthlyInputStatusId.value", f.monthlyInputStatusId.value);
ajaxUtil._ajaxMethod(
'/api/household/forestProducts/delete',
JSON.stringify({
monthlyInputStatusId: f.monthlyInputStatusId.value,
forestRemoveIds: checkedIds
}),
() => { // 성공
alert("임산물현황이 삭제되었습니다.");
getForestProductsStatus();
},
function (code, rstData) {
if(code == 422) alert(rstData.responseText);
},
'delete',
'json',
{ handle422Type: 'alert' }
);
}
</script>
</div>
</html>