주요사건 처리현황 1차

master
DESKTOP-QGC5RJO\DBNT 2023-01-05 15:26:05 +09:00
parent 6e87cf70ea
commit ad417c81d4
12 changed files with 922 additions and 0 deletions

View File

@ -0,0 +1,83 @@
package com.dbnt.faisp.main.ivsgtMgt.majorStatus;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.model.MajorStatus;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.service.MajorStatusService;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import java.time.LocalDateTime;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/ivsgt")
public class MajorStatusController {
private final AuthMgtService authMgtService;
private final MajorStatusService majorStatusService;
@GetMapping("/majorStatusPage")
public ModelAndView majorStatus(@AuthenticationPrincipal UserInfo loginUser, MajorStatus majorStatus){
ModelAndView mav = new ModelAndView("ivsgt/majorStatus/majorStatusPage");
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
mav.addObject("searchParams", majorStatus);
majorStatus.setDownOrganCdList(loginUser.getDownOrganCdList());
majorStatus.setQueryInfo();
mav.addObject("majorList", majorStatusService.selectMajorList(majorStatus));
majorStatus.setContentCnt(majorStatusService.selectMajorListCnt(majorStatus));
majorStatus.setPaginationInfo();
return mav;
}
@GetMapping("/majorEditModal")
public ModelAndView majorEditModal(@AuthenticationPrincipal UserInfo loginUser, MajorStatus majorStatus) {
ModelAndView mav = new ModelAndView("ivsgt/majorStatus/majorStatusEditModal");
if(majorStatus.getMajorKey()!=null){
majorStatus = majorStatusService.selectMajor(majorStatus.getMajorKey());
}else{
majorStatus.setWrtOrgan(loginUser.getOgCd());
majorStatus.setWrtUserNm(loginUser.getUserNm());
majorStatus.setWrtDt(LocalDateTime.now());
}
mav.addObject("majorStatus", majorStatus);
return mav;
}
@GetMapping("/majorViewModal")
public ModelAndView majorViewModal(@AuthenticationPrincipal UserInfo loginUser,MajorStatus majorStatus){
ModelAndView mav = null;
mav = new ModelAndView("ivsgt/majorStatus/majorStatusViewModal");
mav.addObject("userSeq", loginUser.getUserSeq());
mav.addObject("major", majorStatus);
return mav;
}
@PostMapping("/saveContent")
public Integer saveContent (MajorStatus majorStatus,
MultipartHttpServletRequest request,
@RequestParam(value = "fileSeq", required = false) List< Integer > deleteFileSeq){
majorStatus.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
return majorStatusService.saveContent(majorStatus, deleteFileSeq);
}
}

View File

@ -0,0 +1,17 @@
package com.dbnt.faisp.main.ivsgtMgt.majorStatus.mapper;
import com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.model.ArrestType;
import com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.model.RelatedReports;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.model.MajorStatus;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface MajorStatusMapper {
List<MajorStatus> selectMajorList(MajorStatus majorStatus);
List<MajorStatus> selectContentListWhere(MajorStatus majorStatus);
ArrestType selectArrestType(Integer majorKey);
Integer selectMajorListCnt(MajorStatus majorStatus);
List<RelatedReports> selectRelatedReportsList(Integer majorKey);
}

View File

@ -0,0 +1,47 @@
package com.dbnt.faisp.main.ivsgtMgt.majorStatus.model;
import com.dbnt.faisp.config.FileInfo;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "major_file")
@IdClass(MajorFile.MajorFileId.class)
public class MajorFile extends FileInfo {
@Id
@Column(name = "major_key")
private Integer majorKey;
@Id
@Column(name = "file_seq")
private Integer fileSeq;
@Column(name = "orig_nm")
private String origNm;
@Column(name = "conv_nm")
private String convNm;
@Column(name = "file_extn")
private String fileExtn;
@Column(name = "file_size")
private String fileSize;
@Column(name = "save_path")
private String savePath;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class MajorFileId implements Serializable {
private Integer majorKey;
private Integer fileSeq;
}
}

View File

