requestLog 오류 수정.

불법조업 외국어선 처리현황 목록 조회 동작 수정.
통역인 삭제 동작 수정.
master
강석 최 2023-05-10 10:48:11 +09:00
parent 7c572897ec
commit 617fbfd212
11 changed files with 506 additions and 470 deletions

View File

@ -41,15 +41,17 @@ public class FaispInterceptor implements HandlerInterceptor {
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//페이지 렌더링 후 실행.
String uri = request.getRequestURI();
UserRequestLog log = new UserRequestLog();
log.setContactIp(Utils.getClientIP(request));
log.setRequestUrl(uri);
log.setRequestMethod(request.getMethod());
log.setSearchParams(request.getQueryString());
log.setHandlerDescription(((HandlerMethod) handler).toString());
log.setUserOrgan((String) request.getSession().getAttribute("userOrgan"));
log.setUserBelong((String) request.getSession().getAttribute("belongValue"));
userLogService.saveRequestLog(log);
if(handler instanceof HandlerMethod){
String uri = request.getRequestURI();
UserRequestLog log = new UserRequestLog();
log.setContactIp(Utils.getClientIP(request));
log.setRequestUrl(uri);
log.setRequestMethod(request.getMethod());
log.setSearchParams(request.getQueryString());
log.setHandlerDescription(((HandlerMethod) handler).toString());
log.setUserOrgan((String) request.getSession().getAttribute("userOrgan"));
log.setUserBelong((String) request.getSession().getAttribute("belongValue"));
userLogService.saveRequestLog(log);
}
}
}

View File

