국제범죄 검거현황 삭제기능 추가.

사용대장 수정삭제버튼 조건 수정.
master
강석 최 2023-03-20 10:46:49 +09:00
parent 552641b6ab
commit f0b5ef064f
8 changed files with 226 additions and 189 deletions

View File

@ -362,7 +362,6 @@ public class EquipController {
useList.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("organList", equipService.selectOrganList(useList));
mav.addObject("info", equipService.selectUseInfo(useList));
mav.addObject("wrtUserSeq", equipService.selectFirstWrtUserSeq(useList));
mav.addObject("userSeq", loginUser.getUserSeq());
//메뉴권한 확인

View File

@ -97,6 +97,10 @@ public class InternationalCrimeArrestController {
internationalCrimeArrest.setWrtUserSeq(loginUser.getUserSeq());
return internationalCrimeArrestService.savedInternationalCrimeArrest(internationalCrimeArrest);
}
@PostMapping("/deleteInternationalCrimeArrest")
public void deleteInternationalCrimeArrest(@RequestBody InternationalCrimeArrest internationalCrimeArrest){
internationalCrimeArrestService.deleteInternationalCrimeArrest(internationalCrimeArrest);
}
@GetMapping("/internationalCrimeArrest/ExcelDown")
public void icaExcelDown(HttpServletResponse response, InternationalCrimeArrest internationalCrimeArrest) {

View File

@ -2,7 +2,13 @@ package com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.repository;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
public interface InternationalCrimeArrestRepository extends JpaRepository<InternationalCrimeArrest, Integer> {
@Modifying(clearAutomatically = true)
@Query("update InternationalCrimeArrest set contentStatus = :contentStatus where icaKey = :icaKey")
void bulkModifyingByIcaKeyToContentStatus(Integer icaKey, String contentStatus);
}

View File

@ -78,4 +78,10 @@ public class InternationalCrimeArrestService extends BaseService {
return icaKey;
}
@Transactional
public void deleteInternationalCrimeArrest(InternationalCrimeArrest internationalCrimeArrest) {
internationalCrimeArrestRepository.bulkModifyingByIcaKeyToContentStatus(internationalCrimeArrest.getIcaKey(), "D");
}
}

View File

@ -616,34 +616,35 @@
<select id="selectUseInfo" resultType="UseList" parameterType="UseList">
select (select item_value from code_mgt where item_cd = mgt_organ) as sosok,
use_type,
mgt_organ,
ul.use_no,
ul.version_no,
use_dt,
(select item_value from code_mgt where item_cd = detail_type) as detail_type_name,
detail_type,
detail_self,
people_cnt,
description,
wrt_dt
use_type,
mgt_organ,
ul.use_no,
ul.version_no,
use_dt,
(select item_value from code_mgt where item_cd = detail_type) as detail_type_name,
detail_type,
detail_self,
people_cnt,
description,
wrt_user_seq,
wrt_dt
from use_list ul,
(select use_no,max(version_no) as lastVer from use_list
(select use_no,max(version_no) as lastVer from use_list
where use_no = #{useNo}
<if test='versionNo != null and versionNo != ""'>
and version_no = #{versionNo}
</if>
and use_type = #{useType}
and mgt_organ = #{mgtOrgan}
group by use_no) b
where ul.use_no = b.use_no
and ul.version_no = b.lastVer
and ul.use_no = #{useNo}
<if test='versionNo != null and versionNo != ""'>
and version_no = #{versionNo}
</if>
and use_type = #{useType}
and mgt_organ = #{mgtOrgan}
<if test='versionNo != null and versionNo != ""'>
and version_no = #{versionNo}
</if>
and use_type = #{useType}
and mgt_organ = #{mgtOrgan}
group by use_no) b
where ul.use_no = b.use_no
and ul.version_no = b.lastVer
and ul.use_no = #{useNo}
<if test='versionNo != null and versionNo != ""'>
and version_no = #{versionNo}
</if>
and use_type = #{useType}
and mgt_organ = #{mgtOrgan}
</select>
<select id="selectUseHistoryList" resultType="UseList" parameterType="UseList">

View File

@ -4,178 +4,179 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.mapper.InternationalCrimeArrestMapper">
<sql id="selectInternationalCrimeArrestListWhere">
<where>
<if test='organ != null and organ != ""'>
AND organ = #{organ}
</if>
<if test='department != null and department != ""'>
AND department = #{department}
</if>
<if test='crimeType != null and crimeType != ""'>
AND crime_type = #{crimeType}
</if>
<if test='violationType != null and violationType != ""'>
AND violation_type = #{violationType}
</if>
<if test='caseNum != null and caseNum != ""'>
AND case_num = #{caseNum}
</if>
<if test='crimeName != null and crimeName != ""'>
AND crime_name LIKE CONCAT('%', #{crimeName}, '%')
</if>
<if test='occurTable != null and occurTable != ""'>
AND occur_table LIKE CONCAT('%', #{occurTable}, '%')
</if>
<if test='arrestTable != null and arrestTable != ""'>
AND arrest_table LIKE CONCAT('%', #{arrestTable}, '%')
</if>
<if test='suspectTable != null and suspectTable != ""'>
AND suspect_table LIKE CONCAT('%', #{suspectTable}, '%')
</if>
<if test='crimeAwarenessDt != null'>
And crime_awareness_dt = #{crimeAwarenessDt}::DATE
</if>
<if test='caseSentDt != null'>
AND case_sent_dt = #{caseSentDt}::DATE
</if>
<if test='processResult != null and processResult != ""'>
AND process_result = #{processResult}
</if>
<if test='dateSelector == "wrtDt"'>
<if test='startDate != null and startDate != ""'>
And wrt_dt >= #{startDate}::DATE
</if>
<if test='endDate != null and endDate != ""'>
AND wrt_dt &lt;= #{endDate}::DATE+1
</if>
</if>
</where>
</sql>
<sql id="selectInternationalCrimeArrestListWhere">
<where>
content_status &lt;> 'D'
<if test='organ != null and organ != ""'>
AND organ = #{organ}
</if>
<if test='department != null and department != ""'>
AND department = #{department}
</if>
<if test='crimeType != null and crimeType != ""'>
AND crime_type = #{crimeType}
</if>
<if test='violationType != null and violationType != ""'>
AND violation_type = #{violationType}
</if>
<if test='caseNum != null and caseNum != ""'>
AND case_num = #{caseNum}
</if>
<if test='crimeName != null and crimeName != ""'>
AND crime_name LIKE CONCAT('%', #{crimeName}, '%')
</if>
<if test='occurTable != null and occurTable != ""'>
AND occur_table LIKE CONCAT('%', #{occurTable}, '%')
</if>
<if test='arrestTable != null and arrestTable != ""'>
AND arrest_table LIKE CONCAT('%', #{arrestTable}, '%')
</if>
<if test='suspectTable != null and suspectTable != ""'>
AND suspect_table LIKE CONCAT('%', #{suspectTable}, '%')
</if>
<if test='crimeAwarenessDt != null'>
And crime_awareness_dt = #{crimeAwarenessDt}::DATE
</if>
<if test='caseSentDt != null'>
AND case_sent_dt = #{caseSentDt}::DATE
</if>
<if test='processResult != null and processResult != ""'>
AND process_result = #{processResult}
</if>
<if test='dateSelector == "wrtDt"'>
<if test='startDate != null and startDate != ""'>
And wrt_dt >= #{startDate}::DATE
</if>
<if test='endDate != null and endDate != ""'>
AND wrt_dt &lt;= #{endDate}::DATE+1
</if>
</if>
</where>
</sql>
<select id="selectInternationalCrimeArrestList" resultType="InternationalCrimeArrest" parameterType="InternationalCrimeArrest">
<select id="selectInternationalCrimeArrestList" resultType="InternationalCrimeArrest" parameterType="InternationalCrimeArrest">
SELECT
i.ica_key,
i.organ,
i.department,
i.crime_type,
i.violation_type,
i.crime_name,
i.smuggling_amount,
i.occur_table,
i.arrest_table,
i.suspect_table,
i.crime_awareness_dt,
i.case_sent_dt,
i.process_result,
i.other_crime,
i.case_num,
i.case_overview,
i.arrest_area,
i.means,
i.crime_form,
i.purpose,
i.smuggled_goods,
i.crackdown_personel,
i.violation_amount,
i.destination,
i.content_status,
i.wrt_organ,
i.wrt_user_seq,
i.wrt_nm,
i.wrt_dt
i.ica_key,
i.organ,
i.department,
i.crime_type,
i.violation_type,
i.crime_name,
i.smuggling_amount,
i.occur_table,
i.arrest_table,
i.suspect_table,
i.crime_awareness_dt,
i.case_sent_dt,
i.process_result,
i.other_crime,
i.case_num,
i.case_overview,
i.arrest_area,
i.means,
i.crime_form,
i.purpose,
i.smuggled_goods,
i.crackdown_personel,
i.violation_amount,
i.destination,
i.content_status,
i.wrt_organ,
i.wrt_user_seq,
i.wrt_nm,
i.wrt_dt
FROM international_crime_arrest i
<include refid="selectInternationalCrimeArrestListWhere"></include>
ORDER BY i.ica_key DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
</select>
</select>
<select id="selectInternationalCrimeArrestListCnt" resultType="int" parameterType="InternationalCrimeArrest">
<select id="selectInternationalCrimeArrestListCnt" resultType="int" parameterType="InternationalCrimeArrest">
SELECT count(*)
FROM international_crime_arrest
<include refid="selectInternationalCrimeArrestListWhere"></include>
</select>
</select>
<select id="selectInternationalCrimeArrestParamList" resultType="com.dbnt.faisp.util.ParamMap" parameterType="InternationalCrimeArrest">
SELECT
i.ica_key,
i.occur_table,
i.arrest_table,
i.suspect_table,
to_char(i.crime_awareness_dt, 'YYYY-MM-DD') as crime_awareness_dt,
to_char(i.case_sent_dt, 'YYYY-MM-DD') as case_sent_dt,
i.other_crime,
i.case_num,
i.case_overview,
i.arrest_area,
i.crackdown_personel,
i.violation_amount,
i.destination,
i.content_status,
i.wrt_organ,
i.wrt_user_seq,
i.wrt_nm,
to_char(i.wrt_dt, 'YYYY-MM-DD HH24:MI') as wrt_dt,
cm1.item_value AS organ,
cm2.item_value AS department,
cm3.item_value AS crime_type,
cm4.item_value AS violation_type,
COALESCE(cm5.item_value, i.process_result) AS process_result,
COALESCE(cm6.item_value, i.means) AS means,
cm7.item_value AS crime_form,
COALESCE(cm8.item_value, i.purpose) AS purpose,
COALESCE(cm9.item_value, i.smuggled_goods) AS smuggled_goods,
concat(cm10.item_value,' ',cm11.item_value,' ',COALESCE(cm12.item_value, s.country)) as personal_information
FROM international_crime_arrest i
INNER JOIN suspect_person_info s
ON i.ica_key = s.ica_key
LEFT JOIn code_mgt cm1 ON i.organ = cm1.item_cd
LEFT JOIN code_mgt cm2 ON i.department = cm2.item_cd
LEFT JOIN code_mgt cm3 ON i.crime_type = cm3.item_cd
LEFT JOIN code_mgt cm4 ON i.violation_type = cm4.item_cd
LEFT JOIN code_mgt cm5 ON i.process_result = cm5.item_cd
LEFT JOIN code_mgt cm6 ON i.means = cm6.item_cd
LEFT JOIN code_mgt cm7 ON i.crime_form = cm7.item_cd
LEFT JOIN code_mgt cm8 ON i.purpose = cm8.item_cd
LEFT JOIN code_mgt cm9 ON i.smuggled_goods = cm9.item_cd
LEFT JOIN code_mgt cm10 ON s.sex = cm10.item_cd
LEFT JOIN code_mgt cm11 ON s.age = cm11.item_cd
LEFT JOIN code_mgt cm12 ON s.country = cm12.item_cd
<include refid="selectInternationalCrimeArrestListWhere"></include>
ORDER BY i.ica_key DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
</select>
<select id="selectInternationalCrimeArrestParamList" resultType="com.dbnt.faisp.util.ParamMap" parameterType="InternationalCrimeArrest">
SELECT
i.ica_key,
i.occur_table,
i.arrest_table,
i.suspect_table,
to_char(i.crime_awareness_dt, 'YYYY-MM-DD') as crime_awareness_dt,
to_char(i.case_sent_dt, 'YYYY-MM-DD') as case_sent_dt,
i.other_crime,
i.case_num,
i.case_overview,
i.arrest_area,
i.crackdown_personel,
i.violation_amount,
i.destination,
i.content_status,
i.wrt_organ,
i.wrt_user_seq,
i.wrt_nm,
to_char(i.wrt_dt, 'YYYY-MM-DD HH24:MI') as wrt_dt,
cm1.item_value AS organ,
cm2.item_value AS department,
cm3.item_value AS crime_type,
cm4.item_value AS violation_type,
COALESCE(cm5.item_value, i.process_result) AS process_result,
COALESCE(cm6.item_value, i.means) AS means,
cm7.item_value AS crime_form,
COALESCE(cm8.item_value, i.purpose) AS purpose,
COALESCE(cm9.item_value, i.smuggled_goods) AS smuggled_goods,
concat(cm10.item_value,' ',cm11.item_value,' ',COALESCE(cm12.item_value, s.country)) as personal_information
FROM international_crime_arrest i
INNER JOIN suspect_person_info s
ON i.ica_key = s.ica_key
LEFT JOIn code_mgt cm1 ON i.organ = cm1.item_cd
LEFT JOIN code_mgt cm2 ON i.department = cm2.item_cd
LEFT JOIN code_mgt cm3 ON i.crime_type = cm3.item_cd
LEFT JOIN code_mgt cm4 ON i.violation_type = cm4.item_cd
LEFT JOIN code_mgt cm5 ON i.process_result = cm5.item_cd
LEFT JOIN code_mgt cm6 ON i.means = cm6.item_cd
LEFT JOIN code_mgt cm7 ON i.crime_form = cm7.item_cd
LEFT JOIN code_mgt cm8 ON i.purpose = cm8.item_cd
LEFT JOIN code_mgt cm9 ON i.smuggled_goods = cm9.item_cd
LEFT JOIN code_mgt cm10 ON s.sex = cm10.item_cd
LEFT JOIN code_mgt cm11 ON s.age = cm11.item_cd
LEFT JOIN code_mgt cm12 ON s.country = cm12.item_cd
<include refid="selectInternationalCrimeArrestListWhere"></include>
ORDER BY i.ica_key DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
</select>
<select id="selectSuspectPersonInfoParamList" resultType="com.dbnt.faisp.util.ParamMap" parameterType="int">
SELECT
s.spi_key,
s.ica_key,
s.sex,
s.age,
s.country,
s.stay_qualification,
s.stay_period_expired_dt,
s.entry_visa
FROM suspect_person_info s
INNER JOIN international_crime_arrest i
ON s.ica_key = i.ica_key
WHERE s.ica_key = #{icaKey}
</select>
<select id="selectSuspectPersonInfoParamList" resultType="com.dbnt.faisp.util.ParamMap" parameterType="int">
SELECT
s.spi_key,
s.ica_key,
s.sex,
s.age,
s.country,
s.stay_qualification,
s.stay_period_expired_dt,
s.entry_visa
FROM suspect_person_info s
INNER JOIN international_crime_arrest i
ON s.ica_key = i.ica_key
WHERE s.ica_key = #{icaKey}
</select>
<select id="icaDuplicateCount" resultType="int" parameterType="InternationalCrimeArrest">
SELECT
COUNT(*)
FROM (
SELECT
s.ica_key
, row_number() OVER (PARTITION BY s.ica_key) AS row
FROM suspect_person_info s
INNER JOIN international_crime_arrest i
ON s.ica_key = i.ica_key
<include refid="selectInternationalCrimeArrestListWhere"></include>
ORDER BY i.ica_key DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
) a
WHERE a.row > 1
</select>
<select id="icaDuplicateCount" resultType="int" parameterType="InternationalCrimeArrest">
SELECT
COUNT(*)
FROM (
SELECT
s.ica_key
, row_number() OVER (PARTITION BY s.ica_key) AS row
FROM suspect_person_info s
INNER JOIN international_crime_arrest i
ON s.ica_key = i.ica_key
<include refid="selectInternationalCrimeArrestListWhere"></include>
ORDER BY i.ica_key DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
) a
WHERE a.row > 1
</select>
</mapper>

View File

@ -20,6 +20,25 @@ $(document).on('click', '#icaEditBtn', function () {
$("#icaViewModal").modal('hide');
getIcaEditModal(Number($("#icaViewBody").find("[name='icaKey']").val()));
});
$(document).on('click', '#icaDeleteBtn', function (){
$.ajax({
type : 'POST',
url : "/faStatistics/deleteInternationalCrimeArrest",
data : JSON.stringify({icaKey: $("#viewModalKey").val()}),
contentType: 'application/json',
beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
},
success : function(result) {
alert("삭제되었습니다.");
location.reload();
},
error : function(xhr, status) {
alert("삭제를 실패하였습니다.")
contentFade("out");
}
})
})
$(document).on('click', '#saveIcaBtn', function (){

View File

@ -5,7 +5,7 @@
<button type="button" class="btn-close f-invert" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="hidden" name="icaKey" th:value="${internationalCrimeArrest.icaKey}">
<input type="hidden" name="icaKey" id="viewModalKey" th:value="${internationalCrimeArrest.icaKey}">
<!-- <div class="row mb-1">
<label class="col-sm-2 col-form-label col-form-label-sm text-center">사건번호</label>
<label class="col-sm-2 col-form-label col-form-label-sm text-start" th:text="${internationalCrimeArrest.caseNum}"></label>
@ -314,6 +314,7 @@
</div>
<div class="modal-footer bg-light">
<th:block th:if="${userSeq eq internationalCrimeArrest.wrtUserSeq or (#lists.contains(mgtOrganList, internationalCrimeArrest.wrtOrgan) and accessAuth eq 'ACC003')}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->
<button type="button" class="btn btn-danger" id="icaDeleteBtn">삭제</button>
<button type="button" class="btn btn-warning" id="icaEditBtn">수정</button>
</th:block>
<!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>-->