feat: 게시글 관리 기능 추가 #01

- 게시글 관리 조회
dev
Lim Jonguk 3 years ago
parent 75cb830775
commit 12893d3cc9

1
.gitignore vendored

@ -35,3 +35,4 @@ build/
/work/ /work/
/.gradle/ /.gradle/
/src/main/generated/ /src/main/generated/
/LOG_PATH_IS_UNDEFINED/

@ -129,23 +129,23 @@ dependencies {
//compileOnly 'com.querydsl:querydsl-apt' //compileOnly 'com.querydsl:querydsl-apt'
// JPA mapstruct : lombok - lombok // JPA mapstruct : lombok - lombok
implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0' // implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
implementation 'org.projectlombok:lombok' // implementation 'org.projectlombok:lombok'
implementation 'org.mapstruct:mapstruct:1.4.2.Final' // implementation 'org.mapstruct:mapstruct:1.4.2.Final'
annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0" // annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
annotationProcessor 'org.projectlombok:lombok' // annotationProcessor 'org.projectlombok:lombok'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final' // annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
// JPA mapstruct : lombok - mapstruct // JPA mapstruct : lombok - mapstruct
// target class @Builder + setter Mapper Generation // target class @Builder + setter Mapper Generation
// @NoArgsConstructor, @Setter // @NoArgsConstructor, @Setter
// but, Setter mapstruct @Builder Generation // but, Setter mapstruct @Builder Generation
// implementation 'org.mapstruct:mapstruct:1.4.2.Final' implementation 'org.mapstruct:mapstruct:1.4.2.Final'
// implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0' implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
// implementation 'org.projectlombok:lombok' implementation 'org.projectlombok:lombok'
// annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final' annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
// annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0" annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
// annotationProcessor 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok'
//-----------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------//
//-----------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------//

@ -0,0 +1,54 @@
package com.xit.biz.ctgy.controller;
import com.xit.biz.cmm.dto.CmmUserDto;
import com.xit.biz.cmm.dto.struct.CmmUserMapstruct;
import com.xit.biz.ctgy.dto.MinCivBoard680Dto;
import com.xit.biz.ctgy.dto.struct.MinCivBoard680Mapstruct;
import com.xit.biz.ctgy.service.IMinCivBoard680Service;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
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.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "OAuth2LocalController", description = "인증 관리")
@RestController
@RequestMapping("/api/v1/biz/board")
@Validated
@RequiredArgsConstructor
public class MinCivBoard680Controller {
private final IMinCivBoard680Service minCivBoard680Service;
private MinCivBoard680Mapstruct minCivBoard680Mapstruct = Mappers.getMapper(MinCivBoard680Mapstruct.class);
@Operation(summary = "게시판 목록 조회" , description = "게시판 목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "ciTitle", description = "제목", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "ciName", description = "이름", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
})
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findMinCivBoard680s(
@Parameter(hidden = true)
@ModelAttribute("minCivBoard680Dto")
final MinCivBoard680Dto minCivBoard680Dto,
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(minCivBoard680Service.findMinCivBoard680s(minCivBoard680Mapstruct.toEntity(minCivBoard680Dto), pageable));
}
}

@ -0,0 +1,64 @@
package com.xit.biz.ctgy.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
@Schema(name = "MinCivBoard680Dto", description = "게시판")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class MinCivBoard680Dto implements Serializable {
private static final long SerialVersionUID = 1L;
@Schema(title = "게시판코드", example = " ", description = "Input Description...")
private Long ciCode;
@Schema(title = "글번호", example = " ", description = "Input Description...")
private Long ciContentno;
@Schema(title = "제목", example = " ", description = "Input Description...")
private String ciTitle;
@Schema(title = "사용자 아이디", example = " ", description = "Input Description...")
private String ciId;
@Schema(title = "사용자패스워드", example = " ", description = "Input Description...")
private String ciPwd;
@Schema(title = "사용자 성명", example = " ", description = "Input Description...")
private String ciName;
@Schema(required = false, title = "등록일자", example = " ", description = "Input Description...")
private String ciNalja;
@Schema(required = false, title = "등록시간", example = " ", description = "Input Description...")
private String ciTime;
@Schema(required = false, title = "조회수", example = " ", description = "Input Description...")
private Long ciHit;
@Schema(required = false, title = "REF", example = " ", description = "Input Description...")
private Long ciRef;
@Schema(required = false, title = "STEP", example = " ", description = "Input Description...")
private Long ciStep;
@Schema(required = false, title = "LEVEL", example = " ", description = "Input Description...")
private Long ciRevel;
@Schema(required = false, title = "패스워드", example = " ", description = "Input Description...")
private String ciPass;
@Schema(required = false, title = "이메일", example = " ", description = "Input Description...")
private String ciEmail;
@Schema(required = false, title = "내용", example = " ", description = "Input Description...")
private String ciContents;
}

@ -0,0 +1,12 @@
package com.xit.biz.ctgy.dto.struct;
import com.xit.biz.ctgy.dto.MinCivBoard680Dto;
import com.xit.biz.ctgy.entity.MinCivBoard680;
import com.xit.core.support.jpa.mapstruct.IMapstruct;
import com.xit.core.support.jpa.mapstruct.MapStructMapperConfig;
import org.mapstruct.Mapper;
@Mapper(config = MapStructMapperConfig.class)
public interface MinCivBoard680Mapstruct extends IMapstruct<MinCivBoard680Dto, MinCivBoard680> {
}

