사용대장 작업중.

master
강석 최 2023-03-30 18:13:31 +09:00
parent a414fd0d90
commit f6c4914d77
14 changed files with 368 additions and 431 deletions

View File

@ -295,18 +295,18 @@ public class EquipController {
}
@GetMapping("/pvreUseList")
public ModelAndView pvreUseList(@AuthenticationPrincipal UserInfo loginUser,UseList useList,HttpServletResponse response) {
public ModelAndView pvreUseList(@AuthenticationPrincipal UserInfo loginUser, UseInfo useInfo, HttpServletResponse response) {
ModelAndView mav = new ModelAndView("equip/pvreUseList");
useList.setDownOrganCdList(loginUser.getDownOrganCdList());
useList.setUseType("PVRE");
useInfo.setDownOrganCdList(loginUser.getDownOrganCdList());
useInfo.setUseType("PVRE");
//엑셀다운
if(useList.getExcel() != null && useList.getExcel().equals("Y")){
String[] headers = { "use_no", "sosok", "use_dt", "detail_type_name", "people_cnt", "description", "wrt_dt"};
String[] headerNames = { "연번", "경찰서","사용일시", "사용사유", "사용인원", "비고", "최종수정일"};
if(useInfo.getExcel() != null && useInfo.getExcel().equals("Y")){
String[] headers = { "use_no", "sosok", "buseo","use_dt", "detail_type_name", "people_cnt", "description", "wrt_dt"};
String[] headerNames = { "연번", "경찰서", "부서", "사용일시", "사용사유", "사용인원", "비고", "최종수정일"};
String[] columnType = { "String", "String","String", "String", "int", "String", "String"};
String sheetName = "휴대용 녹화장비 사용 대장";
String excelFileName = "휴대용 녹화장비 사용 대장";
List<UseList> useExcelList= equipService.selectUseList(useList);
List<UseInfo> useExcelList= equipService.selectUseInfoList(useInfo);
try {
Utils.useListToExcel(useExcelList, response, headers, headerNames, columnType, sheetName, excelFileName);
@ -318,28 +318,27 @@ public class EquipController {
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/pvreUseList").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
useList.setQueryInfo();
mav.addObject("useList", equipService.selectUseList(useList));
useList.setContentCnt(equipService.selectUseListCnt(useList));
useList.setPaginationInfo();
mav.addObject("organList", equipService.selectOrganList(useList));
mav.addObject("searchParams", useList);
useInfo.setQueryInfo();
mav.addObject("useList", equipService.selectUseInfoList(useInfo));
useInfo.setContentCnt(equipService.selectUseInfoListCnt(useInfo));
useInfo.setPaginationInfo();
mav.addObject("organList", equipService.selectOrganList(useInfo));
mav.addObject("searchParams", useInfo);
return mav;
}
@GetMapping("/useEditModal")
public ModelAndView useEditModal(@AuthenticationPrincipal UserInfo loginUser,UseList useList) {
public ModelAndView useEditModal(@AuthenticationPrincipal UserInfo loginUser, UseInfo useInfo) {
ModelAndView mav = new ModelAndView("equip/useEditModal");
useList.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("organList", equipService.selectOrganList(useList));
mav.addObject("userOrgan", loginUser.getOgCd());
mav.addObject("useType", useList.getUseType());
useInfo.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("downOrganList", loginUser.getDownOrganCdList());
mav.addObject("useType", useInfo.getUseType());
//메뉴권한 확인
String accessAuth;
if(useList.getUseType().equals("PVRE")) {
if(useInfo.getUseType().equals("PVRE")) {
accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/pvreUseList").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
}else if(useList.getUseType().equals("QIR")) {
}else if(useInfo.getUseType().equals("QIR")) {
accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/qirUseList").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
}
@ -347,30 +346,31 @@ public class EquipController {
}
@PostMapping("/saveUse")
public void saveUse(@AuthenticationPrincipal UserInfo loginUser,UseList useList){
useList.setWrtOrgan(loginUser.getOgCd());
useList.setWrtPart(loginUser.getOfcCd());
useList.setWrtTitle(loginUser.getTitleCd());
useList.setWrtUserSeq(loginUser.getUserSeq());
useList.setWrtNm(loginUser.getUserNm());
useList.setWrtDt(LocalDateTime.now());
equipService.saveUse(useList);
public void saveUseInfo(@AuthenticationPrincipal UserInfo loginUser, UseInfo useInfo){
useInfo.setIsDeleted("N");
useInfo.setWrtOrgan(loginUser.getOgCd());
useInfo.setWrtPart(loginUser.getOfcCd());
useInfo.setWrtUserGrd(loginUser.getTitleCd());
useInfo.setWrtUserSeq(loginUser.getUserSeq());
useInfo.setWrtUserNm(loginUser.getUserNm());
useInfo.setWrtDt(LocalDateTime.now());
equipService.saveUseInfo(useInfo);
}
@GetMapping("/useModifyModal")
public ModelAndView useModifyModal(@AuthenticationPrincipal UserInfo loginUser,UseList useList) {
public ModelAndView useModifyModal(@AuthenticationPrincipal UserInfo loginUser, UseInfo useInfo) {
ModelAndView mav = new ModelAndView("equip/useModifyModal");
useList.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("organList", equipService.selectOrganList(useList));
mav.addObject("info", equipService.selectUseInfo(useList));
useInfo.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("organList", equipService.selectOrganList(useInfo));
mav.addObject("info", equipService.selectUseInfo(useInfo));
mav.addObject("userSeq", loginUser.getUserSeq());
//메뉴권한 확인
String accessAuth;
if(useList.getUseType().equals("PVRE")) {
if(useInfo.getUseType().equals("PVRE")) {
accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/pvreUseList").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
}else if(useList.getUseType().equals("QIR")) {
}else if(useInfo.getUseType().equals("QIR")) {
accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/qirUseList").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
}
@ -378,47 +378,47 @@ public class EquipController {
}
@PostMapping("/updateUse")
public UseList uadateUse(@AuthenticationPrincipal UserInfo loginUser,UseList useList){
useList.setWrtOrgan(loginUser.getOgCd());
useList.setWrtPart(loginUser.getOfcCd());
useList.setWrtTitle(loginUser.getTitleCd());
useList.setWrtUserSeq(loginUser.getUserSeq());
useList.setWrtNm(loginUser.getUserNm());
useList.setWrtDt(LocalDateTime.now());
return equipService.updateUse(useList);
public UseInfo uadateUse(@AuthenticationPrincipal UserInfo loginUser, UseInfo useInfo){
useInfo.setWrtOrgan(loginUser.getOgCd());
useInfo.setWrtPart(loginUser.getOfcCd());
useInfo.setWrtUserGrd(loginUser.getTitleCd());
useInfo.setWrtUserSeq(loginUser.getUserSeq());
useInfo.setWrtUserNm(loginUser.getUserNm());
useInfo.setWrtDt(LocalDateTime.now());
return equipService.updateUse(useInfo);
}
@GetMapping("/useHistory")
public ModelAndView useHistory(@AuthenticationPrincipal UserInfo loginUser,UseList useList) {
public ModelAndView useHistory(@AuthenticationPrincipal UserInfo loginUser, UseInfo useInfo) {
ModelAndView mav = new ModelAndView("equip/useHistory");
mav.addObject("infoList", equipService.selectUseHistoryList(useList));
mav.addObject("infoList", equipService.selectUseHistoryList(useInfo));
return mav;
}
@GetMapping("/HistoryView")
@ResponseBody
public UseList HistoryView(UseList useList){
return equipService.selectUseInfo(useList);
public UseInfo HistoryView(UseInfo useInfo){
return equipService.selectUseInfo(useInfo);
}
@PostMapping("/useDelete")
public void useDelete(@RequestBody List<UseList> useList){
equipService.useDelete(useList);
public void useDelete(@RequestBody List<UseInfo> useInfo){
equipService.useDelete(useInfo);
}
@GetMapping("/qirUseList")
public ModelAndView qirUseList(@AuthenticationPrincipal UserInfo loginUser,UseList useList,HttpServletResponse response) {
public ModelAndView qirUseList(@AuthenticationPrincipal UserInfo loginUser, UseInfo useInfo, HttpServletResponse response) {
ModelAndView mav = new ModelAndView("equip/qirUseList");
useList.setDownOrganCdList(loginUser.getDownOrganCdList());
useList.setUseType("QIR");
useInfo.setDownOrganCdList(loginUser.getDownOrganCdList());
useInfo.setUseType("QIR");
//엑셀다운
if(useList.getExcel() != null && useList.getExcel().equals("Y")){
String[] headers = { "use_no", "sosok", "use_dt", "detail_type_name", "people_cnt", "description", "wrt_dt"};
String[] headerNames = { "연번", "경찰서","사용일시", "사용사유", "사용인원", "비고", "최종수정일"};
if(useInfo.getExcel() != null && useInfo.getExcel().equals("Y")){
String[] headers = { "use_no", "sosok", "buseo", "use_dt", "detail_type_name", "people_cnt", "description", "wrt_dt"};
String[] headerNames = { "연번", "경찰서","부서", "사용일시", "사용사유", "사용인원", "비고", "최종수정일"};
String[] columnType = { "String", "String","String", "String", "int", "String", "String"};
String sheetName = "방역조사실 사용대장";
String excelFileName = "방역조사실 사용대장";
List<UseList> useExcelList= equipService.selectUseList(useList);
List<UseInfo> useExcelList= equipService.selectUseInfoList(useInfo);
try {
Utils.useListToExcel(useExcelList, response, headers, headerNames, columnType, sheetName, excelFileName);
@ -430,12 +430,12 @@ public class EquipController {
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/qirUseList").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
useList.setQueryInfo();
mav.addObject("useList", equipService.selectUseList(useList));
useList.setContentCnt(equipService.selectUseListCnt(useList));
useList.setPaginationInfo();
mav.addObject("searchParams", useList);
mav.addObject("organList", equipService.selectOrganList(useList));
useInfo.setQueryInfo();
mav.addObject("useList", equipService.selectUseInfoList(useInfo));
useInfo.setContentCnt(equipService.selectUseInfoListCnt(useInfo));
useInfo.setPaginationInfo();
mav.addObject("searchParams", useInfo);
mav.addObject("downOrganList", loginUser.getDownOrganCdList());
return mav;
}

View File

@ -3,7 +3,7 @@ package com.dbnt.faisp.main.equip.mapper;
import com.dbnt.faisp.main.equip.model.CellPhone;
import com.dbnt.faisp.main.equip.model.Equip;
import com.dbnt.faisp.main.equip.model.EquipLog;
import com.dbnt.faisp.main.equip.model.UseList;
import com.dbnt.faisp.main.equip.model.UseInfo;
import com.dbnt.faisp.util.ParamMap;
import org.apache.ibatis.annotations.Mapper;
@ -35,21 +35,19 @@ public interface EquipMapper {
Integer selectCellPhoneListCnt(CellPhone cellPhone);
List<ParamMap> selectOrganList(UseList useList);
List<ParamMap> selectOrganList(UseInfo useInfo);
UseList selectUseNoCnt(UseList useList);
UseInfo selectUseNoCnt(UseInfo useInfo);
Integer selectLastUseNo(UseList useList);
Integer selectLastUseNo(UseInfo useInfo);
List<UseList> selectUseList(UseList useList);
List<UseInfo> selectUseInfoList(UseInfo useInfo);
Integer selectUseListCnt(UseList useList);
UseList selectUseInfo(UseList useList);
Integer selectUseInfoListCnt(UseInfo useInfo);
List<Equip> selectHistoryList(Equip equip);
List<UseList> selectUseHistoryList(UseList useList);
List<UseInfo> selectUseHistoryList(UseInfo useInfo);

View File

@ -20,16 +20,20 @@ import java.io.Serializable;
@Table(name = "use_info")
public class UseInfo extends UseInfoBase {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "use_key")
private Integer useKey;
@Column(name = "state")
private String state;
@Column(name = "is_deleted")
private String isDeleted;
@Transient
private String excel;
@Transient
private String sosok;
@Transient
private String buseo;
@Transient
private String year;

View File

@ -13,6 +13,6 @@ import org.springframework.data.jpa.repository.Query;
public interface UseInfoRepository extends JpaRepository<UseInfo, Integer> {
@Modifying(clearAutomatically = true)
@Query("update UseInfo set state = 'D' where useKey in (:useKeyList)")
@Query("update UseInfo set isDeleted = 'Y' where useKey in (:useKeyList)")
void bulkModifyingByUseInfoToUseKeyList(List<Integer> useKeyList);
}

View File

@ -3,26 +3,18 @@ package com.dbnt.faisp.main.equip.service;
import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.main.equip.mapper.EquipMapper;
import com.dbnt.faisp.main.equip.model.CellPhone;
import com.dbnt.faisp.main.equip.model.Equip;
import com.dbnt.faisp.main.equip.model.*;
import com.dbnt.faisp.main.equip.model.Equip.EquipId;
import com.dbnt.faisp.main.equip.model.EquipFile;
import com.dbnt.faisp.main.equip.model.EquipFile.EquipFileId;
import com.dbnt.faisp.main.equip.model.EquipLog;
import com.dbnt.faisp.main.equip.model.UseList;
import com.dbnt.faisp.main.equip.model.UseList.UseListId;
import com.dbnt.faisp.main.equip.repository.CellPhoneRepository;
import com.dbnt.faisp.main.equip.repository.EquipFileRepository;
import com.dbnt.faisp.main.equip.repository.EquipLogRepository;
import com.dbnt.faisp.main.equip.repository.EquipRepository;
import com.dbnt.faisp.main.equip.repository.UseListRepository;
import com.dbnt.faisp.main.equip.model.UseInfo;
import com.dbnt.faisp.main.equip.repository.*;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import com.dbnt.faisp.util.ParamMap;
import com.dbnt.faisp.util.Utils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.FileCopyUtils;
@ -30,7 +22,6 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
@ -42,11 +33,10 @@ public class EquipService extends BaseService {
private final EquipFileRepository equipFileRepository;
private final EquipLogRepository equipLogRepository;
private final CellPhoneRepository cellPhoneRepository;
private final UseListRepository useListRepository;
private final UseInfoRepository useInfoRepository;
private final UseInfoVersionRepository useInfoVersionRepository;
private final EquipMapper equipMapper;
SimpleDateFormat Date = new SimpleDateFormat("yyyy");
String year = Date.format(new Date());
@Transactional
@ -307,77 +297,65 @@ public class EquipService extends BaseService {
cellPhoneRepository.deleteAll(cellPhone);
}
public List<ParamMap> selectOrganList(UseList useList) {
return equipMapper.selectOrganList(useList);
public List<ParamMap> selectOrganList(UseInfo useInfo) {
return equipMapper.selectOrganList(useInfo);
}
@Transactional
public void saveUse(UseList useList) {
useList.setYear(year);
Integer useNo = equipMapper.selectLastUseNo(useList);
public void saveUseInfo(UseInfo useInfo) {
String year = ((Integer) useInfo.getUseDt().getYear()).toString();
useInfo.setYear(year);
Integer useNo = equipMapper.selectLastUseNo(useInfo);
if(useNo == null) {
useList.setUseNo(year+"-001");
useList.setVersionNo(1);
useInfo.setUseNo(year+"-001");
} else {
useList.setUseNo(year+"-"+String.format("%03d", useNo+1));
useList.setVersionNo(1);
useInfo.setUseNo(year+"-"+String.format("%03d", useNo+1));
}
useListRepository.save(useList);
}
public List<UseList> selectUseList(UseList useList) {
return equipMapper.selectUseList(useList);
}
public Integer selectUseListCnt(UseList useList) {
return equipMapper.selectUseListCnt(useList);
}
public UseList selectUseInfo(UseList useList) {
return equipMapper.selectUseInfo(useList);
useInfoRepository.save(useInfo);
saveUseInfoVersion(useInfo);
}
@Transactional
public UseList updateUse(UseList useList) {
UseList dbUseList = useListRepository
.findById(new UseListId(useList.getMgtOrgan(),useList.getUseNo(),useList.getVersionNo(),useList.getUseType())).orElse(null);
UseList useTmp = new UseList();
useTmp.setMgtOrgan(dbUseList.getMgtOrgan());
useTmp.setUseNo(dbUseList.getUseNo());
useTmp.setVersionNo(dbUseList.getVersionNo()+1);
useTmp.setUseType(dbUseList.getUseType());
useTmp.setUseDt(useList.getUseDt());
useTmp.setDetailType(useList.getDetailType());
useTmp.setDetailSelf(useList.getDetailSelf());
useTmp.setPeopleCnt(useList.getPeopleCnt());
useTmp.setDescription(useList.getDescription());
useTmp.setWrtOrgan(useList.getWrtOrgan());
useTmp.setWrtPart(useList.getWrtPart());
useTmp.setWrtTitle(useList.getWrtTitle());
useTmp.setWrtUserSeq(useList.getWrtUserSeq());
useTmp.setWrtNm(useList.getWrtNm());
useTmp.setWrtDt(useList.getWrtDt());
return useListRepository.save(useTmp);
public UseInfo updateUse(UseInfo useInfo) {
useInfoRepository.save(useInfo);
saveUseInfoVersion(useInfo);
return useInfo;
}
public List<UseList> selectUseHistoryList(UseList useList) {
return equipMapper.selectUseHistoryList(useList);
private void saveUseInfoVersion(UseInfo useInfo){
UseInfoVersion savedInfo = useInfoVersionRepository.findByUseKey(useInfo.getUseKey()).orElse(null);
UseInfoVersion versionInfo = new UseInfoVersion();
BeanUtils.copyProperties(useInfo, versionInfo);
versionInfo.setVersionNo(savedInfo==null?1:(savedInfo.getVersionNo()+1));
useInfoVersionRepository.save(versionInfo);
}
public List<UseInfo> selectUseInfoList(UseInfo useInfo) {
return equipMapper.selectUseInfoList(useInfo);
}
public Integer selectUseInfoListCnt(UseInfo useInfo) {
return equipMapper.selectUseInfoListCnt(useInfo);
}
public UseInfo selectUseInfo(UseInfo useInfo) {
return useInfoRepository.findById(useInfo.getUseKey()).orElse(null);
}
public List<UseInfo> selectUseHistoryList(UseInfo useInfo) {
return equipMapper.selectUseHistoryList(useInfo);
}
@Transactional
public void useDelete(List<UseList> useList) {
for(UseList use:useList) {
useListRepository.deleteByMgtOrganAndUseNoAndUseType(use.getMgtOrgan(),use.getUseNo(),use.getUseType());
public void useDelete(List<UseInfo> useInfo) {
List<Integer> useKeyList = new ArrayList<>();
for(UseInfo use: useInfo) {
useKeyList.add(use.getUseKey());
}
useInfoRepository.bulkModifyingByUseInfoToUseKeyList(useKeyList);
}
public Integer selectFirstWrtUserSeq(UseList useList) {
return useListRepository.getWrtUserSeq(useList.getMgtOrgan(),useList.getUseNo(),useList.getUseType());
}
public EquipFile selectEquipFile(Equip equip) {
return equipFileRepository.findById(new EquipFileId(equip.getEquKey(), equip.getVersionNo())).orElse(null);
}

View File

@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
import com.dbnt.faisp.main.codeMgt.model.CodeMgt;
import com.dbnt.faisp.main.equip.model.UseInfo;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
@ -27,7 +28,6 @@ import org.apache.poi.xssf.usermodel.XSSFDataFormat;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import com.dbnt.faisp.main.equip.model.CellPhone;
import com.dbnt.faisp.main.equip.model.UseList;
import com.dbnt.faisp.main.fipTarget.model.PartInfo;
import com.dbnt.faisp.main.fipTarget.model.PartWork;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
@ -666,7 +666,7 @@ public class Utils {
}
public static void useListToExcel(List<UseList> useExcelList, HttpServletResponse response, String[] headers,
public static void useListToExcel(List<UseInfo> useExcelList, HttpServletResponse response, String[] headers,
String[] headerNames, String[] columnType, String sheetName, String excelFileName) throws IOException {
if(Utils.isNotEmpty(useExcelList)) {
// 메모리에 100개의 행을 유지합니다. 행의 수가 넘으면 디스크에 적습니다.

View File

@ -199,41 +199,41 @@
<select id="selectEquipList" resultType="Equip" parameterType="Equip">
select em.equ_key,
em.version_no,
mgt_organ,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else (select item_value from code_mgt cm where cm.item_cd = oc.parent_organ )
end as sosok,
case
when oc.organ_type = 'OGC003' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else null
end as detail_sosok,
equ_type,
detail_type,
stored_year,
item_qty,
(select item_value from code_mgt cm where cm.item_cd = item_condition) as item_condition,
note,
ef.orig_nm,
ef.conv_nm,
ef.file_path
em.version_no,
mgt_organ,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else (select item_value from code_mgt cm where cm.item_cd = oc.parent_organ )
end as sosok,
case
when oc.organ_type = 'OGC003' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else null
end as detail_sosok,
equ_type,
detail_type,
stored_year,
item_qty,
(select item_value from code_mgt cm where cm.item_cd = item_condition) as item_condition,
note,
ef.orig_nm,
ef.conv_nm,
ef.file_path
from equ_mgt em,
(select equ_key,max(version_no) as lastVer
from equ_mgt group by equ_key) b,
equ_file ef,
organ_config oc
(select equ_key,max(version_no) as lastVer
from equ_mgt group by equ_key) b,
equ_file ef,
organ_config oc
where em.equ_key = b.equ_key
and em.version_no = b.lastVer
and em.equ_key = ef.equ_key
and em.version_no = ef.version_no
and em.mgt_organ = oc.organ_cd
and detail_type = #{detailType}
and mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
and em.version_no = b.lastVer
and em.equ_key = ef.equ_key
and em.version_no = ef.version_no
and em.mgt_organ = oc.organ_cd
and detail_type = #{detailType}
and mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by equ_key desc
limit #{rowCnt} offset #{firstIndex}
</select>
@ -241,44 +241,44 @@
<select id="selectEquipListCnt" resultType="int" parameterType="Equip">
select count(*)
from(
select em.equ_key,
em.version_no,
mgt_organ,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else (select item_value from code_mgt cm where cm.item_cd = oc.parent_organ )
end as sosok,
case
when oc.organ_type = 'OGC003' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else null
end as detail_sosok,
equ_type,
detail_type,
stored_year,
item_qty,
(select item_value from code_mgt cm where cm.item_cd = item_condition) as item_condition,
note,
ef.orig_nm,
ef.conv_nm,
ef.file_path
from equ_mgt em,
(select equ_key,max(version_no) as lastVer
from equ_mgt group by equ_key) b,
equ_file ef,
organ_config oc
where em.equ_key = b.equ_key
and em.version_no = b.lastVer
and em.equ_key = ef.equ_key
and em.version_no = ef.version_no
and em.mgt_organ = oc.organ_cd
and detail_type = #{detailType}
and mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by equ_key asc
) a
select em.equ_key,
em.version_no,
mgt_organ,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else (select item_value from code_mgt cm where cm.item_cd = oc.parent_organ )
end as sosok,
case
when oc.organ_type = 'OGC003' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else null
end as detail_sosok,
equ_type,
detail_type,
stored_year,
item_qty,
(select item_value from code_mgt cm where cm.item_cd = item_condition) as item_condition,
note,
ef.orig_nm,
ef.conv_nm,
ef.file_path
from equ_mgt em,
(select equ_key,max(version_no) as lastVer
from equ_mgt group by equ_key) b,
equ_file ef,
organ_config oc
where em.equ_key = b.equ_key
and em.version_no = b.lastVer
and em.equ_key = ef.equ_key
and em.version_no = ef.version_no
and em.mgt_organ = oc.organ_cd
and detail_type = #{detailType}
and mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by equ_key asc
) a
</select>
<select id="selectEquipInfo" resultType="Equip" parameterType="Equip">
@ -359,15 +359,15 @@
<select id="selectEquipLogList" resultType="EquipLog" parameterType="EquipLog">
select (select item_value from code_mgt cm where cm.item_cd = equ_type) as equ_type,
(select item_value from code_mgt cm where cm.item_cd = detail_type) as detail_name,
detail_type,
(select item_value from code_mgt where item_cd = wrt_organ) as sosok,
(select item_value from code_mgt where item_cd = wrt_part) as detail_sosok,
el_contents,
wrt_part,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_title,
wrt_nm,
wrt_dt
(select item_value from code_mgt cm where cm.item_cd = detail_type) as detail_name,
detail_type,
(select item_value from code_mgt where item_cd = wrt_organ) as sosok,
(select item_value from code_mgt where item_cd = wrt_part) as detail_sosok,
el_contents,
wrt_part,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_title,
wrt_nm,
wrt_dt
from equ_log
where wrt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
@ -380,23 +380,23 @@
<select id="selectEquipLogListCnt" resultType="int" parameterType="EquipLog">
select count(*)
from(
select (select item_value from code_mgt cm where cm.item_cd = equ_type) as equ_type,
(select item_value from code_mgt cm where cm.item_cd = detail_type) as detail_name,
detail_type,
(select item_value from code_mgt where item_cd = wrt_organ) as sosok,
(select item_value from code_mgt where item_cd = wrt_part) as detail_sosok,
el_contents,
wrt_part,
wrt_title,
wrt_nm,
wrt_dt
from equ_log
where wrt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by wrt_dt desc
) a
select (select item_value from code_mgt cm where cm.item_cd = equ_type) as equ_type,
(select item_value from code_mgt cm where cm.item_cd = detail_type) as detail_name,
detail_type,
(select item_value from code_mgt where item_cd = wrt_organ) as sosok,
(select item_value from code_mgt where item_cd = wrt_part) as detail_sosok,
el_contents,
wrt_part,
wrt_title,
wrt_nm,
wrt_dt
from equ_log
where wrt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by wrt_dt desc
) a
</select>
<select id="selectEquipFirstUserSeq" resultType="String" parameterType="Equip">
@ -438,24 +438,24 @@
<select id="selectCellPhoneList" resultType="CellPhone" parameterType="CellPhone">
select phone_key,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else concat(
(select item_value from code_mgt cm where cm.item_cd = oc.parent_organ ),
'-',
(select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
)
end as sosok,
tel_no,
p_user_seq,
ui.user_nm as user_nm,
ext_mail,
webex_no,
katalk_id
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else concat(
(select item_value from code_mgt cm where cm.item_cd = oc.parent_organ ),
'-',
(select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
)
end as sosok,
tel_no,
p_user_seq,
ui.user_nm as user_nm,
ext_mail,
webex_no,
katalk_id
from cellphone_mgt cm,
organ_config oc,
user_info ui
organ_config oc,
user_info ui
<include refid="selectCellPhoneListWhere"></include>
order by cm.wrt_dt desc
<if test='excel != "Y"'>
@ -466,45 +466,45 @@
<select id="selectCellPhoneListCnt" resultType="int" parameterType="CellPhone">
select count(*)
from(
select phone_key,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else concat((select item_value from code_mgt cm where cm.item_cd = oc.parent_organ ),'-', (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd ))
end as sosok,
tel_no,
p_user_seq,
ui.user_nm as user_nm,
ext_mail,
webex_no,
katalk_id
from cellphone_mgt cm,
organ_config oc,
user_info ui
<include refid="selectCellPhoneListWhere"></include>
order by cm.wrt_dt desc
) a
select phone_key,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else concat((select item_value from code_mgt cm where cm.item_cd = oc.parent_organ ),'-', (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd ))
end as sosok,
tel_no,
p_user_seq,
ui.user_nm as user_nm,
ext_mail,
webex_no,
katalk_id
from cellphone_mgt cm,
organ_config oc,
user_info ui
<include refid="selectCellPhoneListWhere"></include>
order by cm.wrt_dt desc
) a
</select>
<select id="selectOrganList" resultType="com.dbnt.faisp.util.ParamMap" parameterType="UseList">
<select id="selectOrganList" resultType="com.dbnt.faisp.util.ParamMap" parameterType="UseInfo">
select item_cd,
item_value
item_value
from code_mgt cm, organ_config oc
where cm.item_cd = oc.organ_cd
and oc.organ_type = 'OGC003'
and cm.use_chk = 'T'
and item_cd in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
and oc.organ_type = 'OGC003'
and cm.use_chk = 'T'
and item_cd in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by item_cd asc
</select>
<select id="selectLastUseNo" resultType="Integer" parameterType="UseList">
<select id="selectLastUseNo" resultType="Integer" parameterType="UseInfo">
select a.useNo
from(
select substring(use_no, 6, 3)::int as useNo
from use_list
from use_info
where mgt_organ = #{mgtOrgan}
and use_no like #{year}||'%'
and use_type = #{useType}
@ -514,7 +514,15 @@
limit 1
</select>
<sql id="searchUseList">
<sql id="searchUseInfoWhere">
where use_type = #{useType}
and is_deleted = 'N'
<if test='downOrganCdList != null'>
and ul.mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='mgtOrgan != null and mgtOrgan != ""'>
and ul.mgt_organ = #{mgtOrgan}
</if>
@ -542,128 +550,49 @@
</if>
</sql>
<select id="selectUseList" resultType="UseList" parameterType="UseList">
<select id="selectUseInfoList" resultType="UseInfo" parameterType="UseInfo">
select (select item_value from code_mgt where item_cd = ul.mgt_organ) as sosok,
ul.mgt_organ,
ul.use_type,
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
from use_list ul,
(select use_no,max(version_no) as lastVer,mgt_organ,use_type from use_list
where use_type = #{useType}
and mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
group by use_no,use_type,mgt_organ) b
where ul.use_no = b.use_no
and ul.version_no = b.lastVer
and ul.mgt_organ = b.mgt_organ
and ul.use_type = b.use_type
and ul.use_type = #{useType}
and ul.mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<include refid="searchUseList"></include>
order by ul.use_no desc
<if test='excel != "Y"'>
limit #{rowCnt} offset #{firstIndex}
</if>
</select>
<select id="selectUseListCnt" resultType="Integer" parameterType="UseList">
select count(*)
from(
select (select item_value from code_mgt where item_cd = ul.mgt_organ) as sosok,
ul.mgt_organ,
ul.use_type,
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
from use_list ul,
(select use_no,max(version_no) as lastVer,mgt_organ,use_type from use_list
where use_type = #{useType}
and mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
group by use_no,use_type,mgt_organ) b
where ul.use_no = b.use_no
and ul.version_no = b.lastVer
and ul.mgt_organ = b.mgt_organ
and ul.use_type = b.use_type
and ul.use_type = #{useType}
and ul.mgt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<include refid="searchUseList"></include>
order by ul.use_no desc
) a
</select>
<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,
(select item_value from code_mgt where item_cd = ul.mgt_part) as buseo,
ul.use_key,
ul.mgt_organ,
ul.mgt_part,
ul.use_type,
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
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}
from use_info ul
<include refid="searchUseInfoWhere"></include>
order by ul.use_no desc
<if test='excel != "Y"'>
limit #{rowCnt} offset #{firstIndex}
</if>
</select>
<select id="selectUseHistoryList" resultType="UseList" parameterType="UseList">
select mgt_organ,
use_no,
<select id="selectUseInfoListCnt" resultType="Integer" parameterType="UseInfo">
select count(*)
from use_info ul
<include refid="searchUseInfoWhere"></include>
</select>
<select id="selectUseHistoryList" resultType="UseInfo" parameterType="UseInfo">
select use_key,
version_no,
mgt_organ,
use_no,
use_type,
wrt_organ,
wrt_part,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_title,
wrt_nm,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_user_grd,
wrt_user_nm,
wrt_dt
from use_list
where mgt_organ = #{mgtOrgan}
and use_no = #{useNo}
and use_type = #{useType}
order by wrt_nm desc
from use_info_version
where use_key = #{useKey}
order by wrt_dt desc
</select>

View File

@ -16,6 +16,12 @@ $(document).on('click', '#addQir', function (){
showEditModal(useType);
})
$(document).on('change', '#mgtOrgan', function (){
const partSelector = $("#mgtPart")
partSelector.find('.partOption').hide();
partSelector.find('.'+this.value).show();
})
function showEditModal(useType){
$.ajax({
url: '/equip/useEditModal',
@ -79,19 +85,14 @@ $(document).on('change', '#detailType', function (){
$(document).on('click', '.useTr', function (event){
const target = event.target;
if(!(target.className === "useChk" ||$(target).parents("td").length>0)){
const useNo = $(target).parent('tr').data("useno");
const useType = $(target).parent('tr').data("usetype");
const mgtOrgan = $(target).parent('tr').data("mgtorgan");
showModifyModal(useNo,useType,mgtOrgan);
showModifyModal($(target).parent('tr').attr("data-usekey"));
}
});
function showModifyModal(useNo,useType,mgtOrgan){
function showModifyModal(useKey){
$.ajax({
url: '/equip/useModifyModal',
data: {useNo: useNo,
useType: useType,
mgtOrgan: mgtOrgan},
data: {useKey: useKey},
type: 'GET',
dataType:"html",
success: function(html){

View File

@ -87,17 +87,19 @@ $(document).on('click', '.saveBtn', function (){
}
})
function sriDataCheck(){
if(!$("#faSriType").val()){
alert("분류를 선택해주세요.")
return false;
}
if(!$("#faSriEdate").val()){
alert("제출기한일을 선택해주세요.")
return false;
}
if(!$("#faSriETime").val()){
alert("제출기한 시간을 입력해주세요.")
return false;
if(!$("#refKey").val()) {
if (!$("#faSriType").val()) {
alert("분류를 선택해주세요.")
return false;
}
if (!$("#faSriEdate").val()) {
alert("제출기한일을 선택해주세요.")
return false;
}
if (!$("#faSriETime").val()) {
alert("제출기한 시간을 입력해주세요.")
return false;
}
}
if(!$("#title").val()){
alert("제목을 입력해주세요.")

View File

@ -41,6 +41,12 @@ $(document).on('click', '.careerAddBtn', function (){
});
})
$(document).on('change', '#workOrgan', function (){
const partSelector = $("#workPart");
partSelector.find('option').hide();
partSelector.find('.'+this.value).show();
})
$(document).on('click', '.kwmsCareerBtn', function (){
getKwmsCareerModal($("#mngModelUserSeq").val(), $("#mngModelDicCode").val())
})
@ -136,6 +142,7 @@ $(document).on('click', '#saveBtn', function (){
})
}
})
$(document).on('click', '.deleteCareerBtn', function (){
if(confirm("삭제하시겠습니까?")){
contentFade("in");

View File

@ -89,7 +89,7 @@
</tr>
</thead>
<tbody class="table-group-divider">
<tr class="useTr" th:each="list:${useList}" th:data-useNo="${list.useNo}" th:data-mgtOrgan="${list.mgtOrgan}" th:data-useType="${list.useType}">
<tr class="useTr" th:each="list:${useInfo}" th:data-useNo="${list.useNo}" th:data-mgtOrgan="${list.mgtOrgan}" th:data-useType="${list.useType}">
<td class="useChk"><input type="checkbox" name="useChk" class="useCheckBox"></td>
<td th:text="${list.useNo}"></td>
<td th:text="${list.sosok}"></td>

View File

@ -39,8 +39,8 @@
<div class="col-1" th:if="${accessAuth eq 'ACC003'}">
<select class="form-select form-select-sm" name="mgtOrgan">
<option value="">경찰서</option>
<th:block th:each="organList:${organList}">
<option th:value="${organList.item_cd}" th:text="${organList.item_value}" th:selected="${organList.item_cd eq searchParams.mgtOrgan}"></option>
<th:block th:each="organ:${session.commonCode.get('OG')}">
<option th:if="${organ.useChk eq 'T' and #lists.contains(downOrganList, organ.itemCd)}" th:value="${organ.itemCd}" th:text="${organ.itemValue}" th:selected="${organ.itemCd eq searchParams.mgtOrgan}"></option>
</th:block>
</select>
</div>
@ -78,9 +78,10 @@
<table class="table table-sm table-hover table-bordered">
<thead>
<tr class="table-secondary">
<th> <input type="checkbox" id="chk-all" class="useCheckBox"></th>
<th th:if="${accessAuth eq 'ACC003'}"> <input type="checkbox" id="chk-all" class="useCheckBox"></th>
<th>연번</th>
<th>경찰서</th>
<th>부서</th>
<th>사용일시</th>
<th>사용사유</th>
<th>사용인원</th>
@ -89,16 +90,19 @@
</tr>
</thead>
<tbody class="table-group-divider">
<tr class="useTr" th:each="list:${useList}" th:data-useNo="${list.useNo}" th:data-mgtOrgan="${list.mgtOrgan}" th:data-useType="${list.useType}">
<td class="useChk"><input type="checkbox" name="useChk" class="useCheckBox"></td>
<td th:text="${list.useNo}"></td>
<td th:text="${list.sosok}"></td>
<td th:text="${list.useDt}"></td>
<td th:text="${list.detailTypeName}" th:if="${list.detailType != 'QIRUSE006'}"></td>
<td th:text="${list.detailSelf}" th:unless="${list.detailType != 'QIRUSE006'}"></td>
<td th:text="${list.peopleCnt}"></td>
<td th:text="${list.description}"></td>
<td th:text="${#temporals.format(list.wrtDt, 'yyyy-MM-dd HH:mm')}"></td>
<tr class="useTr" th:each="info:${useList}" th:data-usekey="${info.useKey}">
<td th:if="${accessAuth eq 'ACC003'}" class="useChk"><input type="checkbox" name="useChk" class="useCheckBox"></td>
<td th:text="${info.useNo}"></td>
<td th:text="${info.sosok}"></td>
<td th:text="${info.buseo}"></td>
<td th:text="${info.useDt}"></td>
<td>
<th:block th:if="${info.detailType != 'QIRUSE006'}" th:text="${info.detailTypeName}"></th:block>
<th:block th:unless="${info.detailType != 'QIRUSE006'}" th:text="${info.detailSelf}"></th:block>
</td>
<td th:text="${info.peopleCnt}"></td>
<td th:text="${info.description}"></td>
<td th:text="${#temporals.format(info.wrtDt, 'yyyy-MM-dd HH:mm')}"></td>
</tr>
</tbody>
</table>
@ -106,7 +110,7 @@
</div>
<div class="row justify-content-between">
<div class="col-auto">
<button type="button" class="btn btn-warning" id="historyBtn">수정이력</button>
<!--<button type="button" class="btn btn-warning" id="historyBtn">수정이력</button>-->
<button type="button" class="btn btn-danger" id="deleteUse" th:if="${accessAuth eq 'ACC003'}">삭제</button>
</div>
<div class="col-auto">

View File

@ -14,8 +14,22 @@
<label for="mgtOrgan" class="col-sm-4 col-form-label col-form-label-sm text-center">관서</label>
<div class="col-sm-6">
<select class="form-select form-select-sm" id="mgtOrgan" name="mgtOrgan">
<th:block th:each="organList:${organList}">
<option th:value="${organList.item_cd}" th:text="${organList.item_value}" th:selected="${organList.item_cd eq userOrgan}"></option>
<option value="">선택</option>
<th:block th:each="organ:${session.commonCode.get('OG')}">
<option th:if="${organ.useChk eq 'T' and #lists.contains(downOrganList, organ.itemCd)}" th:value="${organ.itemCd}" th:text="${organ.itemValue}"></option>
</th:block>
</select>
</div>
</div>
<div class="row mb-1">
<label for="mgtOrgan" class="col-sm-4 col-form-label col-form-label-sm text-center">부서</label>
<div class="col-sm-6">
<select class="form-select form-select-sm" id="mgtPart" name="mgtPart">
<option value="">선택</option>
<th:block th:each="organ:${session.commonCode.get('OG')}">
<th:block th:if="${organ.useChk eq 'T' and #lists.contains(downOrganList, organ.itemCd)}" th:each="part:${session.commonCode.get(organ.itemCd)}">
<option th:if="${part.useChk eq 'T'}" class="partOption" th:classappend="${organ.itemCd}" th:value="${part.itemCd}" th:text="${part.itemValue}" style="display: none"></option>
</th:block>
</th:block>
</select>
</div>

View File

@ -59,7 +59,7 @@
</main>
<div class="modal fade" id="vulnEditModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="userEditModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-dialog modal-lg modal-dialog-scrollable">
<div class="modal-content" id="vulnEditModalContent">
<div class="modal-header bg-dark">
</div>