@ -0,0 +1,73 @@
package com.dbnt.faisp.main.ivsgtMgt.majorStatus.model;
import com.dbnt.faisp.config.BaseModel;
import com.dbnt.faisp.main.publicBoard.model.PublicComment;
import com.dbnt.faisp.main.publicBoard.model.PublicFile;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "major_status")
public class MajorStatus extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "major_key")
private Integer majorKey;
@Column(name="major_type")
private String majorType;
@Column(name = "content_title")
private String contentTitle;
@Column(name = "content_info")
private String contentInfo;
@Column(name = "content_status")
private String contentStatus;
@Column(name = "wrt_user_grd")
private String wrtUserGrd;
@Column(name = "wrt_user_nm")
private String wrtUserNm;
@Column(name = "wrt_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime wrtDt;
@Column(name="wrt_organ")
private String wrtOrgan;
@Column(name="wrt_user_seq")
private Integer wrtUserSeq;
@Column(name = "wrt_part")
private String wrtPart;
@Transient
private Integer fileCnt;
@Transient
private Integer commentCnt;
@Transient
private List<MajorFile> fileList;
@Transient
private List<MultipartFile> multipartFileList;
}

View File

@ -0,0 +1,14 @@
package com.dbnt.faisp.main.ivsgtMgt.majorStatus.repository;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.model.MajorFile;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
public interface MajorFileRepository extends JpaRepository<MajorFile, MajorFile.MajorFileId> {
List<MajorFile> findByMajorKey(Integer majorKey);
Optional<MajorFile> findTopByMajorKeyOrderByFileSeq(Integer majorKey);
}

View File

@ -0,0 +1,7 @@
package com.dbnt.faisp.main.ivsgtMgt.majorStatus.repository;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.model.MajorStatus;
import org.springframework.data.jpa.repository.JpaRepository;
public interface MajorStatusRepository extends JpaRepository<MajorStatus, Integer> {
}

View File

@ -0,0 +1,95 @@
package com.dbnt.faisp.main.ivsgtMgt.majorStatus.service;
import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.config.FileInfo;
import com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.model.BoardInvestigation;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.mapper.MajorStatusMapper;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.model.MajorFile;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.model.MajorStatus;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.repository.MajorFileRepository;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.repository.MajorStatusRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.List;
import java.util.UUID;
@Service
@RequiredArgsConstructor
public class MajorStatusService extends BaseService {
private final MajorStatusRepository majorStatusRepository;
private final MajorFileRepository majorFileRepository;
private final MajorStatusMapper majorStatusMapper;
public List<MajorStatus> selectMajorList(MajorStatus majorStatus) {
return majorStatusMapper.selectMajorList(majorStatus);
}
public Integer selectMajorListCnt(MajorStatus majorStatus) {
return majorStatusMapper.selectMajorListCnt(majorStatus);
}
public MajorStatus selectMajor(Integer majorKey) {
MajorStatus savedBoardInvestigation = majorStatusRepository.findById(majorKey).orElse(null);
if (savedBoardInvestigation != null) {
savedBoardInvestigation.setFileList(majorFileRepository.findByMajorKey(majorKey));
// savedBoardInvestigation.setArrestType(majorStatusMapper.selectArrestType(majorKey));
// savedBoardInvestigation.setRelatedReportsList(majorStatusMapper.selectRelatedReportsList(majorKey));
}
return savedBoardInvestigation;
}
@Transactional
public Integer saveContent(MajorStatus majorStatus, List<Integer> deleteFileSeq) {
Integer majorKey = majorStatusRepository.save(majorStatus).getMajorKey();
if(deleteFileSeq!=null && deleteFileSeq.size()>0){
deleteMajorFile(majorKey, deleteFileSeq);
}
if(majorStatus.getMultipartFileList()!= null){
saveUploadFiles(majorKey, majorStatus.getMultipartFileList());
}
return majorKey;
}
private void saveUploadFiles(Integer majorkey, List<MultipartFile> multipartFileList) {
MajorFile lastFileInfo = majorFileRepository.findTopByMajorKeyOrderByFileSeq(majorkey).orElse(null);
int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1);
for(MultipartFile file : multipartFileList){
String saveName = UUID.randomUUID().toString();
String originalFilename = file.getOriginalFilename();
int extnIdx = originalFilename.lastIndexOf(".");
MajorFile fileInfo = new MajorFile();
fileInfo.setMajorKey(majorkey);
fileInfo.setFileSeq(fileSeq++);
fileInfo.setOrigNm(originalFilename.substring(0, extnIdx));
fileInfo.setFileExtn(originalFilename.substring(extnIdx+1));
fileInfo.setConvNm(saveName);
fileInfo.setFileSize(calculationSize(file.getSize()));
majorFileRepository.save(fileInfo);
}
}
private void deleteMajorFile(Integer majorKey, List<Integer> deleteFileSeq) {
List<MajorFile> majorFileList = majorFileRepository.findByMajorKey(majorKey);
for(MajorFile file: majorFileList){
if(deleteFileSeq.contains(file.getFileSeq())){
deleteStoredFile(new File(file.getSavePath(), file.getConvNm()));
majorFileRepository.delete(file);
}
}
}
public FileInfo selectMajorFile(Integer majorKey, Integer fileSeq){
return majorFileRepository.findById(new MajorFile.MajorFileId(majorKey, fileSeq)).orElse(null);
}
}

