feat: 주정차의견진술 - 심의목록, 심의결과 반영

dev
minuk926 2 years ago
parent 048d6b9d24
commit c4a6e4acad

@ -1,8 +1,7 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.dto.struct.MinUserinfoMapstruct;
import com.xit.biz.ctgy.service.IMinUserService;
import com.xit.biz.ctgy.v2.service.IMinUserService;
import com.xit.core.annotation.Secured;
import com.xit.core.annotation.SecurityPolicy;
import com.xit.core.api.IRestResponse;
@ -13,7 +12,6 @@ import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.mapstruct.factory.Mappers;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

@ -4,7 +4,7 @@ import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ParkingTargetDto;
import com.xit.biz.ctgy.dto.struct.JudgeListMapstruct;
import com.xit.biz.ctgy.dto.struct.MinSimsa680Mapstruct;
import com.xit.biz.ctgy.service.IParkingService;
import com.xit.biz.ctgy.v2.service.IParkingService;
import com.xit.core.annotation.Secured;
import com.xit.core.annotation.SecurityPolicy;
import com.xit.core.api.IRestResponse;

@ -5,7 +5,7 @@ import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeStdDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct;
import com.xit.biz.ctgy.service.IResidentAndDisabledService;
import com.xit.biz.ctgy.v2.service.IResidentAndDisabledService;
import com.xit.core.annotation.Secured;
import com.xit.core.annotation.SecurityPolicy;
import com.xit.core.api.IRestResponse;