@ -21,132 +21,140 @@ import java.util.List;
@RequestMapping("/faStatistics")
public class ProcessResultController {
private final AuthMgtService authMgtService;
private final ProcessResultService processResultService;
private final ViolationRepository violationRepository;
private final CrackdownStatusRepository crackdownStatusRepository;
private final FishingBoatRepository fishingBoatRepository;
private final ProcessResultRepository processResultRepository;
private final AuthMgtService authMgtService;
private final ProcessResultService processResultService;
private final ViolationRepository violationRepository;
private final CrackdownStatusRepository crackdownStatusRepository;
private final FishingBoatRepository fishingBoatRepository;
private final ProcessResultRepository processResultRepository;
@RequestMapping("/processResult")
public ModelAndView processResult(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult) {
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResult");
@RequestMapping("/processResult")
public ModelAndView processResult(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult) {
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResult");
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/processResult").get(0).getAccessAuth();
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/processResult").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
mav.addObject("accessAuth", accessAuth);
processResult.setQueryInfo();
List<ProcessResult> processResultList = processResultService.selectProcessResultList(processResult);
for (ProcessResult pr:processResultList) {
pr.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(pr.getCdsKey()).orElse(null));
pr.setFishingBoat(fishingBoatRepository.findByCdsKey(pr.getCdsKey()).orElse(null));
pr.setViolationList(violationRepository.findByFbKey(pr.getFishingBoat().getFbKey()));
}
mav.addObject("processResultList", processResultList);
mav.addObject("searchParams", processResult);
return mav;
processResult.setQueryInfo();
if(processResult.getYear()==null){
processResult.setYear(LocalDateTime.now().getYear());
}
List<Integer> yearList = processResultService.selectProcessResultYearParam(processResult);
if(!yearList.contains(processResult.getYear())){
yearList.add(processResult.getYear());
}
@GetMapping("/processResult/processResultViewModal")
public ModelAndView processResultViewModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultViewModal");
processResult = processResultService.selectProcessResult(processResult.getPrKey());
processResult.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setFbKey(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getFbKey());
processResult.setBoatNameKr(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getBoatNameKr());
processResult.setViolationList(violationRepository.findByFbKey(processResult.getFbKey()));
List<ProcessResult> processResultList = processResultService.selectProcessResultList(processResult);
mav.addObject("processResult", processResult);
mav.addObject("userSeq",loginUser.getUserSeq());
//메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/processResult").get(0).getAccessAuth());
return mav;
for (ProcessResult pr:processResultList) {
pr.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(pr.getCdsKey()).orElse(null));
pr.setFishingBoat(fishingBoatRepository.findByCdsKey(pr.getCdsKey()).orElse(null));
pr.setViolationList(violationRepository.findByFbKey(pr.getFishingBoat().getFbKey()));
}
@GetMapping("/processResult/processResultEditModal")
public ModelAndView crackdownStatusEditModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultEditModal");
if(processResult.getPrKey()!=null){
processResult = processResultService.selectProcessResult(processResult.getPrKey());
processResult.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setFbKey(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getFbKey());
processResult.setBoatNameKr(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getBoatNameKr());
processResult.setViolationList(violationRepository.findByFbKey(processResult.getFbKey()));
}else{
processResult.setWrtOrgan(loginUser.getOgCd());
processResult.setWrtPart(loginUser.getOfcCd());
processResult.setWrtUserGrd(loginUser.getGroupCd());
processResult.setWrtUserNm(loginUser.getUserNm());
processResult.setWrtDt(LocalDateTime.now());
}
mav.addObject("processResult", processResult);
return mav;
mav.addObject("processResultList", processResultList);
mav.addObject("searchParams", processResult);
return mav;
}
@GetMapping("/processResult/processResultViewModal")
public ModelAndView processResultViewModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultViewModal");
processResult = processResultService.selectProcessResult(processResult.getPrKey());
processResult.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setFbKey(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getFbKey());
processResult.setBoatNameKr(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getBoatNameKr());
processResult.setViolationList(violationRepository.findByFbKey(processResult.getFbKey()));
mav.addObject("processResult", processResult);
mav.addObject("userSeq",loginUser.getUserSeq());
//메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/processResult").get(0).getAccessAuth());
return mav;
}
@GetMapping("/processResult/processResultEditModal")
public ModelAndView crackdownStatusEditModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultEditModal");
if(processResult.getPrKey()!=null){
processResult = processResultService.selectProcessResult(processResult.getPrKey());
processResult.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setFbKey(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getFbKey());
processResult.setBoatNameKr(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null).getBoatNameKr());
processResult.setViolationList(violationRepository.findByFbKey(processResult.getFbKey()));
}else{
processResult.setWrtOrgan(loginUser.getOgCd());
processResult.setWrtPart(loginUser.getOfcCd());
processResult.setWrtUserGrd(loginUser.getGroupCd());
processResult.setWrtUserNm(loginUser.getUserNm());
processResult.setWrtDt(LocalDateTime.now());
}
mav.addObject("processResult", processResult);
return mav;
}
@GetMapping("/processResult/processResultHistoryViewModal")
public ModelAndView processResultHistoryViewModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultHistoryViewModal");
List<ProcessResultVersion> processReulstVersionList = processResultService.selectProcessResultVersionList(processResult.getPrKey());
@GetMapping("/processResult/processResultHistoryViewModal")
public ModelAndView processResultHistoryViewModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultHistoryViewModal");
List<ProcessResultVersion> processReulstVersionList = processResultService.selectProcessResultVersionList(processResult.getPrKey());
mav.addObject("processReulstVersionList", processReulstVersionList);
mav.addObject("processResult", processResult);
return mav;
}
mav.addObject("processReulstVersionList", processReulstVersionList);
mav.addObject("processResult", processResult);
return mav;
}
@GetMapping("/processResult/processResultHistoryDetail")
public ModelAndView processResultHistoryDetail(@AuthenticationPrincipal UserInfo loginUser, ProcessResultVersion processResultVersion){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultHistoryDetail");
@GetMapping("/processResult/processResultHistoryDetail")
public ModelAndView processResultHistoryDetail(@AuthenticationPrincipal UserInfo loginUser, ProcessResultVersion processResultVersion){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultHistoryDetail");
Integer cdsKey = processResultVersion.getCdsKey();
Integer fbKey = processResultVersion.getFbKey();
Integer cdsKey = processResultVersion.getCdsKey();
Integer fbKey = processResultVersion.getFbKey();
processResultVersion = processResultService.selectProcessResultVersion(processResultVersion.getVersionNo(), processResultVersion.getPrKey());
processResultVersion.setFishingBoat(fishingBoatRepository.findByFbKey(fbKey).orElse(null));
processResultVersion.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(cdsKey).orElse(null));
processResultVersion.setViolationList(violationRepository.findByFbKey(fbKey));
processResultVersion = processResultService.selectProcessResultVersion(processResultVersion.getVersionNo(), processResultVersion.getPrKey());
processResultVersion.setFishingBoat(fishingBoatRepository.findByFbKey(fbKey).orElse(null));
processResultVersion.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(cdsKey).orElse(null));
processResultVersion.setViolationList(violationRepository.findByFbKey(fbKey));
mav.addObject("processResultVersion", processResultVersion);
return mav;
}
mav.addObject("processResultVersion", processResultVersion);
return mav;
}
@GetMapping("/processResult/processResultAddModal")
public ModelAndView sailorAddModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultAddModal");
@GetMapping("/processResult/processResultAddModal")
public ModelAndView sailorAddModal(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
ModelAndView mav = new ModelAndView("faStatistics/processResult/processResultAddModal");
processResult.setCrackdownStatusList(crackdownStatusRepository.findAll());
processResult.setCrackdownStatusList(crackdownStatusRepository.findAll());
processResult.setWrtOrgan(loginUser.getOgCd());
processResult.setWrtUserNm(loginUser.getUserNm());
processResult.setWrtDt(LocalDateTime.now());
processResult.setWrtOrgan(loginUser.getOgCd());
processResult.setWrtUserNm(loginUser.getUserNm());
processResult.setWrtDt(LocalDateTime.now());
mav.addObject("processResult", processResult);
return mav;
}
mav.addObject("processResult", processResult);
return mav;
}
@PostMapping("/processResult/getProcessResult")
public ProcessResult getProcessResult(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
processResult = processResultRepository.findByCdsKey(processResult.getCdsKey()).orElse(null);
processResult.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setFishingBoat(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
@PostMapping("/processResult/getProcessResult")
public ProcessResult getProcessResult(@AuthenticationPrincipal UserInfo loginUser, ProcessResult processResult){
processResult = processResultRepository.findByCdsKey(processResult.getCdsKey()).orElse(null);
processResult.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setFishingBoat(fishingBoatRepository.findByCdsKey(processResult.getCdsKey()).orElse(null));
processResult.setWrtOrgan(loginUser.getOgCd());
processResult.setWrtUserNm(loginUser.getUserNm());
processResult.setWrtDt(LocalDateTime.now());
return processResult;
}
processResult.setWrtOrgan(loginUser.getOgCd());
processResult.setWrtUserNm(loginUser.getUserNm());
processResult.setWrtDt(LocalDateTime.now());
return processResult;
}
@PostMapping("/processResult/saveProcessResult")
public Integer saveProcessResult(@AuthenticationPrincipal UserInfo loginUser,
CrackdownStatus crackdownStatus,
FishingBoat fishingBoat,
ProcessResult processResult){
processResult.setWrtUserSeq(loginUser.getUserSeq());
processResult.setFishingBoat(fishingBoat);
processResult.setCrackdownStatus(crackdownStatus);
return processResultService.saveProcessResult(processResult);
}
@PostMapping("/processResult/saveProcessResult")
public Integer saveProcessResult(@AuthenticationPrincipal UserInfo loginUser,
CrackdownStatus crackdownStatus,
FishingBoat fishingBoat,
ProcessResult processResult){
processResult.setWrtUserSeq(loginUser.getUserSeq());
processResult.setFishingBoat(fishingBoat);
processResult.setCrackdownStatus(crackdownStatus);
return processResultService.saveProcessResult(processResult);
}
}

