Skip to content

Commit

Permalink
Merge pull request #75 from KCC-Team/feat/61-test_api_logic
Browse files Browse the repository at this point in the history
[#61] 테스트 목록 API 구현 중간 적용 및 설정 적용
  • Loading branch information
hanheeland authored Oct 14, 2024
2 parents d96ec01 + 911f390 commit adcd8b0
Show file tree
Hide file tree
Showing 15 changed files with 493 additions and 38 deletions.
32 changes: 18 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,31 @@
<java.version>17</java.version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<!-- DB -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>3.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
Expand All @@ -58,22 +66,21 @@
<artifactId>ojdbc11</artifactId>
<scope>runtime</scope>
</dependency>

<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>3.0.3</version>
<scope>test</scope>
</dependency>

<!-- JSP -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
Expand All @@ -88,13 +95,11 @@
<version>6.0.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.0</version>
</dependency>

<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
Expand All @@ -118,5 +123,4 @@
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Controller
@NoArgsConstructor
@RequestMapping("/projects/{projectId}/defects")
@RequestMapping("/projects/defects")
public class DefectController {

@GetMapping
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
package com.kcc.pms.domain.test.controller;

import com.kcc.pms.domain.test.service.TestService;
import jakarta.servlet.http.HttpSession;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/projects/tests")
@RequiredArgsConstructor
public class TestController {
private final TestService testService;

@GetMapping
public String findAll() {
public String findAll(
Model model,
HttpSession session,
@RequestParam(value = "system") Integer systemId,
@RequestParam(value = "work", defaultValue = "all") String work_type,
@RequestParam(value = "test", defaultValue = "all") String test_type,
@RequestParam(value = "page", defaultValue = "1") int page) {
model.addAttribute("testList", testService.getTestList(systemId, work_type, test_type, page));
return "test/list";
}

Expand All @@ -22,7 +35,7 @@ public String create(Model model) {
}

@GetMapping("/{id}")
public String findById(Model model, @PathVariable Long id) {
public String findById(Model model, @PathVariable Long id, HttpSession session) {
return "test/test";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.kcc.pms.domain.test.domain.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class TestListResponseDto {
private String test_no;
private String test_id;
private String test_type;
private String test_name;
private String work_type;
private LocalDate test_start_date;
private LocalDate test_end_date;
private Integer test_case_count;
private Integer defect_count;
private String test_status;
}
12 changes: 12 additions & 0 deletions src/main/java/com/kcc/pms/domain/test/mapper/TestMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.kcc.pms.domain.test.mapper;

import com.kcc.pms.domain.test.domain.dto.TestListResponseDto;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Optional;

@Mapper
public interface TestMapper {
Optional<List<TestListResponseDto>> findAllByOptions(Integer systemId, String work_type, String test_type, int page);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.kcc.pms.domain.test.service;

import com.kcc.pms.domain.test.domain.dto.TestListResponseDto;

import java.util.List;

public interface TestService {
List<TestListResponseDto> getTestList(Integer systemId, String work_type, String test_type, int page);
}
21 changes: 21 additions & 0 deletions src/main/java/com/kcc/pms/domain/test/service/TestServiceImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.kcc.pms.domain.test.service;

import com.kcc.pms.domain.test.domain.dto.TestListResponseDto;
import com.kcc.pms.domain.test.mapper.TestMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class TestServiceImpl implements TestService {
private final TestMapper testMapper;

@Override
public List<TestListResponseDto> getTestList(Integer systemId, String work_type, String test_type, int page) {
return List.of();
}
}
Loading

0 comments on commit adcd8b0

Please sign in to comment.