View File

@ -0,0 +1,63 @@
<?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="com.dbnt.faisp.main.ivsgtMgt.majorStatus.mapper.MajorStatusMapper">
<sql id="selectMajorListWhere">
<where>
<if test='majorType != null and majorType != ""'>
and a.major_type = #{majorType}
</if>
<if test='wrtOrgan != null and wrtOrgan != ""'>
and a.wrt_organ = #{wrtOrgan}
</if>
<if test="contentTitle != null and contentTitle != ''">
AND a.content_title LIKE CONCAT('%', #{content_title}, '%')
</if>
<if test="wrtUserNm != null and wrtUserNm != ''">
AND a.wrt_user_nm LIKE CONCAT('%', #{wrtUserNm}, '%')
</if>
<if test='startDate != null and startDate != ""'>
and a.wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and a.wrt_dt &lt;= #{endDate}::date+1
</if>
and a.wrt_organ in
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
#{organCd}
</foreach>
</where>
</sql>
<select id="selectMajorList" resultType="MajorStatus" parameterType="MajorStatus">
select a.major_key,
a.major_type,
a.content_title,
a.content_info,
a.content_status,
a.wrt_user_grd,
a.wrt_user_nm,
a.wrt_dt,
a.wrt_organ,
wrt_user_seq,
wrt_part
from major_status a
<include refid="selectMajorListWhere"></include>
order by major_key desc
limit #{rowCnt} offset #{firstIndex}
</select>
<select id="selectMajorListCnt" resultType="int" parameterType="MajorStatus">
select count(*)
from major_status a
<include refid="selectMajorListWhere"></include>
</select>
</mapper>

View File

@ -0,0 +1,196 @@
$(function(){
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
})
// $(document).on('click', '#commentSaveBtn', function (){
// if(!$("#comment").val()) {
// alert("댓글을 입력해주세요.")
// }else{
// if (confirm("등록하시겠습니까?")) {
// contentFade("in")
// const formData = new FormData($("#commentForm")[0]);
// $.ajax({
// type : 'POST',
// data : formData,
// url : "/publicBoard/saveComment",
// processData: false,
// contentType: false,
// dataType:"html",
// beforeSend: function (xhr){
// xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
// },
// success : function(html) {
// const parentComment = $("#parentComment");
// if(!parentComment.val()){
// $("#commentDiv").append(html)
// }else{
// $("#childComment"+parentComment.val()).append(html);
// }
// commentFormReset();
// alert("저장되었습니다.");
// contentFade("out");
// },
// error : function(xhr, status) {
// alert("저장에 실패하였습니다.")
// contentFade("out");
// }
// })
// }
// }
// })
// $(document).on('click', '.childCommentBtn', function (){
// const childCommentFormDiv = $(this).parents(".commentRow").find(".childCommentFormDiv")
// childCommentFormDiv.show();
// $("#parentComment").val($(this).parents(".commentRow").find(".commentKey").val());
// $("#childFormRemoveBtn").show();
// childCommentFormDiv.empty().append($("#commentForm"))
// })
// $(document).on('click', '#childFormRemoveBtn', function (){
// commentFormReset();
// })
// $(document).on('click', '.deleteCommentBtn', function (){
// const commentRow = $(this).parents(".commentRow");
// const publicKey = Number(commentRow.find(".publicKey").val());
// const commentKey = Number(commentRow.find(".commentKey").val());
// $.ajax({
// type : 'POST',
// data : JSON.stringify({publicKey: publicKey, commentKey: commentKey}),
// url : "/publicBoard/deleteComment",
// contentType: 'application/json',
// beforeSend: function (xhr){
// xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
// },
// success : function(result) {
// commentRow.remove();
// $("#childComment"+commentKey).remove();
// alert("삭제되었습니다.");
// contentFade("out");
// },
// error : function(xhr, status) {
// alert("삭제를 실패하였습니다.")
// contentFade("out");
// }
// })
// })
function getEditModal(majorKey, majorType){
$.ajax({
url: '/ivsgt/majorEditModal',
data: {majorKey: majorKey, majorType:majorType},
type: 'GET',
dataType:"html",
success: function(html){
$("#editContent").empty().append(html)
setUploadDiv();
setEditor('editor', '570');
$("#majorEditModal").modal('show');
},
error:function(){
}
});
}
function getViewModal(majorKey, majorType){
$.ajax({
url: '/ivsgt/majorViewModal',
data: {majorKey: majorKey, majorType: majorType},
type: 'GET',
dataType:"html",
success: function(html){
$("#viewContent").empty().append(html)
$("#majorViewModal").modal('show');
},
error:function(){
}
});
}
function saveContent(formId, majorType){
if(contentCheck(formId)){
if(confirm("저장하시겠습니까?")){
contentFade("in");
$("#content").val("");
const formData = new FormData($("#"+formId)[0]);
for(const file of files) {
if(!file.isDelete)
formData.append('uploadFiles', file, file.name);
}
$(".text-decoration-line-through").each(function (idx, el){
formData.append('fileSeq', $(el).attr("data-fileseq"));
})
formData.append('content', CrossEditor.GetBodyValue());
$.ajax({
type : 'POST',
data : formData,
url : "/ivsgt/saveContent",
processData: false,
contentType: false,
success : function(result) {
alert("저장되었습니다.");
contentFade("out");
$("#editModal").modal('hide');
getViewModal(result, majorType);
},
error : function(xhr, status) {
alert("저장에 실패하였습니다.")
contentFade("out");
}
})
}
}
}
function contentCheck(formId){
let flag = true;
if(!$("#title").val()){
alert("제목을 입력해주세요.")
flag = false;
}
if($("#majorType").val()==="PLB003"){
if(!$("#tabStatus").val()){
alert("분류를 선택해주세요.")
flag = false;
}
}
flag = fileCheck(flag, files);
return flag;
}
function commentFormReset(){
const commentForm = $("#commentForm");
commentForm[0].reset();
$("#childFormRemoveBtn").hide();
$("#parentComment").val('');
$("#commentFormHome").append(commentForm)
}
$(document).on('click', '#addMajorBtn', function (){
getEditModal(null)
})
$(document).on('click', '.planTr', function (){
$(".trChkBox").prop("checked", false);
$(this).find(".trChkBox").prop("checked", true);
getViewModal(Number($(this).find(".planKey").val()));
})
$(document).on('click', '#saveBtn', function (){
savePublicBoard("boardEditForm")
})
$(document).on('click', '#editBtn', function (){
$("#MajorStatusViewModal").modal('hide')
getEditModal($(this).attr("data-ciwkey"));
})

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header bg-dark">
<h5 class="modal-title text-white" id="MajorEditModalLabel" th:text="${majorStatus.majorKey eq null?'주요사건 작성':'주요사건 수정'}"></h5>
<button type="button" class="btn-close f-invert" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="MajorEditBody">
<form action="#" method="post" id="boardEditForm">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<!--<input type="hidden" name="majorKey" th:value="${majorStatus.majorKey}">
<input type="hidden" name="majorType" th:value="${majorStatus.majorType}">
<input type="hidden" name="wrtOrgan" th:value="${majorStatus.wrtOrgan}">
<input type="hidden" name="wrtPart" th:value="${majorStatus.wrtPart}">
<input type="hidden" name="wrtUserSeq" th:value="${majorStatus.wrtUserSeq}">
<input type="hidden" name="wrtUserGrd" th:value="${majorStatus.wrtUserGrd}">
<input type="hidden" name="wrtUserNm" th:value="${majorStatus.wrtUserNm}">-->
<div class="row mb-1">
<label for="wrtUserNm" class="col-sm-2 col-form-label text-center">작성자</label>
<div class="col-sm-2">
<th:block th:each="commonCode:${session.commonCode.get('JT')}">
<th:block th:if="${commonCode.itemCd eq majorStatus.wrtUserGrd}">
<input type="text" class="form-control" id="wrtUserNm" th:value="|${commonCode.itemValue} ${majorStatus.wrtUserNm}|" readonly>
</th:block>
</th:block>
</div>
<label for="wrtDt" class="col-sm-2 col-form-label text-center">작성일시</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="wrtDt" name="wrtDt" th:value="${#temporals.format(majorStatus.wrtDt, 'yyyy-MM-dd HH:mm')}" readonly>
</div>
<!-- <div class="col-sm-auto my-auto">-->
<!-- <input type="checkbox" id="organChk" name="organChk" value="T" th:checked="${major.organChk eq 'T'}">-->
<!-- </div>-->
<!-- <label for="organChk" class="col-sm-3 col-form-label text-left">소속관서에만 노출</label>-->
</div>
<div class="row mb-1">
<label for="title" class="col-sm-2 col-form-label text-center">제목</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="title" name="title" th:value="${majorStatus.contentTitle}" autocomplete="off">
</div>
</div>
<div class="row mb-1 justify-content-center">
<label for="content" class="col-sm-2 col-form-label text-center">내용</label>
<div class="col-sm-10">
<div id="editor"></div>
<textarea id="content" class="d-none" th:utext="${majorStatus.contentInfo}"></textarea>
</div>
</div>
<div class="row mb-3">
<label for="fileInputer" class="col-sm-2 col-form-label text-center">첨부파일</label>
<div class="col-sm-10" style="min-height: 70px;">
<div class="w-100 h-100 border border-info rounded text-center" id="uploadDiv">
<th:block th:if="${#arrays.isEmpty(majorStatus.fileList)}">
<br>파일을 업로드 해주세요.
</th:block>
<!-- <th:block th:unless="${#arrays.isEmpty(majorStatus.fileList)}">-->
<!-- <div class='row-col-6' th:each="infoFile:${majorStatus.fileList}">-->
<!-- <span th:data-fileseq="${majorFile.fileSeq}" th:text="|${majorFile.origNm}.${majorFile.fileExtn} ${majorFile.fileSize}|"></span>-->
<!-- <a href='#' class='uploadedFileDelete text-danger text-decoration-none'>삭제</a>-->
<!-- </div>-->
<!-- </th:block>-->
</div>
</div>
<input type="file" class="d-none" id="fileInputer" multiple>
</div>
</form>
</div>
<div class="modal-footer bg-light">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
<button type="button" class="btn btn-primary" id="saveBtn">저장</button>
</div>

View File

@ -0,0 +1,156 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/layout}">
<th:block layout:fragment="script">
<script type="text/javascript" th:src="@{/js/ivsgt/majorStatus.js}"></script>
</th:block>
<div layout:fragment="content">
<main>
<h4>주요사건처리현황</h4>
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<div class="row mx-0">
<div class="col-12 card bg-light text-center">
<div class="card-body">
<form method="get" th:action="@{/ivsgt/majorStatusPage}">
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
<div class="row justify-content-between py-1">
<div class="col-auto">
<select class="form-select form-select-sm" name="rowCnt" id="rowCnt">
<th:block th:each="num : ${#numbers.sequence(1,5)}">
<option th:value="${num*10}" th:text="${num*10}" th:selected="${searchParams.rowCnt eq num*10}"></option>
</th:block>
</select>
</div>
<div class="col-auto">
<div class="row justify-content-end">
<div class="col-auto">
<select class="form-select form-select-sm" name="wrtOrgan">
<option value="">관서 선택</option>
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.wrtOrgan}"></option>
</th:block>
</th:block>
</select>
</div>
<div class="col-auto">
<input type="text" class="form-control form-control-sm" placeholder="작성자" name="wrtUserNm" th:value="${searchParams.wrtUserNm}">
</div>
<div class="col-auto">
<input type="text" class="form-control form-control-sm" placeholder="제목" name="title" th:value="${searchParams.contentTitle}">
</div>
<div class="col-4">
<div class="input-group w-auto input-daterange" id="dateSelectorDiv">
<input type="text" class="form-control form-control-sm" id="startDate" name="startDate" placeholder="시작일" autocomplete="off" readonly th:value="${searchParams.startDate}">
<input type="text" class="form-control form-control-sm" id="endDate" name="endDate" placeholder="종료일" autocomplete="off" readonly th:value="${searchParams.endDate}">
</div>
</div>
<div class="col-1 d-grid gap-0">
<input type="submit" class="btn btn-sm btn-primary" id="searchBtn" value="검색">
</div>
</div>
</div>
</div>
</form>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12">
<table class="table table-sm table-hover table-bordered">
<thead>
<tr class="table-secondary">
<th></th>
<th>종류</th>
<th>제목</th>
<th>관서</th>
<th>부서</th>
<th>계급</th>
<th>작성자</th>
<th>작성일시</th>
<th>첨부파일</th>
</tr>
</thead>
<tbody class="table-group-divider">
<tr class="" th:each="major:${majorList}">
<input type="hidden" class="majorKey" th:value="${major.majorKey}">
<td><input type="checkbox" class="trChkBox"></td>
<td th:test="${major.majorType}"></td>
<td th:text="${major.contentTitle}"></td>
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<td th:if="${major.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
</th:block>
<th:block th:each="commonCode:${session.commonCode.get('OFC')}">
<td th:if="${major.wrtPart eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
</th:block>
<th:block th:each="commonCode:${session.commonCode.get('JT')}">
<td th:if="${major.wrtUserGrd eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
</th:block>
<td th:text="${major.wrtUserNm}"></td>
<td th:text="${#temporals.format(major.wrtDt, 'yyyy-MM-dd HH:mm')}"></td>
<td th:text="${major.fileCnt eq null?'파일 없음':#strings.concat(major.fileCnt,' 건')}"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row justify-content-between">
<div class="col-auto"></div>
<div class="col-auto">
<nav aria-label="Page navigation">
<ul class="pagination mb-0">
<th:block th:if="${searchParams.pageIndex>3}">
<li class="page-item" th:data-pageindex="${(searchParams.pageIndex)-3}">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
</th:block>
<th:block th:each="num : ${#numbers.sequence(searchParams.startNum, searchParams.endNum)}">
<li class="page-item" th:data-pageindex="${num}" th:classappend="${searchParams.pageIndex eq num?'active':''}">
<a class="page-link" href="#" th:text="${num}"></a>
</li>
</th:block>
<th:block th:if="${searchParams.maxNum>searchParams.endNum+2}">
<li class="page-item" th:data-pageindex="${(searchParams.pageIndex)+3}">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</th:block>
</ul>
</nav>
</div>
<div class="col-auto">
<input type="button" class="btn btn-success" value="등록" id="addMajorBtn" sec:authorize="hasRole('ROLE_SUB_ADMIN')">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<div class="modal fade" id="MajorEditModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="MajorEditModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content" id="editContent">
</div>
</div>
</div>
<div class="modal fade" id="MajorViewModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="MajorViewModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content" id="viewContent">
</div>
</div>
</div>
</div>
</html>