View File

@ -7,6 +7,8 @@ import java.util.List;
@Mapper
public interface ProcessResultMapper {
List<ProcessResult> selectProcessResultList(ProcessResult processResult);
Integer selectProcessResultListCnt(ProcessResult processResult);
List<ProcessResult> selectProcessResultList(ProcessResult processResult);
Integer selectProcessResultListCnt(ProcessResult processResult);
List<Integer> selectProcessResultYearParam(ProcessResult processResult);
}

View File

@ -62,7 +62,7 @@ public class ProcessResult extends ProcessResultBaseEntity {
@Transient
private String crackdownPolice;
@Transient
private String year;
private Integer year;
@Transient
private String violation;
}

View File

@ -102,4 +102,8 @@ public class ProcessResultService extends BaseService {
processResultVersionRepository.save(processResultVersion);
}
}
public List<Integer> selectProcessResultYearParam(ProcessResult processResult) {
return processResultMapper.selectProcessResultYearParam(processResult);
}
}

View File

@ -82,6 +82,8 @@ public class Translator extends BaseModel implements Serializable{
private String naturalization;
@Column(name = "info_share_chk")
private String infoShareChk;
@Column(name = "status")
private String status;
@Transient
private List<TranslatorFile> translatorFileList = new ArrayList<>();

View File

@ -2,6 +2,7 @@ package com.dbnt.faisp.main.translator.repository;
import com.dbnt.faisp.main.translator.model.Translator;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
@ -22,4 +23,8 @@ public interface TranslatorRepository extends JpaRepository<Translator, Translat
List<Translator> findByTranslatorKeyOrderByVersionNoDesc(Integer translatorKey);
Optional<Translator> findTop1ByTranslatorKeyOrderByVersionNoDesc(Integer translatorKey);
@Modifying(clearAutomatically = true)
@Query("update Translator set status = :status where translatorKey = :trKey")
void bulkModifyingByTrKeyToStatus(int trKey, String status);
}

