251210_01_ENH : 검색어로만 프로젝트 검색 추가, 사용자 ID 있는 지 조회 추가
This commit is contained in:
@@ -37,7 +37,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.kri.common:starter:beta.1.0.25"
|
||||
implementation "com.kri.common:starter:beta.1.0.32"
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
|
||||
@@ -18,6 +18,17 @@ public class ProjectController {
|
||||
|
||||
private final ProjectService projectService;
|
||||
|
||||
@Operation(
|
||||
summary = "Keyword로만 상위 10개 프로젝트 조회",
|
||||
description = "p_child_sn, p_subject, p_intention 전부 OR 조건으로 최신 10건 프로젝트를 조회합니다."
|
||||
)
|
||||
@GetMapping("search/top10")
|
||||
public List<GetProjectTop10ResponseDto> getProjectTop10OnlyKeyword(
|
||||
@RequestParam(required = false) String keyword
|
||||
) {
|
||||
return projectService.getProjectTop10OnlyKeyword(keyword);
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "상위 10개 프로젝트 조회",
|
||||
description = "p_child_sn, p_subject, p_intention 조건으로 최신 10건 프로젝트를 조회합니다."
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.kri.intranet.extension.controller;
|
||||
|
||||
import com.kri.intranet.extension.dto.user.request.GetUserWithIdPwRequestDto;
|
||||
import com.kri.intranet.extension.dto.user.response.GetUserWithIdPwResponseDto;
|
||||
import com.kri.intranet.extension.dto.user.UserBasicInfoDto;
|
||||
import com.kri.intranet.extension.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/user")
|
||||
@@ -20,14 +19,38 @@ public class UserController {
|
||||
private final UserService userService;
|
||||
|
||||
@Operation(
|
||||
summary = "사용자 정보 조회",
|
||||
description = "ID/PW로 사용자 정보 조회"
|
||||
summary = "사용자 정보 조회",
|
||||
description = "ID/PW로 사용자 정보 조회"
|
||||
)
|
||||
@PostMapping("search/login-info")
|
||||
public GetUserWithIdPwResponseDto getUserWithIdPw(
|
||||
@PostMapping("login-info")
|
||||
public UserBasicInfoDto getUserWithIdPw(
|
||||
@RequestBody GetUserWithIdPwRequestDto getUserWithIdPwRequestDto
|
||||
) {
|
||||
return userService.getUserWithIdPw(getUserWithIdPwRequestDto);
|
||||
}
|
||||
|
||||
}
|
||||
@Operation(
|
||||
summary = "사용자 리스트",
|
||||
description = "사용자 리스트 조회"
|
||||
)
|
||||
@GetMapping("list")
|
||||
public List<UserBasicInfoDto> getUserList(){ return userService.getUserList(); }
|
||||
|
||||
@Operation(
|
||||
summary = "ID 사용 여부 조회",
|
||||
description = "ID로 사용가능 여부 조회"
|
||||
)
|
||||
@GetMapping("check-user-id")
|
||||
public boolean checkUserId(@RequestParam String userId){
|
||||
return userService.checkUserId(userId);
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "사용자 ID 목록 조회",
|
||||
description = "사용자 ID 목록 조회"
|
||||
)
|
||||
@GetMapping("user-id-list")
|
||||
public List<String> getUserIdArray(){
|
||||
return userService.getUserIdArray();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kri.intranet.extension.dto.user.response;
|
||||
package com.kri.intranet.extension.dto.user;
|
||||
|
||||
import com.kri.intranet.extension.entity.user.UserBasicInfoEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -8,7 +8,7 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@Builder
|
||||
@Schema(description = "사용자 ID/PW 검색 응답 DTO")
|
||||
public class GetUserWithIdPwResponseDto {
|
||||
public class UserBasicInfoDto {
|
||||
@Schema(description = "사용자 ID")
|
||||
private final String userId;
|
||||
|
||||
@@ -26,8 +26,8 @@ public class GetUserWithIdPwResponseDto {
|
||||
private final int userRole;
|
||||
|
||||
|
||||
public static GetUserWithIdPwResponseDto from(UserBasicInfoEntity e) {
|
||||
return GetUserWithIdPwResponseDto.builder()
|
||||
public static UserBasicInfoDto from(UserBasicInfoEntity e) {
|
||||
return UserBasicInfoDto.builder()
|
||||
.userId(e.getUserId())
|
||||
.userNm(e.getUserName())
|
||||
.userTeam(e.getUserTeam())
|
||||
@@ -13,4 +13,8 @@ public interface ProjectMapper {
|
||||
@Param("childSn") String childSn,
|
||||
@Param("keyword") String keyword
|
||||
);
|
||||
|
||||
List<ProjectBasicInfoEntity> selectProjectTop10OnlyKeyword(
|
||||
@Param("keyword") String keyword
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,4 +13,10 @@ public interface UserMapper {
|
||||
@Param("userId") String userId,
|
||||
@Param("userPw") String userPw
|
||||
);
|
||||
|
||||
List<UserBasicInfoEntity> selectUser();
|
||||
|
||||
boolean selectExistUser(@Param("userId") String userId);
|
||||
|
||||
List<String> selectUserIdList();
|
||||
}
|
||||
|
||||
@@ -25,4 +25,12 @@ public class ProjectService {
|
||||
.map(GetProjectTop10ResponseDto::from)
|
||||
.toList();
|
||||
}
|
||||
|
||||
public List<GetProjectTop10ResponseDto> getProjectTop10OnlyKeyword(String keyword){
|
||||
List<ProjectBasicInfoEntity> entityList = projectMapper.selectProjectTop10OnlyKeyword(keyword);
|
||||
|
||||
return entityList.stream()
|
||||
.map(GetProjectTop10ResponseDto::from)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.kri.intranet.extension.service;
|
||||
|
||||
import com.kri.common.web.BusinessException;
|
||||
import com.kri.intranet.extension.dto.user.request.GetUserWithIdPwRequestDto;
|
||||
import com.kri.intranet.extension.dto.user.response.GetUserWithIdPwResponseDto;
|
||||
import com.kri.intranet.extension.dto.user.UserBasicInfoDto;
|
||||
import com.kri.intranet.extension.entity.user.UserBasicInfoEntity;
|
||||
import com.kri.intranet.extension.mapper.UserMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
public class UserService {
|
||||
private final UserMapper userMapper;
|
||||
|
||||
public GetUserWithIdPwResponseDto getUserWithIdPw(GetUserWithIdPwRequestDto getUserWithIdPwRequestDto) {
|
||||
public UserBasicInfoDto getUserWithIdPw(GetUserWithIdPwRequestDto getUserWithIdPwRequestDto) {
|
||||
String userId = getUserWithIdPwRequestDto.getUserId();
|
||||
String userPw = getUserWithIdPwRequestDto.getUserPw();
|
||||
|
||||
@@ -29,6 +29,20 @@ public class UserService {
|
||||
|
||||
UserBasicInfoEntity entity = userBasicInfoEntityList.get(0);
|
||||
|
||||
return GetUserWithIdPwResponseDto.from(entity);
|
||||
return UserBasicInfoDto.from(entity);
|
||||
}
|
||||
|
||||
public List<UserBasicInfoDto> getUserList(){
|
||||
return userMapper.selectUser().stream()
|
||||
.map(UserBasicInfoDto::from)
|
||||
.toList();
|
||||
}
|
||||
|
||||
public boolean checkUserId(String userId){
|
||||
return !userMapper.selectExistUser(userId);
|
||||
}
|
||||
|
||||
public List<String> getUserIdArray(){
|
||||
return userMapper.selectUserIdList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
<mapper namespace="com.kri.intranet.extension.mapper.ProjectMapper">
|
||||
<select id="selectProjectTop10" resultType="com.kri.intranet.extension.entity.project.ProjectBasicInfoEntity">
|
||||
SELECT TOP(10)
|
||||
p_child_sn AS pChildSn
|
||||
p_child_sn AS pChildSn
|
||||
, CASE WHEN p_intention IS NOT NULL
|
||||
THEN p_subject + ' <![CDATA[<' + p_intention + '>]]>'
|
||||
ELSE p_subject
|
||||
END AS pTitle
|
||||
, d.Code AS pRschTeam
|
||||
, d.T_Name AS pRschTeamName
|
||||
THEN p_subject + ' <![CDATA[<' + p_intention + '>]]>'
|
||||
ELSE p_subject
|
||||
END AS pTitle
|
||||
, ISNULL(d.Code,'') AS pRschTeam
|
||||
, ISNULL(d.T_Name,'') AS pRschTeamName
|
||||
FROM project2.dbo.V_PROJECT_METHOD pm WITH (NOLOCK)
|
||||
LEFT JOIN project2.dbo.v_Department d
|
||||
ON pm.p_rsch_dept = d.before_t_cd1
|
||||
@@ -23,8 +23,33 @@
|
||||
<!-- p_subject / p_intention 공용 키워드 (파라미터2) -->
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
p_subject LIKE '%' + #{keyword} + '%'
|
||||
OR p_intention LIKE '%' + #{keyword} + '%'
|
||||
p_subject LIKE '%' + #{keyword} + '%'
|
||||
OR p_intention LIKE '%' + #{keyword} + '%'
|
||||
)
|
||||
</if>
|
||||
ORDER BY p_input_dt DESC
|
||||
</select>
|
||||
|
||||
<select id="selectProjectTop10OnlyKeyword" resultType="com.kri.intranet.extension.entity.project.ProjectBasicInfoEntity">
|
||||
SELECT TOP(10)
|
||||
p_child_sn AS pChildSn
|
||||
, CASE WHEN p_intention IS NOT NULL
|
||||
THEN p_subject + ' <![CDATA[<' + p_intention + '>]]>'
|
||||
ELSE p_subject
|
||||
END AS pTitle
|
||||
, ISNULL(d.Code,'') AS pRschTeam
|
||||
, ISNULL(d.T_Name,'') AS pRschTeamName
|
||||
FROM project2.dbo.V_PROJECT_METHOD pm WITH (NOLOCK)
|
||||
LEFT JOIN project2.dbo.v_Department d
|
||||
ON pm.p_rsch_dept = d.before_t_cd1
|
||||
OR pm.p_rsch_dept = d.T_CODE
|
||||
WHERE 1 = 1
|
||||
<!-- p_subject / p_intention 공용 키워드 (파라미터2) -->
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
p_child_sn LIKE '%' + #{keyword} + '%'
|
||||
OR p_subject LIKE '%' + #{keyword} + '%'
|
||||
OR p_intention LIKE '%' + #{keyword} + '%'
|
||||
)
|
||||
</if>
|
||||
ORDER BY p_input_dt DESC
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
<mapper namespace="com.kri.intranet.extension.mapper.UserMapper">
|
||||
<select id="selectUserWithIdPw" resultType="com.kri.intranet.extension.entity.user.UserBasicInfoEntity">
|
||||
<bind name="userMail" value="userId.indexOf('@') > -1 ? userId : userId + '@kric.com'" />
|
||||
SELECT
|
||||
p_user_mail AS [user_id]
|
||||
, p_name as [user_name]
|
||||
@@ -13,10 +14,49 @@
|
||||
CASE WHEN p_team_now <![CDATA[<]]> 300 THEN 3001 ELSE 1001 END
|
||||
ELSE 1001 END AS [user_role]
|
||||
FROM project2.dbo.person
|
||||
WHERE krc_in_date IS NOT NULL and krc_out_date = ''
|
||||
AND (p_user_mail = #{userId} or p_user_mail = #{userId} + '@kric.com')
|
||||
WHERE krc_in_date IS NOT NULL
|
||||
AND krc_out_date = ''
|
||||
AND p_user_mail = #{userMail}
|
||||
AND p_pass_new COLLATE Latin1_General_CS_AS = #{userPw}
|
||||
ORDER BY p_no
|
||||
</select>
|
||||
|
||||
<select id="selectUser" resultType="com.kri.intranet.extension.entity.user.UserBasicInfoEntity">
|
||||
SELECT
|
||||
p_user_mail AS [user_id]
|
||||
, p_name as [user_name]
|
||||
, p_depart_now+p_team_now AS user_team
|
||||
, CASE p_depart_now
|
||||
WHEN 'R' THEN 2001
|
||||
WHEN 'S' THEN
|
||||
CASE WHEN p_team_now <![CDATA[<]]> 300 THEN 3001 ELSE 1001 END
|
||||
ELSE 1001 END AS [user_role]
|
||||
FROM project2.dbo.person
|
||||
WHERE krc_in_date IS NOT NULL
|
||||
AND krc_out_date = ''
|
||||
AND p_user_mail IS NOT NULL
|
||||
AND p_user_mail != ''
|
||||
ORDER BY p_no
|
||||
</select>
|
||||
|
||||
<select id="selectExistUser" resultType="boolean">
|
||||
<bind name="userMail" value="userId.indexOf('@') > -1 ? userId : userId + '@kric.com'" />
|
||||
SELECT CAST(
|
||||
CASE WHEN EXISTS (
|
||||
SELECT 1
|
||||
FROM project2.dbo.person
|
||||
WHERE krc_in_date IS NOT NULL
|
||||
AND krc_out_date = ''
|
||||
AND p_user_mail = #{userMail}
|
||||
)
|
||||
THEN 1 ELSE 0 END
|
||||
AS bit)
|
||||
</select>
|
||||
|
||||
<select id="selectUserIdList" resultType="String">
|
||||
SELECT p_user_mail
|
||||
FROM project2.dbo.person
|
||||
WHERE krc_in_date IS NOT NULL
|
||||
AND krc_out_date = ''
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user