Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aae556a180 | |||
| 7643723f25 | |||
| 5516f71bfc | |||
| f1b3f1d953 | |||
| 18cf7d1a62 | |||
| a2d57166fc | |||
| 0d6448bfbf | |||
| ac8d637dc2 | |||
| eea2d74c70 | |||
| 0850d6d356 | |||
| 163fdb34cb | |||
| 7eaa24e4fc | |||
| 71fa90d378 | |||
| 0018734679 | |||
| 8697504d46 |
@ -4,7 +4,6 @@ import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -26,6 +25,7 @@ public class MainController {
|
||||
|
||||
private final MainService mainService;
|
||||
|
||||
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@GetMapping("/category")
|
||||
@ -50,8 +50,8 @@ public class MainController {
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@PostMapping("/inserEvent")
|
||||
public ApiResponse<String> inserEvent(@ReqMap MapDto map) {
|
||||
return mainService.inserEvent(map);
|
||||
public ApiResponse<String> insertEvent(@ReqMap MapDto map) {
|
||||
return mainService.insertEvent(map);
|
||||
}
|
||||
|
||||
@Admin
|
||||
@ -76,4 +76,11 @@ public class MainController {
|
||||
long memberSeq = map.getInt("memberSeq");
|
||||
return mainService.rejectMember(memberSeq);
|
||||
}
|
||||
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@PostMapping("/getUserLeaveRecord")
|
||||
public ApiResponse<MapDto> getUserLeaveRecord(@ReqMap MapDto map) {
|
||||
return mainService.getUserLeaveRecord(map);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,4 +180,11 @@ public class ProjectController {
|
||||
return ApiResponse.ok(netprojctService.selectUserProjectPeriod(projctSeq));
|
||||
}
|
||||
|
||||
@ParameterCheck
|
||||
@GetMapping("/people/{memberSeq}")
|
||||
public ApiResponse<List<MapDto>> selectUserProjectPeriod2(@PathVariable int memberSeq) {
|
||||
|
||||
return ApiResponse.ok(netprojctService.selectUserProjectPeriod2(memberSeq));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,9 +30,11 @@ import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.context.SecurityContextHolderStrategy;
|
||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
@ -242,6 +244,9 @@ public class UserController {
|
||||
|
||||
}
|
||||
|
||||
// @GetMapping("checkUserSession")
|
||||
// public
|
||||
|
||||
|
||||
// 유저 세션 체크
|
||||
@GetMapping(value = "check")
|
||||
@ -258,6 +263,21 @@ public class UserController {
|
||||
return ApiResponse.ok(sessionData);
|
||||
}
|
||||
|
||||
// 유저 세션 권한 체크
|
||||
@PostMapping(value = "authCheck")
|
||||
public ApiResponse<?> authCheck(@ReqMap MapDto map) {
|
||||
String memberId = map.getString("memberId");
|
||||
if(!StringUtils.hasText(memberId)) return ApiResponse.error(HttpStatus.BAD_REQUEST, "파라미터 오류");
|
||||
|
||||
String userRole = "";
|
||||
MemberVo vo = AuthUtil.getUser();
|
||||
if(vo != null && memberId.equals(vo.getLoginId())) {
|
||||
userRole = vo.getRole();
|
||||
}
|
||||
|
||||
return ApiResponse.ok(userRole);
|
||||
}
|
||||
|
||||
// rememberMe 확인용
|
||||
@GetMapping(value = "rememberCheck")
|
||||
public ApiResponse<?> rememberCheck(HttpServletRequest request) {
|
||||
@ -308,9 +328,6 @@ public class UserController {
|
||||
|
||||
/**
|
||||
* 사원 목록 전체 조회
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@ParameterCheck
|
||||
@GetMapping("/allUserList")
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
package io.company.localhost.controller.common;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -65,60 +69,84 @@ public class WeatherController {
|
||||
JsonNode nodeData = objectMapper.readTree(jsonData);
|
||||
JsonNode forecastList = nodeData.get("list");
|
||||
|
||||
// 날짜별로 데이터 그룹화
|
||||
// 현재 날짜 및 시간 계산
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDateTime nowTime = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 날짜별 데이터를 그룹화
|
||||
Map<String, List<String>> dailyWeathers = new HashMap<>();
|
||||
Map<String, List<String>> dailyDescriptions = new HashMap<>();
|
||||
Map<String, List<String>> dailyIcons = new HashMap<>();
|
||||
|
||||
// 오늘 예보 중 가장 가까운 예보 저장 변수
|
||||
JsonNode closestForecastToday = null;
|
||||
long minDiff = Long.MAX_VALUE;
|
||||
|
||||
// forecastList를 순회하며 데이터를 그룹화하고, 오늘의 경우 가장 가까운 forecast 선택
|
||||
for (JsonNode forecast : forecastList) {
|
||||
String date = forecast.get("dt_txt").asText().split(" ")[0]; //날짜 추출
|
||||
String dtTxt = forecast.get("dt_txt").asText();
|
||||
String date = dtTxt.split(" ")[0]; // 날짜 추출 (예: "2025-04-04")
|
||||
|
||||
JsonNode weather = forecast.get("weather").get(0);
|
||||
String mainWeather = weather.get("main").asText();
|
||||
String description = weather.get("description").asText();
|
||||
String icon = weather.get("icon").asText();
|
||||
|
||||
if (!dailyWeathers.containsKey(date)) {
|
||||
dailyWeathers.put(date, new ArrayList<>());
|
||||
dailyDescriptions.put(date, new ArrayList<>());
|
||||
dailyIcons.put(date, new ArrayList<>());
|
||||
// 해당 날짜의 리스트에 추가 (map이 없으면 생성)
|
||||
dailyWeathers.computeIfAbsent(date, k -> new ArrayList<>()).add(mainWeather);
|
||||
dailyDescriptions.computeIfAbsent(date, k -> new ArrayList<>()).add(description);
|
||||
dailyIcons.computeIfAbsent(date, k -> new ArrayList<>()).add(icon);
|
||||
|
||||
// 오늘 날짜의 forecast라면 현재 시간과의 차이 계산
|
||||
if (date.equals(today.toString())) {
|
||||
LocalDateTime forecastTime = LocalDateTime.parse(dtTxt, formatter);
|
||||
long diff = Math.abs(Duration.between(forecastTime, nowTime).toMillis());
|
||||
if (diff < minDiff) {
|
||||
minDiff = diff;
|
||||
closestForecastToday = forecast;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dailyWeathers.get(date).add(mainWeather);
|
||||
dailyDescriptions.get(date).add(description);
|
||||
dailyIcons.get(date).add(icon);
|
||||
}
|
||||
|
||||
// 각 날짜별 대표 날씨 결정 (가장 빈번한 날씨 상태)
|
||||
// 최종적으로 각 날짜의 대표 날씨 결정
|
||||
List<WeatherVo> dailyWeatherList = new ArrayList<>();
|
||||
|
||||
for (String date : dailyWeathers.keySet()) {
|
||||
String repMainWeather;
|
||||
String repDescription;
|
||||
String repIcon;
|
||||
|
||||
// 오늘인 경우, 가장 가까운 forecast의 아이콘과 설명 사용
|
||||
if (date.equals(today.toString()) && closestForecastToday != null) {
|
||||
JsonNode weather = closestForecastToday.get("weather").get(0);
|
||||
repMainWeather = weather.get("main").asText();
|
||||
repDescription = weather.get("description").asText();
|
||||
repIcon = weather.get("icon").asText();
|
||||
} else {
|
||||
// 기타 날짜는 기존 방식대로 가장 빈번한 날씨 상태 선택
|
||||
List<String> weathers = dailyWeathers.get(date);
|
||||
List<String> descriptions = dailyDescriptions.get(date);
|
||||
List<String> icons = dailyIcons.get(date);
|
||||
|
||||
// 가장 빈번한 날씨 찾기(카운팅)
|
||||
Map<String, Integer> weatherCounts = new HashMap<>();
|
||||
for (String w : weathers) {
|
||||
weatherCounts.put(w, weatherCounts.getOrDefault(w, 0) + 1);
|
||||
}
|
||||
|
||||
String mainWeather = "";
|
||||
repMainWeather = "";
|
||||
int maxCount = 0;
|
||||
|
||||
for (Map.Entry<String, Integer> entry : weatherCounts.entrySet()) {
|
||||
if (entry.getValue() > maxCount) {
|
||||
maxCount = entry.getValue();
|
||||
mainWeather = entry.getKey();
|
||||
repMainWeather = entry.getKey();
|
||||
}
|
||||
}
|
||||
int repIndex = weathers.indexOf(repMainWeather);
|
||||
repDescription = descriptions.get(repIndex);
|
||||
repIcon = icons.get(repIndex);
|
||||
}
|
||||
|
||||
// 평균값 계산
|
||||
int mainWeatherIndex = weathers.indexOf(mainWeather);
|
||||
String description = descriptions.get(mainWeatherIndex);
|
||||
String icon = icons.get(mainWeatherIndex);
|
||||
|
||||
dailyWeatherList.add(new WeatherVo(date, mainWeather, description, icon));
|
||||
dailyWeatherList.add(new WeatherVo(date, repMainWeather, repDescription, repIcon));
|
||||
}
|
||||
|
||||
return dailyWeatherList;
|
||||
|
||||
@ -37,4 +37,6 @@ public interface CommutersMapper {
|
||||
|
||||
int deleteCommuters(MapDto map);
|
||||
|
||||
MapDto selectUserLeaveWorkList(MapDto map);
|
||||
|
||||
}
|
||||
|
||||
@ -34,4 +34,7 @@ public interface NetprojctMapper {
|
||||
int deleteProject(MapDto map);
|
||||
|
||||
List<MapDto> selectUserProjectPeriod(int projectSeq);
|
||||
|
||||
List<MapDto> selectUserProjectPeriod2(int memberSeq);
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,8 @@ import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import io.company.localhost.common.annotation.ReqMap;
|
||||
import io.company.localhost.common.dto.ApiResponse;
|
||||
import io.company.localhost.common.dto.MapDto;
|
||||
import io.company.localhost.mapper.CommutersMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -107,4 +109,15 @@ public class CommutersService {
|
||||
* commutersMapper.updateCommuterProject(map) > 0; }
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 사용자의 퇴근 기록 조회
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ApiResponse<MapDto> selectUserLeaveWorkList(@ReqMap MapDto map) {
|
||||
map.put("currentDate", LocalDateTime.now());
|
||||
return ApiResponse.ok(commutersMapper.selectUserLeaveWorkList(map));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,6 +21,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import io.company.localhost.common.dto.ApiResponse;
|
||||
import io.company.localhost.common.dto.MapDto;
|
||||
import io.company.localhost.utils.AuthUtil;
|
||||
import io.company.localhost.vo.MemberVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Service
|
||||
@ -28,12 +30,10 @@ import lombok.RequiredArgsConstructor;
|
||||
public class MainService {
|
||||
|
||||
private final commoncodService commoncodService;
|
||||
|
||||
private final NetmemberService netmemberService;
|
||||
|
||||
private final localvacaService localvacaService;
|
||||
|
||||
private final LocalevntService localevntService;
|
||||
private final CommutersService commutersService;
|
||||
|
||||
|
||||
/**
|
||||
@ -72,15 +72,13 @@ public class MainService {
|
||||
if(localevntService.selectCheckEvent(map) > 0) {
|
||||
localevntService.deleteEvent(map);
|
||||
return ApiResponse.okMessage("이벤트 삭제");
|
||||
//return ApiResponse.error(HttpStatus.CONFLICT, "이미 동일한 이벤트가 존재합니다");
|
||||
|
||||
} else {
|
||||
// localevntService.insertEvent(map);
|
||||
// return ApiResponse.okMessage("이벤트 추가");
|
||||
return ApiResponse.error(HttpStatus.CONFLICT, "해당 이벤트가 존재하지 않습니다");
|
||||
}
|
||||
}
|
||||
|
||||
public ApiResponse<String> inserEvent(MapDto map) {
|
||||
public ApiResponse<String> insertEvent(MapDto map) {
|
||||
if(localevntService.selectCheckEvent(map) > 0) {
|
||||
return ApiResponse.error(HttpStatus.CONFLICT, "이미 동일한 이벤트가 존재합니다");
|
||||
} else {
|
||||
@ -106,8 +104,14 @@ public class MainService {
|
||||
* @return
|
||||
*/
|
||||
public ApiResponse<String> registerMember(long memberSeq) {
|
||||
int result = netmemberService.registerMember(memberSeq);
|
||||
Long loginUserId = AuthUtil.getUser().getId();
|
||||
MemberVo user = netmemberService.getUserInfoById(loginUserId);
|
||||
|
||||
if(user.getId() != loginUserId || !"ROLE_ADMIN".equals(user.getRole())) {
|
||||
return ApiResponse.error(HttpStatus.FORBIDDEN, "사용 권한 없음");
|
||||
}
|
||||
|
||||
int result = netmemberService.registerMember(memberSeq);
|
||||
return result == 1 ? ApiResponse.ok("사원 등록 성공") : ApiResponse.ok("사원 등록 실패");
|
||||
}
|
||||
|
||||
@ -118,11 +122,21 @@ public class MainService {
|
||||
* @return
|
||||
*/
|
||||
public ApiResponse<String> rejectMember(long memberSeq) {
|
||||
int result = netmemberService.rejectMember(memberSeq);
|
||||
Long loginUserId = AuthUtil.getUser().getId();
|
||||
MemberVo user = netmemberService.getUserInfoById(loginUserId);
|
||||
|
||||
if(user.getId() != loginUserId || !"ROLE_ADMIN".equals(user.getRole())) {
|
||||
return ApiResponse.error(HttpStatus.UNAUTHORIZED, "사용 권한 없음");
|
||||
}
|
||||
|
||||
int result = netmemberService.rejectMember(memberSeq);
|
||||
return result == 1 ? ApiResponse.ok("미승인 대상자 등록") : ApiResponse.ok("미승인 대상자 등록 실패");
|
||||
}
|
||||
|
||||
public ApiResponse<MapDto> getUserLeaveRecord(MapDto map) {
|
||||
return commutersService.selectUserLeaveWorkList(map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -175,4 +175,8 @@ public class NetprojctService {
|
||||
return netprojctMapper.selectUserProjectPeriod(projctSeq);
|
||||
}
|
||||
|
||||
public List<MapDto> selectUserProjectPeriod2(int memberSeq) {
|
||||
return netprojctMapper.selectUserProjectPeriod2(memberSeq);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -288,39 +288,33 @@ public class localvacaService {
|
||||
return emp;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 총 연차 계산 로직
|
||||
*/
|
||||
public int procCalculateTotalVacation(LocalDate hireDate) {
|
||||
LocalDate today = LocalDate.now(); // 현재 날짜
|
||||
int yearsWorked = hireDate.until(today).getYears();
|
||||
int hireMonth = hireDate.getMonthValue();
|
||||
LocalDate today = LocalDate.now();
|
||||
int hireYear = hireDate.getYear();
|
||||
int currentYear = today.getYear();
|
||||
|
||||
// 🔹 1년 미만: 입사한 월을 고려하여 연차 개수 계산
|
||||
if (yearsWorked < 1) {
|
||||
return 12 - hireMonth;
|
||||
} else {
|
||||
int totalVacation = 12 - hireMonth; // 1년 미만 사용하고 남은 연차 수 반영
|
||||
LocalDate nextIncreaseDate = hireDate.plusYears(1).withMonth(hireMonth).withDayOfMonth(1);
|
||||
|
||||
// 🔹 매년 입사월에 15개 지급
|
||||
while (!nextIncreaseDate.isAfter(today)) {
|
||||
totalVacation += 15;
|
||||
nextIncreaseDate = nextIncreaseDate.plusYears(1);
|
||||
// 입사년도와 현재년도가 같으면 : (12 - 입사월)
|
||||
if (hireYear == currentYear) {
|
||||
return 12 - hireDate.getMonthValue();
|
||||
}
|
||||
|
||||
// 🔹 입사년도 2년마다 입사월에 15개에서 1개씩 추가 지급
|
||||
LocalDate additionalIncreaseDate = hireDate.plusYears(2).withMonth(hireMonth).withDayOfMonth(1);
|
||||
int extraIncrease = 1;
|
||||
while (!additionalIncreaseDate.isAfter(today)) {
|
||||
totalVacation += extraIncrease;
|
||||
additionalIncreaseDate = additionalIncreaseDate.plusYears(2);
|
||||
extraIncrease++; // 2년마다 1개씩 증가
|
||||
// 기본 연차 15
|
||||
int totalVacation = 15;
|
||||
|
||||
// 입사년도 기준 3년차 1월부터, 매 2년마다 1개씩 증가
|
||||
LocalDate accrualDate = LocalDate.of(hireYear + 3, 1, 1);
|
||||
|
||||
while (!accrualDate.isAfter(today)) {
|
||||
totalVacation++;
|
||||
accrualDate = accrualDate.plusYears(2);
|
||||
}
|
||||
|
||||
return totalVacation;
|
||||
}
|
||||
}
|
||||
|
||||
public List<MapDto> selectSentVacationCount(MapDto map) {
|
||||
return localvacaMapper.selectSentVacationCount(map);
|
||||
|
||||
@ -93,6 +93,8 @@ public class worddictyService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
|
||||
@ -95,6 +95,8 @@ logging:
|
||||
connection: off
|
||||
io.company: DEBUG
|
||||
io.company.localhost.mapper: off
|
||||
file:
|
||||
path: logs
|
||||
|
||||
|
||||
filePath:
|
||||
|
||||
@ -100,4 +100,9 @@
|
||||
<delete id="deleteCommuters" parameterType="int">
|
||||
DELETE FROM commuters WHERE PROJCTSEQ = #{projctSeq}
|
||||
</delete>
|
||||
|
||||
<select id="selectUserLeaveWorkList">
|
||||
/* 금일 퇴근 조회 */
|
||||
SELECT * FROM COMMUTERS WHERE MEMBERSEQ = #{memberSeq} AND COMMUTDAY = DATE_FORMAT(#{currentDate}, '%Y-%m-%d')
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -121,30 +121,60 @@
|
||||
m.MEMBERNAM,
|
||||
p.PROJCTSEQ,
|
||||
p.PROJCTNAM,
|
||||
p.PROJCTSTR as projectStartDate,
|
||||
p.PROJCTEND as projectEndDate,
|
||||
(
|
||||
p.PROJCTSTR AS projectStartDate,
|
||||
p.PROJCTEND AS projectEndDate,
|
||||
COALESCE((
|
||||
SELECT MIN(c2.COMMUTDAY)
|
||||
FROM commuters c2
|
||||
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
||||
AND c2.MEMBERSEQ = m.MEMBERSEQ
|
||||
) as userStartDate,
|
||||
(
|
||||
), p.PROJCTSTR) AS userStartDate,
|
||||
COALESCE((
|
||||
SELECT MAX(c2.COMMUTDAY)
|
||||
FROM commuters c2
|
||||
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
||||
AND c2.MEMBERSEQ = m.MEMBERSEQ
|
||||
) as userEndDate
|
||||
), p.PROJCTEND) AS userEndDate
|
||||
FROM
|
||||
netprojct p
|
||||
INNER JOIN
|
||||
LEFT JOIN
|
||||
commuters c ON p.PROJCTSEQ = c.PROJCTSEQ
|
||||
INNER JOIN
|
||||
LEFT JOIN
|
||||
netmember m ON c.MEMBERSEQ = m.MEMBERSEQ
|
||||
WHERE
|
||||
p.PROJCTSEQ = #{projectSeq}
|
||||
GROUP BY
|
||||
m.MEMBERSEQ, p.PROJCTSEQ
|
||||
</select>
|
||||
m.MEMBERSEQ, m.MEMBERNAM, p.PROJCTSEQ, p.PROJCTNAM, p.PROJCTSTR, p.PROJCTEND
|
||||
</select>
|
||||
|
||||
<select id="selectUserProjectPeriod2" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT
|
||||
pm.MEMBERSEQ,
|
||||
p.PROJCTSEQ,
|
||||
p.PROJCTNAM,
|
||||
p.PROJCTSTR AS projectStartDate,
|
||||
p.PROJCTEND AS projectEndDate,
|
||||
(
|
||||
SELECT MIN(c2.COMMUTDAY)
|
||||
FROM commuters c2
|
||||
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
||||
AND c2.MEMBERSEQ = pm.MEMBERSEQ
|
||||
) AS userStartDate,
|
||||
CASE
|
||||
WHEN p.PROJCTEND IS NOT NULL THEN (
|
||||
SELECT MAX(c2.COMMUTDAY)
|
||||
FROM commuters c2
|
||||
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
||||
AND c2.MEMBERSEQ = pm.MEMBERSEQ
|
||||
)
|
||||
ELSE NULL
|
||||
END AS userEndDate
|
||||
FROM promember pm
|
||||
INNER JOIN netprojct p ON pm.PROJCTSEQ = p.PROJCTSEQ
|
||||
WHERE pm.MEMBERSEQ = #{memberSeq}
|
||||
AND pm.PROJCTYON = 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -84,7 +84,14 @@
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<choose>
|
||||
<when test='myVote == "2"'>
|
||||
ORDER BY LOCVOTEDT ASC, formatted_LOCVOTRDT DESC
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY formatted_LOCVOTRDT DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<update id="updateEndData" parameterType="map">
|
||||
UPDATE
|
||||
|
||||
@ -12,48 +12,48 @@
|
||||
<!-- 색인표 조건 -->
|
||||
<if test="indexKeyword != null and indexKeyword != ''">
|
||||
<choose>
|
||||
<!-- 한글 ㄱ ~ ㅎ에 대한 검색 -->
|
||||
<!-- 한글 ㄱ ~ ㅎ에 대한 검색 (자음만 있는 경우도 포함) -->
|
||||
<when test='indexKeyword == "ㄱ"'>
|
||||
and w.WRDDICTTL BETWEEN '가' AND '깋'
|
||||
AND (w.WRDDICTTL BETWEEN '가' AND '깋' OR w.WRDDICTTL LIKE 'ㄱ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㄴ"'>
|
||||
and w.WRDDICTTL BETWEEN '나' AND '닣'
|
||||
AND (w.WRDDICTTL BETWEEN '나' AND '닣' OR w.WRDDICTTL LIKE 'ㄴ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㄷ"'>
|
||||
and w.WRDDICTTL BETWEEN '다' AND '딷'
|
||||
AND (w.WRDDICTTL BETWEEN '다' AND '딷' OR w.WRDDICTTL LIKE 'ㄷ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㄹ"'>
|
||||
and w.WRDDICTTL BETWEEN '라' AND '릿'
|
||||
AND (w.WRDDICTTL BETWEEN '라' AND '릿' OR w.WRDDICTTL LIKE 'ㄹ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅁ"'>
|
||||
and w.WRDDICTTL BETWEEN '마' AND '밓'
|
||||
AND (w.WRDDICTTL BETWEEN '마' AND '밓' OR w.WRDDICTTL LIKE 'ㅁ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅂ"'>
|
||||
and w.WRDDICTTL BETWEEN '바' AND '빟'
|
||||
AND (w.WRDDICTTL BETWEEN '바' AND '빟' OR w.WRDDICTTL LIKE 'ㅂ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅅ"'>
|
||||
and w.WRDDICTTL BETWEEN '사' AND '싷'
|
||||
AND (w.WRDDICTTL BETWEEN '사' AND '싷' OR w.WRDDICTTL LIKE 'ㅅ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅇ"'>
|
||||
and w.WRDDICTTL BETWEEN '아' AND '잏'
|
||||
AND (w.WRDDICTTL BETWEEN '아' AND '잏' OR w.WRDDICTTL LIKE 'ㅇ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅈ"'>
|
||||
and w.WRDDICTTL BETWEEN '자' AND '짛'
|
||||
AND (w.WRDDICTTL BETWEEN '자' AND '짛' OR w.WRDDICTTL LIKE 'ㅈ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅊ"'>
|
||||
and w.WRDDICTTL BETWEEN '차' AND '칳'
|
||||
AND (w.WRDDICTTL BETWEEN '차' AND '칳' OR w.WRDDICTTL LIKE 'ㅊ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅋ"'>
|
||||
and w.WRDDICTTL BETWEEN '카' AND '킿'
|
||||
AND (w.WRDDICTTL BETWEEN '카' AND '킿' OR w.WRDDICTTL LIKE 'ㅋ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅌ"'>
|
||||
and w.WRDDICTTL BETWEEN '타' AND '틷'
|
||||
AND (w.WRDDICTTL BETWEEN '타' AND '틷' OR w.WRDDICTTL LIKE 'ㅌ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅍ"'>
|
||||
and w.WRDDICTTL BETWEEN '파' AND '핗'
|
||||
AND (w.WRDDICTTL BETWEEN '파' AND '핗' OR w.WRDDICTTL LIKE 'ㅍ%')
|
||||
</when>
|
||||
<when test='indexKeyword == "ㅎ"'>
|
||||
and w.WRDDICTTL BETWEEN '하' AND '힣'
|
||||
AND (w.WRDDICTTL BETWEEN '하' AND '힣' OR w.WRDDICTTL LIKE 'ㅎ%')
|
||||
</when>
|
||||
<!-- 알파벳 a ~ z에 대한 검색 -->
|
||||
<when test='indexKeyword == "a"'>
|
||||
@ -134,6 +134,9 @@
|
||||
<when test='indexKeyword == "z"'>
|
||||
and w.WRDDICTTL like "z%"
|
||||
</when>
|
||||
<otherwise>
|
||||
and w.WRDDICTTL like CONCAT('%', #{indexKeyword}, '%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<!-- 카테고리 조건 -->
|
||||
@ -301,33 +304,47 @@
|
||||
CHARACTER_,
|
||||
COUNT(*) AS COUNT
|
||||
FROM (
|
||||
SELECT 'ㄱ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '가' AND '깋'
|
||||
SELECT 'ㄱ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '가' AND '깋' OR WRDDICTTL LIKE 'ㄱ%'
|
||||
UNION ALL
|
||||
SELECT 'ㄴ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '나' AND '닣'
|
||||
SELECT 'ㄴ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '나' AND '닣' OR WRDDICTTL LIKE 'ㄴ%'
|
||||
UNION ALL
|
||||
SELECT 'ㄷ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '다' AND '딷'
|
||||
SELECT 'ㄷ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '다' AND '딷' OR WRDDICTTL LIKE 'ㄷ%'
|
||||
UNION ALL
|
||||
SELECT 'ㄹ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '라' AND '릿'
|
||||
SELECT 'ㄹ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '라' AND '릿' OR WRDDICTTL LIKE 'ㄹ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅁ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '마' AND '밓'
|
||||
SELECT 'ㅁ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '마' AND '밓' OR WRDDICTTL LIKE 'ㅁ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅂ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '바' AND '빟'
|
||||
SELECT 'ㅂ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '바' AND '빟' OR WRDDICTTL LIKE 'ㅂ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅅ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '사' AND '싷'
|
||||
SELECT 'ㅅ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '사' AND '싷' OR WRDDICTTL LIKE 'ㅅ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅇ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '아' AND '잏'
|
||||
SELECT 'ㅇ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '아' AND '잏' OR WRDDICTTL LIKE 'ㅇ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅈ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '자' AND '짛'
|
||||
SELECT 'ㅈ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '자' AND '짛' OR WRDDICTTL LIKE 'ㅈ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅊ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '차' AND '칳'
|
||||
SELECT 'ㅊ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '차' AND '칳' OR WRDDICTTL LIKE 'ㅊ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅋ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '카' AND '킿'
|
||||
SELECT 'ㅋ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '카' AND '킿' OR WRDDICTTL LIKE 'ㅋ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅌ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '타' AND '틷'
|
||||
SELECT 'ㅌ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '타' AND '틷' OR WRDDICTTL LIKE 'ㅌ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅍ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '파' AND '핗'
|
||||
SELECT 'ㅍ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '파' AND '핗' OR WRDDICTTL LIKE 'ㅍ%'
|
||||
UNION ALL
|
||||
SELECT 'ㅎ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '하' AND '힣'
|
||||
SELECT 'ㅎ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
||||
WHERE WRDDICTTL BETWEEN '하' AND '힣' OR WRDDICTTL LIKE 'ㅎ%'
|
||||
UNION ALL
|
||||
SELECT 'a' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL LIKE 'a%'
|
||||
UNION ALL
|
||||
|
||||
Loading…
Reference in New Issue
Block a user