@ -1,4 +1,106 @@
package com.xit.biz.ctgy.v2.repository;
public class ParkingDao {
import com.xit.biz.ctgy.dto.BoardDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ParkingTargetDto;
import com.xit.core.config.database.BaseMpowerDaoSupport;
import com.xit.core.support.sql.parser.QueryGenerator;
import com.xit.core.util.ConvertUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Repository;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Repository
public class ParkingDao extends BaseMpowerDaoSupport {
public Page<JudgeListDto> findParkings(JudgeListDto dto, Pageable pageable) {
final String cntSql = QueryGenerator.createNamedQuery("parking", "selectParkingListCnt")
.setParameter("msYear", dto.getMsYear())
.setParameter("msChasu", dto.getMsChasu())
.getQueryString();
final String listSql = QueryGenerator.createNamedQuery("parking", "selectParkingList")
.setParameter("msYear", dto.getMsYear())
.setParameter("msChasu", dto.getMsChasu())
.setParameter("page", pageable.getPageNumber())
.setParameter("size", pageable.getPageSize())
.getQueryString();
final String fieldStrs = "msYear, msChasu, msSdate, msStartsi, msEdate, msCdate, msClosesi, cnt";
return selectList(JudgeListDto.class, listSql, cntSql, fieldStrs, pageable);
}
public List<Map<String, Object>> selectParkingJudgeTeamGroupByChasuAndTeamList(JudgeListDto dto) {
final String listSql = QueryGenerator.createNamedQuery("parking", "selectTotParkingJudgeResultGroupByTeamAndChasu")
.setParameter("msuTeam", dto.getMsuTeam())
.setParameter("msChasu", dto.getMsChasu())
.setParameter("msSdate", dto.getMsSdate())
.setParameter("msEdate", dto.getMsEdate())
.getQueryString();
final String fieldStrs = "msuTeam, BU, SEO, MIBU, TOT, NAME";
return selectMapList(listSql, fieldStrs);
}
public List<Map<String, Object>> selectParkingJurgeResultGroupByCarnum(JudgeListDto dto) {
final String listSql = QueryGenerator.createNamedQuery("parking", "selectParkingJurgeResultGroupByCarnum")
.setParameter("msuTeam", dto.getMsuTeam())
.setParameter("msChasu", dto.getMsChasu())
.setParameter("msSdate", dto.getMsSdate())
.setParameter("msEdate", dto.getMsEdate())
.getQueryString();
final String fieldsStrs = "msMaincode, msSeq, msCarnum";
return selectMapList(listSql, fieldsStrs);
}
public List<Map<String, Object>> selectTotParkingJudgeResultGroupByUser(JudgeListDto dto) {
final String listSql = QueryGenerator.createNamedQuery("parking", "selectTotParkingJudgeResultGroupByUser")
.setParameter("msuTeam", dto.getMsuTeam())
.setParameter("msChasu", dto.getMsChasu())
.setParameter("msSdate", dto.getMsSdate())
.setParameter("msEdate", dto.getMsEdate())
.getQueryString();
final String fieldStrs = "BU, SEO, MIBU, TOT, NAME";
return selectMapList(listSql, fieldStrs);
}
public List<Map<String, Object>> selectParkingJudgeResultList(Map<String, Object> paramMap) {
final String listSql = QueryGenerator.createNamedQuery("parking", "selectParkingJudgeResultList")
.setParameter("msDatagb", String.valueOf(paramMap.get("msDatagb")))
.setParameter("msuTeam", String.valueOf(paramMap.get("msuTeam")))
.setParameter("msChasu", Long.parseLong(String.valueOf(paramMap.get("msChasu"))))
.setParameter("msSdate", (LocalDate)paramMap.get("msSdate"))
.setParameter("msEdate", (LocalDate) paramMap.get("msEdate"))
.setParameter("seqList", (List)paramMap.get("seqList"))
.setParameter("carnumList", (List)paramMap.get("carnumList"))
.getQueryString();
final String fieldsStrs = "msMaincode, msSeq, msCarnum, NAME, msResult, msResultNm, msuResult";
return selectMapList(listSql, fieldsStrs);
}
// public List<ParkingTargetDto> findParkingJudgeTargets(ParkingTargetDto dto) {
// return null;
// }
//
// public List<Long> findAllMsMaincode(Long msChasu, LocalDate msSdate, LocalDate msEdate) {
// return null;
// }
//
// public void deleteById(Long msMaincode) {
// }
//
// public List<JudgeListDto> findByUserJudges() {
// return null;
// }
}

@ -1,4 +1,8 @@
package com.xit.biz.ctgy.v2.repository;
public class ResidentAndDisabledDao {
import com.xit.core.config.database.BaseMpowerDaoSupport;
import org.springframework.stereotype.Repository;
@Repository
public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
}

@ -11,6 +11,7 @@ import com.xit.biz.ctgy.repository.IMinUserRepository;
import com.xit.biz.ctgy.repository.IParkingJudgeUserRepository;
import com.xit.biz.ctgy.repository.IParkingRepository;
import com.xit.biz.ctgy.repository.IRecallRepository;
import com.xit.biz.ctgy.v2.repository.ParkingDao;
import com.xit.biz.ctgy.v2.service.IParkingService;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
@ -35,6 +36,7 @@ import java.util.stream.Collectors;
public class ParkingService implements IParkingService {
private final IParkingRepository repository;
private final ParkingDao parkingDao;
private final IRecallRepository recallRepository;
private final IMinUserRepository userRepository;
private final IParkingJudgeUserRepository parkingJudgeUserRepository;
@ -43,7 +45,7 @@ public class ParkingService implements IParkingService {
@Override
@Transactional(readOnly = true)
public Page<JudgeListDto> findParkings(final JudgeListDto dto, Pageable pageable) {
return repository.findParkings(dto, pageable);
return parkingDao.findParkings(dto, pageable);
}
@Override
@ -56,16 +58,16 @@ public class ParkingService implements IParkingService {
// List<Map<String, Object>> totJudgeUserList = mapper.selectTotParkingJudgeResultGroupByUser(dto);
// totJudgeUserList.add(teamMap);
List<Map<String, Object>> teamList = mapper.selectParkingJudgeTeamGroupByChasuAndTeamList(dto);
List<Map<String, Object>> teamList = parkingDao.selectParkingJudgeTeamGroupByChasuAndTeamList(dto);
if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
// 차수별 심사자별 심사결과 합산
dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam")));
List<Map<String, Object>> totJudgeUserList = mapper.selectTotParkingJudgeResultGroupByUser(dto);
List<Map<String, Object>> totJudgeUserList = parkingDao.selectTotParkingJudgeResultGroupByUser(dto);
totJudgeUserList.add(teamList.get(0));
// 심사대상 차량 목록
List<Map<String,Object>> judgeCarList = mapper.selectParkingJurgeResultGroupByCarnum(dto);
List<Map<String,Object>> judgeCarList = parkingDao.selectParkingJurgeResultGroupByCarnum(dto);
// 차량별 심사자 심사결과 목록
Map<String, Object> paramMap = new HashMap<>();
@ -77,7 +79,7 @@ public class ParkingService implements IParkingService {
paramMap.put("seqList", judgeCarList.stream().map(m -> m.get("msSeq")).collect(Collectors.toList()));
paramMap.put("carnumList", judgeCarList.stream().map(m -> m.get("msCarnum")).collect(Collectors.toList()));
List<Map<String,Object>> jurgeUserList = mapper.selectParkingJudgeResultList(paramMap);
List<Map<String,Object>> jurgeUserList = parkingDao.selectParkingJudgeResultList(paramMap);
// List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> {
// paramMap.put("msSeq", m.get("msSeq"));
// paramMap.put("msCarnum", m.get("msCarnum"));

@ -16,6 +16,7 @@ import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@ -162,6 +163,70 @@ public abstract class BaseMpowerDaoSupport {
return dmlQuery(sql, "insert");
}
public Map<String, Object> selectMapOne(String sql, String fieldStr){
Objects.requireNonNull(sql, "SQL cannot be null");
Map<String,Object> map = null;
Client client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
try {
client.Request();
String result = client.getString("result", 0, 0);
int row;
if (result.equals("true")){
row = client.getMaxRow("list1");
if(row > 1) throw new MpowerException("조회된 데이타가 단일행이 아닙니다");
map = new HashMap<>();
List<String> fields = getFeilds(fieldStr);
for (int j = 0; j < fields.size(); j++) {
map.put(fields.get(j), client.getString("list1", 0, j));
}
}
return map;
}catch (Exception e){
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
disConnection(client);
}
}
public List<Map<String, Object>> selectMapList(String sql, String fieldStr){
Objects.requireNonNull(sql, "SQL cannot be null");
List<Map<String,Object>> list = new ArrayList<>();
Client client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
try {
client.Request();
String result = client.getString("result", 0, 0);
int row;
if (result.equals("true")){
row = client.getMaxRow("list1");
List<String> fields = getFeilds(fieldStr);
for(int i = 0; i < row; i++) {
Map<String, Object> map = new HashMap<>();
for (int j = 0; j < fields.size(); j++) {
map.put(fields.get(j), client.getString("list1", i, j));
}
list.add(map);
}
}
return list;
}catch (Exception e){
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
disConnection(client);
}
}
private String getQueryXml(String syntax, String sql){
log.info(sql);
return String.format(
@ -173,15 +238,6 @@ public abstract class BaseMpowerDaoSupport {
"' BATCH='false'>\n<SQL><![CDATA[\n",
sql,
"\n]]></SQL></QUERY></QUERYS>");
// return String.format(
// "%s%s%s%s%s%s%s",
// "<?xml version='1.0' encoding='euc-kr'?><QUERYS DBNAME='",
// dbName,
// "' DEBUG='true'><QUERY TYPE='",
// syntax,
// "' BATCH='false'><SQL><![CDATA[",
// sql,
// "]]></SQL></QUERY></QUERYS>");
}
private Client getConnection(){
@ -210,10 +266,8 @@ public abstract class BaseMpowerDaoSupport {
client.setInput("SQLXML", getQueryXml(syntax, sql));
try {
client.Request();
String result = client.getString("result", 0, 0);
int row;
if (result.equals("true")){
System.out.println("<<<<<<<<<<<<===========#$#$#$$##$#$$#$#$$$$$$$====>>>>>>>>>");
}
@ -251,8 +305,16 @@ public abstract class BaseMpowerDaoSupport {
fd.set(instance, StringUtils.EMPTY.equals(value)? null : Integer.parseInt(value));
} else if (fd.getType() == Long.class || fd.getType() == Long.TYPE){
fd.set(instance, StringUtils.EMPTY.equals(value)? null : Long.parseLong(value));
} else if (fd.getType() == LocalDateTime.class) {
//fd.set(instance, StringUtils.EMPTY.equals(value)? null : LocalDate.parse(value, DateTimeFormatter.ISO_DATE_TIME));
fd.set(instance, StringUtils.EMPTY.equals(value)? null : LocalDateTime.parse(value, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
//} else if (fd.getType() == LocalDate.class) fd.set(instance, Long.parseLong(client.getString("list1", row, j)));
} else if (fd.getType() == LocalDate.class) {
fd.set(instance, StringUtils.EMPTY.equals(value)? null : LocalDate.parse(value, DateTimeFormatter.ISO_DATE));
//fd.set(instance, StringUtils.EMPTY.equals(value)? null : LocalDate.parse(value, DateTimeFormatter.ISO_DATE_TIME));
// TODO : mpower에서 String 형태로 넘어오는 포맷이 표준에 맞지 않아 아래와 같이 처리
// 2022-01-01 13:15:30.0
fd.set(instance, StringUtils.EMPTY.equals(value)? null : LocalDate.parse(value.split(" ")[0], DateTimeFormatter.ofPattern("yyyy-MM-dd")));
//} else if (fd.getType() == LocalDate.class) fd.set(instance, Long.parseLong(client.getString("list1", row, j)));
} else {
@ -270,16 +332,6 @@ public abstract class BaseMpowerDaoSupport {
return instance;
}
// private <T> T getT(Class<T> type, List<String> fields, int row, Client client) {
// Map<String,Object> m = new HashMap<>();
//
// for (int j = 0; j < fields.size(); j++) {
// m.put(fields.get(j), client.getString("list1", row, j));
// }
// return DBUtils.convertToValueObject(m, type);
// }
private List<String> getFeilds(String fields) {
String[] strs = fields.split(",");
List<String> list = new ArrayList<>();

@ -20,6 +20,7 @@ import java.io.IOException;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
//TODO :: 공통 framework에 반영 필요
/**
* DTO LocalDate
* @JsonFormat(pattern="yyyy-MM-dd")
@ -29,7 +30,7 @@ import java.time.format.DateTimeFormatter;
* Responst ( -> ) @JsonFormat
*
*/
//@Configuration
@Configuration
@Slf4j
public class LocalDateTimeConfiguration {
private static final String DEFAULT_DATE_FMT = "yyyy-MM-dd";
@ -60,7 +61,7 @@ public class LocalDateTimeConfiguration {
@Override
public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
log.info(">>>>>>>>>>>>>>>>>>>>>LocalDateTimeConfiguration::addDeserializer-LocalDateTime");
return LocalDateTime.parse(p.getValueAsString(), DateTimeFormatter.ISO_LOCAL_DATE_TIME);
return LocalDateTime.parse(p.getValueAsString(), DateTimeFormatter.ISO_DATE_TIME);
//return LocalDateTime.parse(p.getValueAsString(), DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FMT));
}
});
@ -69,8 +70,8 @@ public class LocalDateTimeConfiguration {
@Override
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
log.info(">>>>>>>>>>>>>>>>>>>>>LocalDateTimeConfiguration::addDeserializer-LocalDate");
//return LocalDateTime.parse(p.getValueAsString(), DateTimeFormatter.ISO_DATE_TIME);
return LocalDate.parse(p.getValueAsString(), DateTimeFormatter.ofPattern(DEFAULT_DATE_FMT));
return LocalDate.parse(p.getValueAsString(), DateTimeFormatter.ISO_DATE);
//return LocalDate.parse(p.getValueAsString(), DateTimeFormatter.ofPattern(DEFAULT_DATE_FMT));
}
});
@ -97,8 +98,8 @@ public class LocalDateTimeConfiguration {
@Override
public void serialize(LocalDate localDate, JsonGenerator gen, SerializerProvider serializers) throws IOException {
log.info(">>>>>>>>>>>>>>>>>>>>>LocalDateTimeConfiguration::addSerializer-LocalDate");
//gen.writeString(DateTimeFormatter.ISO_DATE_TIME.format(value));
gen.writeString(localDate.format(DateTimeFormatter.ofPattern(DEFAULT_DATE_FMT)));
gen.writeString(DateTimeFormatter.ISO_DATE_TIME.format(localDate));
//gen.writeString(localDate.format(DateTimeFormatter.ofPattern(DEFAULT_DATE_FMT)));
}
});

@ -148,6 +148,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
}
//TODO :: 공통 framework에 반영 필요
/**
* NoSuchElementException
*
@ -220,7 +221,7 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
}
/*
//TODO :: 공통 framework에 반영 필요
javax.validation.constraints @NotNull

@ -5,6 +5,7 @@ import com.xit.core.support.sql.parser.sqlNodes.SqlNode;
import com.xit.core.util.Checks;
import org.dom4j.Element;
import java.time.LocalDate;
import java.util.List;
import java.util.StringJoiner;
@ -45,6 +46,12 @@ public class BasicSqlQuery implements SqlQuery {
return this;
}
@Override
public SqlQuery setParameter(int pos, LocalDate value) {
this.parameterMap.put(pos, value == null? "''" : "'"+String.valueOf(value)+"'");
return this;
}
@Override
public SqlQuery setParameter(int pos, List<String> list) {
if (list == null) {
@ -89,6 +96,16 @@ public class BasicSqlQuery implements SqlQuery {
return this;
}
@Override
public SqlQuery setParameter(String key, LocalDate value) {
try {
this.parameterMap.put(key, value == null ? "''" : "'"+String.valueOf(value)+"'");
}catch(Exception e){
e.printStackTrace();
}
return this;
}
@Override
public SqlQuery setParameter(String key, List<String> list) {
if (list == null) {

@ -1,5 +1,6 @@
package com.xit.core.support.sql.parser.sqlQuery;
import java.time.LocalDate;
import java.util.List;
public class EmptySqlQuery implements SqlQuery {
@ -24,6 +25,11 @@ public class EmptySqlQuery implements SqlQuery {
return null;
}
@Override
public SqlQuery setParameter(int pos, LocalDate value) {
return null;
}
@Override
public SqlQuery setParameter(int pos, List<String> list) {
return null;
@ -44,6 +50,11 @@ public class EmptySqlQuery implements SqlQuery {
return this;
}
@Override
public SqlQuery setParameter(String key, LocalDate value) {
return this;
}
@Override
public SqlQuery setParameter(String key, int value) {
return null;

@ -1,5 +1,6 @@
package com.xit.core.support.sql.parser.sqlQuery;
import java.time.LocalDate;
import java.util.List;
public interface SqlQuery {
@ -10,6 +11,7 @@ public interface SqlQuery {
SqlQuery setParameter(int pos, boolean value);
SqlQuery setParameter(int pos, Long value);
SqlQuery setParameter(int pos, LocalDate value);
SqlQuery setParameter(int pos, List<String> list);
@ -20,6 +22,9 @@ public interface SqlQuery {
SqlQuery setParameter(String key, int value);
SqlQuery setParameter(String key, Long value);
SqlQuery setParameter(String key, LocalDate value);
SqlQuery setParameter(String key, List<String> list);
String getQueryString();

@ -1,4 +1,4 @@
package com.xit.core.util.security;
package com.xit.core.util;
import com.xit.core.util.Checks;
@ -12,6 +12,9 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
/**
* //TODO :: 공통 framework에 반영 필요
*/
public class ConvertUtils {
private static final String DEFAULT_DATE_FMT = "yyyy-MM-dd";
private static final String DEFAULT_DATE_TIME_FMT = "yyyy-MM-dd HH:mm:ss";
@ -26,12 +29,12 @@ public class ConvertUtils {
return new SimpleDateFormat(format).format(date);
}
public String getStringDateFromLocalDate(@NotNull LocalDate localDate, @Nullable String format) {
public static String getStringDateFromLocalDate(@NotNull LocalDate localDate, @Nullable String format) {
if(Checks.isNull(format)) format = "DEFAULT_DATE_FMT";
return localDate.format(DateTimeFormatter.ofPattern(format));
}
public String getStringDateTimeFromLocalDate(@NotNull LocalDate localDate, @Nullable String format) {
public static String getStringDateTimeFromLocalDate(@NotNull LocalDate localDate, @Nullable String format) {
if(Checks.isNull(format)) format = "DEFAULT_DATE_TIME_FMT";
return localDate.format(DateTimeFormatter.ofPattern(format));
}

@ -16,6 +16,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
//TODO :: 공통 framework에 반영 필요
public class DBUtils {
/**
*

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings namespace="parking">
<native-query id="selectParkingList">
/* parking-mapper|selectParkingList|julim */
SELECT ms_year,
ms_chasu,
ms_sdate,
ms_startsi,
ms_edate,
ms_cdate,
ms_closesi,
cnt
FROM (
SELECT R.*, ROWNUM rn
FROM (
SELECT ms_year,
ms_chasu,
ms_sdate,
ms_startsi,
ms_edate,
ms_cdate,
ms_closesi,
count(ms_maincode) AS cnt
FROM min_simsa680
WHERE ms_year = #{msYear}
<if test="msChasu != null and msChasu != ''">
AND ms_chasu = #{msChasu}
</if>
GROUP BY ms_year, ms_chasu, ms_sdate, ms_startsi, ms_edate, ms_cdate, ms_closesi
ORDER BY ms_year DESC, ms_chasu DESC
) R
WHERE ROWNUM &lt;= (#{page} + 1) * #{size}
)
WHERE rn &gt; #{page} * #{size}
AND ROWNUM &lt;= #{size}
</native-query>
<native-query id="selectParkingListCnt">
/* parking-mapper|selectParkingListCnt|julim */
SELECT count(*) AS totalCount
FROM (
SELECT ms_year
FROM min_simsa680
WHERE ms_year = #{msYear}
<if test="msChasu != null and msChasu != ''">
AND ms_chasu = #{msChasu}
</if>
GROUP BY ms_year, ms_chasu, ms_sdate, ms_startsi, ms_edate, ms_cdate, ms_closesi
)
</native-query>
<native-query id="insertParkingJudgeTargetIntoSelect">
/* parking-mapper|insertParkingJudgeTargetIntoSelect|julim */
insert
into min_simsa680(
ms_maincode,
ms_seq,
ms_carnum,
ms_year,
ms_chasu,
ms_sdate,
ms_startsi,
ms_edate,
ms_cdate,
ms_closesi,
ms_wdate,
ms_pos,
ms_result,
ms_jbtime
) select TR.rc_code,
TR.rc_seq,
TM.mm_ocarno,
#{msYear},
#{msChasu},
#{msSdate},
#{msStartsi},
#{msEdate},
#{msCdate},
#{msClosesi},
TM.mm_wdate,
TD.do_bname||''||TJ.mj_pos,
#{msResult},
TJ.mj_jbtime
from tf680_recall TR
join tf680_main TM on TR.rc_code = #{rcCode}
and TM.mm_code = TR.rc_maincode
and TR.rc_ir_transfer = '1'
and TR.rc_state = '0'
join tf680_jucha TJ on TM.mm_code = TJ.mj_code
join tf680_dong TD
on TJ.mj_dong = TD.do_code
</native-query>
<native-query id="selectTotParkingJudgeResultGroupByTeamAndChasu">
/* parking-mapper|selectTotParkingJudgeResultGroupByTeamAndChasu|julim */
SELECT msu_team AS msuTeam
, NVL(SUM(DECODE(MS.ms_result, '2', 1, 0)), 0) bu
, 0 as seo
, NVL(SUM(DECODE(MS.ms_result, '1', 1, 0)), 0) mibu
, NVL(SUM(DECODE(MS.ms_result, '1', 1, '2', 1, 0)), 0) tot
, '결과' as name
FROM min_simsa680 MS
, msu680_view MV
WHERE MS.ms_maincode = MV.msu_maincode
<if test="msuTeam != null and msuTeam != ''">
AND MV.msu_team = #{msuTeam}
</if>
AND MS.ms_chasu = #{msChasu}
AND MS.ms_sdate = #{msSdate}
AND MS.ms_edate = #{msEdate}
GROUP BY MV.msu_team, MS.ms_chasu
</native-query>
<native-query id="selectParkingJudgeTeamGroupByChasuAndTeamList">
/* parking-mapper|selectParkingJudgeTeamGroupByChasuAndTeamList|julim */
SELECT MV.msu_team AS msuTeam
, NVL(SUM(DECODE(MS.ms_result, '2', 1, 0)), 0) bu
, 0 as seo
, NVL(SUM(DECODE(MS.ms_result, '1', 1, 0)), 0) mibu
, NVL(SUM(DECODE(MS.ms_result, '1', 1, '2', 1, 0)), 0) tot
, '결과' as name
FROM min_simsa680 MS
, msu680_view MV
WHERE MS.ms_maincode = MV.msu_maincode
<if test='msuTeam != null and msuTeam != ""'>
AND MV.msu_team = #{msuTeam}
</if>
AND MS.ms_chasu = #{msChasu}
AND MS.ms_sdate = #{msSdate}
AND MS.ms_edate = #{msEdate}
GROUP BY MS.ms_chasu, MV.msu_team
ORDER BY MS.ms_chasu, MV.msu_team
</native-query>
<native-query id="selectTotParkingJudgeResultGroupByUser">
/* parking-mapper|selectTotParkingJudgeResultByUser|julim */
SELECT SUM(DECODE(MSU_RESULT, '2', 1, 0)) as bu
, 0 as seo
, SUM(DECODE(MSU_RESULT, '1', 1, 0)) as mibu
, SUM(DECODE(MSU_RESULT, '1', 1, '2', 1, 0)) as tot
, MU.name
FROM min_simsa680 MS
, min_simsa_user680 MSU
, min_userinfo MU
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_chasu = #{msChasu}
AND MS.ms_sdate = #{msSdate}
AND MS.ms_edate = #{msEdate}
AND MSU.msu_userid = MU.userid
<if test="msuTeam != null and msuTeam != ''">
AND MSU.msu_team = #{msuTeam}
</if>
GROUP BY MSU.msu_userid, MU.name
ORDER BY MSU.msu_userid, MU.name
</native-query>
<native-query id="selectParkingJurgeResultGroupByCarnum">
/* parking-mapper|selectParkingJurgeResultGroupByCarnum|julim */
SELECT MS.ms_maincode AS msMaincode
, MS.ms_seq AS msSeq
, MS.ms_carnum AS msCarnum
FROM min_simsa680 MS
, min_simsa_user680 MSU
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_chasu = #{msChasu}
AND MS.ms_sdate = #{msSdate}
AND MS.ms_edate = #{msEdate}
<if test="msuTeam != null and msuTeam != ''">
AND MSU.msu_team = #{msuTeam}
</if>
GROUP BY MS.ms_maincode, MS.ms_seq, MS.ms_carnum
ORDER BY MS.ms_maincode, MS.ms_seq, MS.ms_carnum
</native-query>
<native-query id="selectParkingJudgeResultList">
/* parking-mapper|selectParkingJudgeResultList|julim */
SELECT MS.ms_maincode AS msMaincode
, MS.ms_seq AS msSeq
, MS.ms_carnum AS msCarnum
, MU.name
, MS.ms_result AS msResult
, (SELECT code_nm
FROM tb_cmm_code_s
WHERE code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'RESULT'
AND code_cd = MS.ms_result) as msResultNm
, (SELECT code_nm
FROM tb_cmm_code_s
WHERE code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'RESULT'
AND code_cd = MSU.msu_result) as msuResult
FROM min_simsa680 MS
, min_simsa_user680 MSU
, min_userinfo MU
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_chasu = #{msChasu}
AND MS.ms_sdate = #{msSdate}
AND MS.ms_edate = #{msEdate}
AND MS.ms_seq in #{seqList}
AND MS.ms_carnum in #{carnumList}
<if test="msuTeam != null and msuTeam != ''">
AND MSU.msu_team = #{msuTeam}
</if>
AND MSU.msu_userid = MU.userid
ORDER BY MSU.msu_userid, MU.name, MS.ms_maincode, MS.ms_seq, MS.ms_carnum
</native-query>
<native-query id="selectDashboardJudgeList">
/* parking-mapper|selectDashboardJudgeList|julim */
SELECT MS.ms_edate
, MSU.msu_team
, MU.name
, SUM(DECODE(MSU.msu_result, 0, 0, 1)) jcnt
, COUNT(*) tcnt
FROM min_simsa680 MS
, min_simsa_user680 MSU
, min_userinfo MU
, (SELECT *
FROM (SELECT ms_edate
FROM min_simsa680
WHERE MS_RESULT = '0'
ORDER BY ms_edate DESC)
WHERE ROWNUM = 1) T
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_result = '0'
AND MSU.msu_userid = MU.userid
AND MS.ms_edate = T.ms_edate
GROUP BY MS.ms_edate, MSU.msu_team, MU.name
ORDER BY MSU.msu_team, MU.name
</native-query>
</entity-mappings>
Loading…
Cancel
Save