View File

@ -0,0 +1,100 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header bg-dark">
<h5 class="modal-title text-white" id="publicViewModalLabel">주요사건처리현황 열람</h5>
<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="publicKeyKey" id="viewModalPublicKey" th:value="${major.majorKey}">
<ul class="nav nav-tabs" id="userTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="boardTab" data-bs-toggle="tab" data-bs-target="#boardTabPanel" type="button" role="tab" aria-controls="boardTabPanel" aria-selected="true">본문</button>
</li>
<li class="nav-item" role="presentation" th:if="${#lists.size(major.fileList)>0}">
<button class="nav-link" id="fileTab" data-bs-toggle="tab" data-bs-target="#fileTabPanel" type="button" role="tab" aria-controls="fileTabPanel" aria-selected="false" th:text="${#strings.concat('첨부파일(', #lists.size(major.fileList), ')')}"></button>
</li>
</ul>
<div class="tab-content bg-white border border-top-0 p-2">
<div class="tab-pane fade p-2 show active" id="boardTabPanel" role="tabpanel" tabindex="0">
<div class="row mb-1">
<div class="col-sm-9"></div>
<label class="col-sm-1 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="${#temporals.format(major.wrtDt, 'yyyy-MM-dd HH:mm')}"></label>
<label class="col-sm-1 col-form-label col-form-label-sm text-center">제목</label>
<label class="col-sm-8 col-form-label col-form-label-sm text-start" th:text="${major.title}"></label>
<label class="col-sm-1 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:block th:each="commonCode:${session.commonCode.get('OG')}">
<th:block th:if="${commonCode.itemCd eq major.wrtOrgan}" th:text="${commonCode.itemValue}"></th:block>
</th:block>
<th:block th:each="commonCode:${session.commonCode.get('JT')}">
<th:block th:if="${commonCode.itemCd eq major.wrtUserGrd}" th:text="${commonCode.itemValue}"></th:block>
</th:block>
<th:block th:text="${major.wrtUserNm}"></th:block>
</label>
<hr class="my-1">
<label for="content" class="col-sm-1 col-form-label col-form-label-sm text-center">내용</label>
<div class="col-sm-10 form-control-sm">
<div id="content" th:utext="${major.content}"></div>
</div>
</div>
</div>
<div class="tab-pane fade p-2" id="fileTabPanel" role="tabpanel" tabindex="0">
<div class="row">
<div class="col-12">
<table class="table table-sm">
<thead>
<tr>
<th>파일명</th>
<th>사이즈</th>
</tr>
</thead>
<tbody>
<th:block th:if="${#lists.isEmpty(major.fileList)}">
<tr>
<td colspan="2">파일이 없습니다.</td>
</tr>
</th:block>
<th:block th:unless="${#lists.isEmpty(major.fileList)}">
<th:block th:each="file:${major.fileList}">
<tr class="fileInfoTr">
<td><a href="#" class="fileDownLink" data-board="publicFile"
th:data-parentkey="${file.publicKey}" th:data-fileseq="${file.fileSeq}" th:text="|${file.origNm}.${file.fileExtn}|"></a></td>
<td th:text="${file.fileSize}"></td>
</tr>
</th:block>
</th:block>
</tbody>
</table>
</div>
</div>
</div>
<hr class="my-1">
<div class="row justify-content-start">
<div class="col-12 mx-3" id="commentFormHome">
<form action="#" method="post" id="commentForm">
<div class="row">
<div class="col-11">
<input type="hidden" name="publicKey" th:value="${major.majorKey}">
<input type="hidden" name="parentComment" id="parentComment">
<input type="text" class=" form-control form-control-sm" id="comment" name="comment" placeholder="댓글작성">
</div>
<div class="col-1 d-grid gap-0">
<div class="input-group">
<input type="button" class="btn btn-sm btn-primary" id="commentSaveBtn" value="작성">
<input type="button" class="btn btn-sm btn-warning" id="childFormRemoveBtn" value="취소" style="display: none">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal-footer bg-light">
<th:block th:if="${userSeq eq major.wrtUserSeq}"><!--작성자일 경우 수정 허용-->
<button type="button" class="btn btn-warning" id="editBtn">수정</button>
</th:block>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
</div>