View File

@ -34,6 +34,7 @@ public class TranslatorService extends BaseService {
@Transactional
public void saveTranslatorInfo(Translator translator) {
translator.setStatus("DST007");
if(translator.getTranslatorKey()==null){
Translator dbTranslator = translatorRepository.findFirstByOrderByTranslatorKeyDesc().orElse(null);
translator.setTranslatorKey(dbTranslator == null?1:(dbTranslator.getTranslatorKey()+1));
@ -157,8 +158,7 @@ public class TranslatorService extends BaseService {
@Transactional
public void deleteTranslatorInfo(int trKey) {
translatorCareerRepository.deleteByTranslatorKey(trKey);
translatorRepository.deleteByTranslatorKey(trKey);
translatorRepository.bulkModifyingByTrKeyToStatus(trKey, "DST008");
}
public TranslatorFile selectTranslatorFile(Integer translatorKey, Integer versionNo, Integer fileSeq) {

View File

@ -6,6 +6,7 @@
<mapper namespace="com.dbnt.faisp.main.faStatistics.crackdownsStatus.mapper.CrackdownStatusMapper">
<sql id="selectCrackdownStatusListWhere">
<where>
c.status &lt;> 'DST008'
<if test='year != null and year != ""'>
and extract(year from a.napo_dt) = #{year}::numeric
</if>

View File

@ -4,84 +4,91 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.faisp.main.faStatistics.crackdownsStatus.mapper.ProcessResultMapper">
<sql id="selectProcessResultListWhere">
<where>
<if test='year != null and year != ""'>
And EXTRACT(YEAR FROM pr.wrt_dt) = EXTRACT(YEAR FROM CAST(#{year} AS DATE)::TIMESTAMP)
</if>
<if test='caseNum != null and caseNum != ""'>
AND caseNum = #{caseNum}
</if>
<if test='crackdownPolice != null and crackdownPolice != ""'>
AND crackdown_police = #{crackdownPolice}
</if>
<if test='boatNameKr != null and boatNameKr != ""'>
AND boat_name_kr LIKE CONCAT('%', #{boatNameKr}, '%')
</if>
<if test='violation != null and violation != ""'>
AND violation = #{violation}
</if>
<if test='sentencingCourt != null and sentencingCourt != ""'>
AND sentencing_court LIKE CONCAT('%', #{sentencingCourt}, '%')
</if>
<if test='sentencingDetail != null and sentencingDetail != ""'>
AND sentencing_detail LIKE CONCAT('%', #{sentencingDetail}, '%')
</if>
<if test='executionDetail != null and executionDetail != ""'>
AND execution_detail = #{executionDetail}
</if>
<if test='returnDt != null'>
AND return_dt = #{returnDt}::DATE
</if>
<if test='consignmentStartDt != null'>
AND consignment_start_dt = #{consignmentStartDt}::DATE
</if>
<if test='consignmentEndDt != null'>
AND consignment_end_dt = #{consignmentEndDt}::DATE
</if>
<if test='confiscationDt != null'>
AND confiscation_dt = #{confiscationDt}::DATE
</if>
<if test='boatDisposalDt != null'>
AND boat_disposal_dt = #{boatDisposalDt}::DATE
</if>
</where>
</sql>
<sql id="selectProcessResultListWhere">
<where>
fb.status &lt;> 'DST008'
<if test='year != null and year != ""'>
And EXTRACT(YEAR FROM pr.wrt_dt) = ${year}
</if>
<if test='caseNum != null and caseNum != ""'>
AND caseNum = #{caseNum}
</if>
<if test='crackdownPolice != null and crackdownPolice != ""'>
AND crackdown_police = #{crackdownPolice}
</if>
<if test='boatNameKr != null and boatNameKr != ""'>
AND boat_name_kr LIKE CONCAT('%', #{boatNameKr}, '%')
</if>
<if test='violation != null and violation != ""'>
AND violation = #{violation}
</if>
<if test='sentencingCourt != null and sentencingCourt != ""'>
AND sentencing_court LIKE CONCAT('%', #{sentencingCourt}, '%')
</if>
<if test='sentencingDetail != null and sentencingDetail != ""'>
AND sentencing_detail LIKE CONCAT('%', #{sentencingDetail}, '%')
</if>
<if test='executionDetail != null and executionDetail != ""'>
AND execution_detail = #{executionDetail}
</if>
<if test='returnDt != null'>
AND return_dt = #{returnDt}::DATE
</if>
<if test='consignmentStartDt != null'>
AND consignment_start_dt = #{consignmentStartDt}::DATE
</if>
<if test='consignmentEndDt != null'>
AND consignment_end_dt = #{consignmentEndDt}::DATE
</if>
<if test='confiscationDt != null'>
AND confiscation_dt = #{confiscationDt}::DATE
</if>
<if test='boatDisposalDt != null'>
AND boat_disposal_dt = #{boatDisposalDt}::DATE
</if>
</where>
</sql>
<select id="selectProcessResultList" resultType="ProcessResult" parameterType="ProcessResult">
<select id="selectProcessResultList" resultType="ProcessResult" parameterType="ProcessResult">
SELECT DISTINCT
pr.pr_key
, cs.cds_key
, cs.case_num
, cs.napo_sea_point_lon
, cs.napo_sea_point_lat
, cs.napo_sea_point_detail
, fb.boat_name_kr
, pr.sentencing_court
, pr.sentencing_detail
, pr.execution_detail
, pr.return_dt
, pr.consignment_start_dt
, pr.consignment_end_dt
, pr.confiscation_dt
, pr.boat_disposal_dt
, pr.wrt_dt
, prv.upd_dt AS updDt
pr.pr_key
, cs.cds_key
, cs.case_num
, cs.napo_sea_point_lon
, cs.napo_sea_point_lat
, cs.napo_sea_point_detail
, fb.boat_name_kr
, pr.sentencing_court
, pr.sentencing_detail
, pr.execution_detail
, pr.return_dt
, pr.consignment_start_dt
, pr.consignment_end_dt
, pr.confiscation_dt
, pr.boat_disposal_dt
, pr.wrt_dt
, prv.upd_dt AS updDt
FROM process_result pr
INNER JOIN crackdown_status cs
ON pr.cds_key = cs.cds_key
INNER JOIN fishing_boat fb
ON pr.cds_key = fb.cds_key
LEFT JOIN violation v
ON fb.fb_key = v.fb_key
INNER JOIN (
INNER JOIN crackdown_status cs
ON pr.cds_key = cs.cds_key
INNER JOIN fishing_boat fb
ON pr.cds_key = fb.cds_key
LEFT JOIN violation v
ON fb.fb_key = v.fb_key
INNER JOIN (
SELECT pr_key ,MAX(wrt_dt) AS upd_dt
FROM process_result_version
GROUP BY pr_key
) prv
ON pr.pr_key = prv.pr_key
) prv
ON pr.pr_key = prv.pr_key
<include refid="selectProcessResultListWhere"></include>
ORDER BY pr.pr_key DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
</select>
</select>
<select id="selectProcessResultYearParam" resultType="int" parameterType="ProcessResult">
select distinct extract(year from wrt_dt) as year
from process_result
where wrt_dt is not null
</select>
</mapper>

View File

@ -4,307 +4,312 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.faisp.main.translator.mapper.TranslatorMapper">
<sql id="selectTranslatorListWhere">
<where>
ogdp1 in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<if test='trLang != null and trLang != ""'>
and tr_lang = #{trLang}
</if>
<if test='ogdp1 != null and ogdp1 != ""'>
and ogdp1 = #{ogdp1}
</if>
<if test='trName != null and trName != ""'>
and tr_name = #{trName}
</if>
<if test='trNny != null and trNny != ""'>
and tr_nny = #{trNny}
</if>
<if test='trVisa != null and trVisa != ""'>
and tr_visa = #{trVisa}
</if>
<if test='startDate != null and startDate != ""'>
and apt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and apt_dt &lt;= #{endDate}::date+1
</if>
<if test='dmlYn != null and dmlYn != ""'>
and dml_yn = #{dmlYn}
</if>
</where>
</sql>
<select id="selectTranslatorList" resultType="Translator" parameterType="Translator">
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone
<sql id="selectTranslatorListWhere">
<where>
ogdp1 in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
and status &lt;> 'DST008'
<if test='trLang != null and trLang != ""'>
and tr_lang = #{trLang}
</if>
<if test='ogdp1 != null and ogdp1 != ""'>
and ogdp1 = #{ogdp1}
</if>
<if test='trName != null and trName != ""'>
and tr_name = #{trName}
</if>
<if test='trNny != null and trNny != ""'>
and tr_nny = #{trNny}
</if>
<if test='trVisa != null and trVisa != ""'>
and tr_visa = #{trVisa}
</if>
<if test='startDate != null and startDate != ""'>
and apt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and apt_dt &lt;= #{endDate}::date+1
</if>
<if test='dmlYn != null and dmlYn != ""'>
and dml_yn = #{dmlYn}
</if>
</where>
</sql>
<select id="selectTranslatorList" resultType="Translator" parameterType="Translator">
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
<include refid="selectTranslatorListWhere"></include>
order by translator_key desc
order by translator_key desc
limit #{rowCnt} offset #{firstIndex}
</select>
<select id="selectTranslatorListCnt" resultType="int" parameterType="Translator">
select count(*)
from(
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
<include refid="selectTranslatorListWhere"></include>
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
<include refid="selectTranslatorListWhere"></include>
) a
</select>
<select id="selectHistoryList" resultType="Translator" parameterType="Translator">
select translator_key,
version_no,
wrt_organ,
wrt_part,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_title,
wrt_nm,
wrt_dt
from translator_info
where translator_key = #{translatorKey}
order by wrt_dt desc
select translator_key,
version_no,
wrt_organ,
wrt_part,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_title,
wrt_nm,
wrt_dt
from translator_info
where translator_key = #{translatorKey}
order by wrt_dt desc
</select>
<select id="HistoryView" resultType="Translator" parameterType="Translator">
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone,
remark
from translator_info a
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
where translator_key = #{translatorKey}
and version_no = #{versionNo}
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone,
remark
from translator_info a
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
where translator_key = #{translatorKey}
and version_no = #{versionNo}
</select>
<select id="selectCareerList" resultType="TranslatorCrr" parameterType="TranslatorCrr">
select career_seq,
translator_key,
his_gubun,
contents,
remark,
tc_dt
from translator_career
where translator_key = #{translatorKey}
and his_gubun = #{hisGubun}
order by career_seq desc
select career_seq,
translator_key,
his_gubun,
contents,
remark,
tc_dt
from translator_career
where translator_key = #{translatorKey}
and his_gubun = #{hisGubun}
order by career_seq desc
</select>
<select id="selectStatisticsLangCnt" resultType="com.dbnt.faisp.util.ParamMap">
select (ROW_NUMBER() OVER()) AS rownum,
cm.item_value as lang ,
sum(center+west+south+east+jeju) as cnt_total,
sum(center) as cnt_center,
sum(west) as cnt_west,
sum(south) as cnt_south,
sum(east) as cnt_east,
sum(jeju) as cnt_jeju
from (select
a.tr_lang as lang,
case
when c.organ_cd = 'OG002' or c.parent_organ = 'OG002' then 1
else 0
end as center,
case
when c.organ_cd = 'OG003' or c.parent_organ = 'OG003' then 1
else 0
end as west,
case
when c.organ_cd = 'OG004' or c.parent_organ = 'OG004' then 1
else 0
end as south,
case
when c.organ_cd = 'OG005' or c.parent_organ = 'OG005' then 1
else 0
end as east,
case
when c.organ_cd = 'OG006' or c.parent_organ = 'OG006' then 1
else 0
end as jeju
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
inner join organ_config c on a.ogdp1 = c.organ_cd) d
inner join code_mgt cm on d.lang=cm.item_cd
group by cm.item_value
select (ROW_NUMBER() OVER()) AS rownum,
cm.item_value as lang ,
sum(center+west+south+east+jeju) as cnt_total,
sum(center) as cnt_center,
sum(west) as cnt_west,
sum(south) as cnt_south,
sum(east) as cnt_east,
sum(jeju) as cnt_jeju
from (select
a.tr_lang as lang,
case
when c.organ_cd = 'OG002' or c.parent_organ = 'OG002' then 1
else 0
end as center,
case
when c.organ_cd = 'OG003' or c.parent_organ = 'OG003' then 1
else 0
end as west,
case
when c.organ_cd = 'OG004' or c.parent_organ = 'OG004' then 1
else 0
end as south,
case
when c.organ_cd = 'OG005' or c.parent_organ = 'OG005' then 1
else 0
end as east,
case
when c.organ_cd = 'OG006' or c.parent_organ = 'OG006' then 1
else 0
end as jeju
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
inner join organ_config c on a.ogdp1 = c.organ_cd
where a.status &lt;> 'DST008'
) d
inner join code_mgt cm on d.lang=cm.item_cd
group by cm.item_value
</select>
<select id="selectStatisticsLangTotal" resultType="com.dbnt.faisp.util.ParamMap">
select sum(cnt_total) as total_total,
sum(cnt_center) as total_center,
sum(cnt_west) as total_west,
sum(cnt_south) as total_south,
sum(cnt_east) as total_east,
sum(jeju) as total_jeju
from(
select cm.item_value ,
sum(center+west+south+east+jeju) as cnt_total,
sum(center) as cnt_center,
sum(west) as cnt_west,
sum(south) as cnt_south,
sum(east) as cnt_east,
sum(jeju) as jeju
from (select
a.tr_lang as lang,
case
when c.organ_cd = 'OG002' or c.parent_organ = 'OG002' then 1
else 0
end as center,
case
when c.organ_cd = 'OG003' or c.parent_organ = 'OG003' then 1
else 0
end as west,
case
when c.organ_cd = 'OG004' or c.parent_organ = 'OG004' then 1
else 0
end as south,
case
when c.organ_cd = 'OG005' or c.parent_organ = 'OG005' then 1
else 0
end as east,
case
when c.organ_cd = 'OG006' or c.parent_organ = 'OG006' then 1
else 0
end as jeju
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
inner join organ_config c on a.ogdp1 = c.organ_cd) d
inner join code_mgt cm on d.lang=cm.item_cd
group by cm.item_value
) a
select sum(cnt_total) as total_total,
sum(cnt_center) as total_center,
sum(cnt_west) as total_west,
sum(cnt_south) as total_south,
sum(cnt_east) as total_east,
sum(jeju) as total_jeju
from(
select cm.item_value ,
sum(center+west+south+east+jeju) as cnt_total,
sum(center) as cnt_center,
sum(west) as cnt_west,
sum(south) as cnt_south,
sum(east) as cnt_east,
sum(jeju) as jeju
from (select
a.tr_lang as lang,
case
when c.organ_cd = 'OG002' or c.parent_organ = 'OG002' then 1
else 0
end as center,
case
when c.organ_cd = 'OG003' or c.parent_organ = 'OG003' then 1
else 0
end as west,
case
when c.organ_cd = 'OG004' or c.parent_organ = 'OG004' then 1
else 0
end as south,
case
when c.organ_cd = 'OG005' or c.parent_organ = 'OG005' then 1
else 0
end as east,
case
when c.organ_cd = 'OG006' or c.parent_organ = 'OG006' then 1
else 0
end as jeju
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
inner join organ_config c on a.ogdp1 = c.organ_cd
where a.status &lt;> 'DST008') d
inner join code_mgt cm on d.lang=cm.item_cd
group by cm.item_value
) a
</select>
<select id="selectTranslatorListEx" resultType="com.dbnt.faisp.util.ParamMap" parameterType="Translator">
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
where wrt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<if test='trLang != null and trLang != ""'>
and tr_lang = #{trLang}
</if>
<if test='ogdp1 != null and ogdp1 != ""'>
and ogdp1 = #{ogdp1}
</if>
<if test='trName != null and trName != ""'>
and tr_name = #{trName}
</if>
<if test='trNny != null and trNny != ""'>
and tr_nny = #{trNny}
</if>
<if test='trVisa != null and trVisa != ""'>
and tr_visa = #{trVisa}
</if>
<if test='aptDt != null'>
and to_char(apt_dt,'YYYY-MM-DD') = #{aptDt}::VARCHAR
</if>
<if test='dmlYn != null and dmlYn != ""'>
and dml_yn = #{dmlYn}
</if>
order by translator_key desc
select a.translator_key,
version_no,
c.item_value as ogdp1,
d.item_value as tr_lang,
tr_career,
tr_name,
e.item_value as tr_sex,
tr_age,
f.item_value as tr_nny,
g.item_value as tr_edu,
tr_cft,
h.item_value as tr_visa,
dml_yn,
apt_dt,
tr_phone
from translator_info a
inner join (select translator_key, max(version_no) as lastVer
from translator_info
group by translator_key) b
on a.translator_key =b.translator_key and a.version_no = b.lastVer
left outer join code_mgt c on a.ogdp1 = c.item_cd
left outer join code_mgt d on a.tr_lang = d.item_cd
left outer join code_mgt e on a.tr_sex = e.item_cd
left outer join code_mgt f on a.tr_nny = f.item_cd
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
where wrt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
and status &lt;> 'DST008'
<if test='trLang != null and trLang != ""'>
and tr_lang = #{trLang}
</if>
<if test='ogdp1 != null and ogdp1 != ""'>
and ogdp1 = #{ogdp1}
</if>
<if test='trName != null and trName != ""'>
and tr_name = #{trName}
</if>
<if test='trNny != null and trNny != ""'>
and tr_nny = #{trNny}
</if>
<if test='trVisa != null and trVisa != ""'>
and tr_visa = #{trVisa}
</if>
<if test='aptDt != null'>
and to_char(apt_dt,'YYYY-MM-DD') = #{aptDt}::VARCHAR
</if>
<if test='dmlYn != null and dmlYn != ""'>
and dml_yn = #{dmlYn}
</if>
order by translator_key desc
</select>
<select id="selectTrFristUserSeq" resultType="String" parameterType="int">
select wrt_user_seq
from translator_info
where translator_key = #{translatorKey}
order by version_no asc
limit 1
select wrt_user_seq
from translator_info
where translator_key = #{translatorKey}
order by version_no asc
limit 1
</select>
</mapper>