@ -16,8 +16,6 @@ public class MinCivBoard680 implements Serializable {
private static final long SerialVersionUID = 1L; private static final long SerialVersionUID = 1L;
@Id @Id
private Long id;
@Schema(required = true, title = "게시판코드", example = " ", description = "Input Description...") @Schema(required = true, title = "게시판코드", example = " ", description = "Input Description...")
@Column(name = "ci_code", nullable = false) @Column(name = "ci_code", nullable = false)
private Long ciCode; private Long ciCode;

@ -0,0 +1,11 @@
package com.xit.biz.ctgy.repository;
import com.xit.biz.cmm.entity.CmmUser;
import com.xit.biz.ctgy.entity.MinCivBoard680;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
public interface IMinCivBoard680Repository extends JpaRepository<MinCivBoard680, Long> {
}

@ -0,0 +1,11 @@
package com.xit.biz.ctgy.service;
import com.xit.biz.ctgy.entity.MinCivBoard680;
import com.xit.core.support.jpa.IJpaOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface IMinCivBoard680Service {
Page<MinCivBoard680> findMinCivBoard680s(MinCivBoard680 minCivBoard680, Pageable pageable);
}

@ -0,0 +1,38 @@
package com.xit.biz.ctgy.service.impl;
import com.xit.biz.cmm.entity.CmmUser;
import com.xit.biz.ctgy.entity.MinCivBoard680;
import com.xit.biz.ctgy.repository.IMinCivBoard680Repository;
import com.xit.biz.ctgy.service.IMinCivBoard680Service;
import com.xit.core.support.jpa.JpaUtil;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
@Service
public class MinCivBoard680Service implements IMinCivBoard680Service {
private final IMinCivBoard680Repository minCivBoard680Repository;
public MinCivBoard680Service(IMinCivBoard680Repository minCivBoard680Repository) {
this.minCivBoard680Repository = minCivBoard680Repository;
}
@Transactional(readOnly = true)
public Page<MinCivBoard680> findMinCivBoard680s(MinCivBoard680 minCivBoard680, Pageable pageable) {
//Sort sort = Sort.by(Sort.Direction.ASC, "codeOrdr");
pageable = JpaUtil.getPagingInfo(pageable);
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll()
.withMatcher("ciTitle", contains())
.withMatcher("ciName", contains());
Example<MinCivBoard680> example = Example.of(minCivBoard680, exampleMatcher);
Page<MinCivBoard680> page = minCivBoard680Repository.findAll(example, pageable);
// List<CmmUser> userList = page.getContent();
return page;
}
}

@ -192,7 +192,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/**/*.html", "/**/*.html",
"/**/*.css", "/**/*.css",
"/**/*.js").permitAll() "/**/*.js").permitAll()
.antMatchers("/**/auth/**", "/**/oauth2/**", "/**/users/**").permitAll() .antMatchers("/**/auth/**", "/**/oauth2/**", "/**/users/**", "/**/biz/**").permitAll()
.anyRequest().authenticated() .anyRequest().authenticated()
.and() .and()
//.anyRequest().permitAll() //.hasRole(RoleType.USER.getCode()) //.anyRequest().permitAll() //.hasRole(RoleType.USER.getCode())

@ -63,6 +63,16 @@ public class SpringDocApiConfig {
; ;
} }
@Bean
public GroupedOpenApi ctgyBizApi() {
return GroupedOpenApi.builder()
.group("Ctgy-biz-API")
.pathsToMatch(
"/api/v1/biz/**"
)
.build();
}
@Bean @Bean
public GroupedOpenApi authorizeApi() { public GroupedOpenApi authorizeApi() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()

@ -17,14 +17,14 @@ spring:
# database setting # database setting
# ================================================================================================================== # ==================================================================================================================
datasource: datasource:
driver-class-name: org.h2.Driver # driver-class-name: org.h2.Driver
url: jdbc:h2:mem:xitdb;MODE=Oracle;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE # url: jdbc:h2:mem:xitdb;MODE=Oracle;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: sa # username: sa
password: '' # password: ''
# driver-class-name: oracle.jdbc.OracleDriver driver-class-name: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@211.119.124.118:1521:bustms url: jdbc:oracle:thin:@211.119.124.118:1521:bustms
# username: traffic username: traffic
# password: xhdgkq0 password: xhdgkq0
hikari: hikari:
driver-class-name: ${spring.datasource.driver-class-name} driver-class-name: ${spring.datasource.driver-class-name}
jdbc-url: ${spring.datasource.url} jdbc-url: ${spring.datasource.url}
@ -36,14 +36,15 @@ spring:
# JPA setting # JPA setting
# ================================================================================================================== # ==================================================================================================================
jpa: jpa:
database-platform: org.hibernate.dialect.H2Dialect # database-platform: org.hibernate.dialect.H2Dialect
# database-platform: org.hibernate.dialect.Oracle10gDialect database-platform: org.hibernate.dialect.Oracle10gDialect
#show-sql: false #show-sql: false
properties: properties:
hibernate: hibernate:
hbm2ddl: hbm2ddl:
# create / create-drop / update / validate / none # create / create-drop / update / validate / none
auto: create-drop # auto: create-drop
auto: none
h2: h2:
console: console:

@ -77,7 +77,7 @@ spring:
max-lifetime: 1800000 max-lifetime: 1800000
maximum-pool-size: 30 maximum-pool-size: 30
minimum-idle: 5 minimum-idle: 5
transaction-isolation: TRANSACTION_READ_UNCOMMITTED #transaction-isolation: TRANSACTION_READ_UNCOMMITTED # TRANSACTION_READ_UNCOMMITTED
data-source-properties: data-source-properties:
rewriteBatchedStatements: true rewriteBatchedStatements: true

Loading…
Cancel
Save