-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: [email protected] <[email protected]>
- Loading branch information
1 parent
d6d0aaf
commit 2288430
Showing
17 changed files
with
568 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM jenkins/inbound-agent:alpine as jnlp | ||
|
||
FROM maven:3.8.3-openjdk-17-slim | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
git \ | ||
libfontconfig1 \ | ||
libfreetype6 | ||
|
||
COPY --from=jnlp /usr/local/bin/jenkins-agent /usr/local/bin/jenkins-agent | ||
COPY --from=jnlp /usr/share/jenkins/agent.jar /usr/share/jenkins/agent.jar | ||
|
||
USER root | ||
|
||
ENTRYPOINT ["/usr/local/bin/jenkins-agent"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
...main/java/cn/chenyunlong/qing/samples/codegen/domain/controller/TestDomainController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.controller; | ||
|
||
import cn.chenyunlong.common.constants.CodeEnum; | ||
import cn.chenyunlong.common.model.JsonResult; | ||
import cn.chenyunlong.common.model.PageRequestWrapper; | ||
import cn.chenyunlong.common.model.PageResult; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.creator.TestDomainCreator; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.query.TestDomainQuery; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.request.TestDomainCreateRequest; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.request.TestDomainQueryRequest; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.request.TestDomainUpdateRequest; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.response.TestDomainResponse; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.updater.TestDomainUpdater; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.vo.TestDomainVO; | ||
import cn.chenyunlong.qing.samples.codegen.domain.mapper.TestDomainMapper; | ||
import cn.chenyunlong.qing.samples.codegen.domain.service.ITestDomainService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.stream.Collectors; | ||
|
||
@RestController | ||
@Slf4j | ||
@RequestMapping("api/v1/test-domain") | ||
@RequiredArgsConstructor | ||
public class TestDomainController { | ||
private final ITestDomainService testDomainService; | ||
|
||
/** | ||
* createRequest | ||
*/ | ||
@PostMapping | ||
public JsonResult<Long> createTestDomain(@RequestBody TestDomainCreateRequest request) { | ||
TestDomainCreator creator = TestDomainMapper.INSTANCE.request2Dto(request); | ||
return JsonResult.success(testDomainService.createTestDomain(creator)); | ||
} | ||
|
||
/** | ||
* update request | ||
*/ | ||
@PostMapping("updateTestDomain") | ||
public JsonResult<String> updateTestDomain(@RequestBody TestDomainUpdateRequest request) { | ||
TestDomainUpdater updater = TestDomainMapper.INSTANCE.request2Updater(request); | ||
testDomainService.updateTestDomain(updater); | ||
return JsonResult.success(CodeEnum.Success.getName()); | ||
} | ||
|
||
/** | ||
* valid | ||
*/ | ||
@PostMapping("valid/{id}") | ||
public JsonResult<String> validTestDomain(@PathVariable Long id) { | ||
testDomainService.validTestDomain(id); | ||
return JsonResult.success(CodeEnum.Success.getName()); | ||
} | ||
|
||
/** | ||
* invalid | ||
*/ | ||
@PostMapping("invalid/{id}") | ||
public JsonResult<String> invalidTestDomain(@PathVariable Long id) { | ||
testDomainService.invalidTestDomain(id); | ||
return JsonResult.success(CodeEnum.Success.getName()); | ||
} | ||
|
||
/** | ||
* findById | ||
*/ | ||
@GetMapping("findById/{id}") | ||
public JsonResult<TestDomainResponse> findById(@PathVariable Long id) { | ||
TestDomainVO vo = testDomainService.findById(id); | ||
TestDomainResponse response = TestDomainMapper.INSTANCE.vo2CustomResponse(vo); | ||
return JsonResult.success(response); | ||
} | ||
|
||
/** | ||
* findByPage request | ||
*/ | ||
@PostMapping("page") | ||
public JsonResult<PageResult<TestDomainResponse>> page( | ||
@RequestBody PageRequestWrapper<TestDomainQueryRequest> request) { | ||
PageRequestWrapper<TestDomainQuery> wrapper = new PageRequestWrapper<>(); | ||
wrapper.setBean(TestDomainMapper.INSTANCE.request2Query(request.getBean())); | ||
wrapper.setSorts(request.getSorts()); | ||
wrapper.setPageSize(request.getPageSize()); | ||
wrapper.setPage(request.getPage()); | ||
Page<TestDomainVO> page = testDomainService.findByPage(wrapper); | ||
return JsonResult.success( | ||
PageResult.of( | ||
page.getContent().stream() | ||
.map(TestDomainMapper.INSTANCE::vo2CustomResponse) | ||
.collect(Collectors.toList()), | ||
page.getTotalElements(), | ||
page.getSize(), | ||
page.getNumber()) | ||
); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...c/main/java/cn/chenyunlong/qing/samples/codegen/domain/dto/creator/TestDomainCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.dto.creator; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
@Schema | ||
@Data | ||
public class TestDomainCreator { | ||
@Schema( | ||
title = "username", | ||
description = "username" | ||
) | ||
private String username; | ||
|
||
@Schema( | ||
title = "password", | ||
description = "password" | ||
) | ||
private String password; | ||
} |
9 changes: 9 additions & 0 deletions
9
...s/src/main/java/cn/chenyunlong/qing/samples/codegen/domain/dto/query/TestDomainQuery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.dto.query; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
@Schema | ||
@Data | ||
public class TestDomainQuery { | ||
} |
21 changes: 21 additions & 0 deletions
21
.../java/cn/chenyunlong/qing/samples/codegen/domain/dto/request/TestDomainCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.dto.request; | ||
|
||
import cn.chenyunlong.common.model.Request; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
@Schema | ||
@Data | ||
public class TestDomainCreateRequest implements Request { | ||
@Schema( | ||
title = "username", | ||
description = "username" | ||
) | ||
private String username; | ||
|
||
@Schema( | ||
title = "password", | ||
description = "password" | ||
) | ||
private String password; | ||
} |
10 changes: 10 additions & 0 deletions
10
...n/java/cn/chenyunlong/qing/samples/codegen/domain/dto/request/TestDomainQueryRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.dto.request; | ||
|
||
import cn.chenyunlong.common.model.Request; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
@Schema | ||
@Data | ||
public class TestDomainQueryRequest implements Request { | ||
} |
31 changes: 31 additions & 0 deletions
31
.../java/cn/chenyunlong/qing/samples/codegen/domain/dto/request/TestDomainUpdateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.dto.request; | ||
|
||
import cn.chenyunlong.common.model.Request; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
@Schema | ||
@Data | ||
public class TestDomainUpdateRequest implements Request { | ||
@Schema( | ||
title = "username", | ||
description = "username" | ||
) | ||
private String username; | ||
|
||
@Schema( | ||
title = "password", | ||
description = "password" | ||
) | ||
private String password; | ||
|
||
private Long id; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...main/java/cn/chenyunlong/qing/samples/codegen/domain/dto/response/TestDomainResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.dto.response; | ||
|
||
import cn.chenyunlong.common.model.AbstractJpaResponse; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
@Data | ||
@Schema | ||
@EqualsAndHashCode( | ||
callSuper = true | ||
) | ||
public class TestDomainResponse extends AbstractJpaResponse { | ||
@Schema( | ||
title = "username", | ||
description = "username" | ||
) | ||
private String username; | ||
|
||
@Schema( | ||
title = "password", | ||
description = "password" | ||
) | ||
private String password; | ||
} |
38 changes: 38 additions & 0 deletions
38
...c/main/java/cn/chenyunlong/qing/samples/codegen/domain/dto/updater/TestDomainUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.dto.updater; | ||
|
||
import cn.chenyunlong.qing.samples.codegen.domain.TestDomain; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
import java.util.Optional; | ||
|
||
@Schema | ||
@Data | ||
public class TestDomainUpdater { | ||
@Schema( | ||
title = "username", | ||
description = "username" | ||
) | ||
private String username; | ||
|
||
@Schema( | ||
title = "password", | ||
description = "password" | ||
) | ||
private String password; | ||
|
||
private Long id; | ||
|
||
public void updateTestDomain(TestDomain param) { | ||
Optional.ofNullable(getUsername()).ifPresent(param::setUsername); | ||
Optional.ofNullable(getPassword()).ifPresent(param::setPassword); | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...samples/src/main/java/cn/chenyunlong/qing/samples/codegen/domain/dto/vo/TestDomainVO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.dto.vo; | ||
|
||
import cn.chenyunlong.common.model.AbstractBaseJpaVo; | ||
import cn.chenyunlong.qing.samples.codegen.domain.TestDomain; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AccessLevel; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Schema | ||
@Data | ||
@EqualsAndHashCode( | ||
callSuper = true | ||
) | ||
@NoArgsConstructor( | ||
access = AccessLevel.PROTECTED | ||
) | ||
public class TestDomainVO extends AbstractBaseJpaVo { | ||
@Schema( | ||
title = "username", | ||
description = "username" | ||
) | ||
private String username; | ||
|
||
@Schema( | ||
title = "password", | ||
description = "password" | ||
) | ||
private String password; | ||
|
||
public TestDomainVO(TestDomain source) { | ||
super(); | ||
this.setId(source.getId()); | ||
this.setCreatedAt(source.getCreatedAt()); | ||
this.setUpdatedAt(source.getCreatedAt()); | ||
this.setVersion(source.getVersion()); | ||
this.setUsername(source.getUsername()); | ||
this.setPassword(source.getPassword()); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...les/src/main/java/cn/chenyunlong/qing/samples/codegen/domain/mapper/TestDomainMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.mapper; | ||
|
||
import cn.chenyunlong.qing.samples.codegen.domain.TestDomain; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.creator.TestDomainCreator; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.query.TestDomainQuery; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.request.TestDomainCreateRequest; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.request.TestDomainQueryRequest; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.request.TestDomainUpdateRequest; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.response.TestDomainResponse; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.updater.TestDomainUpdater; | ||
import cn.chenyunlong.qing.samples.codegen.domain.dto.vo.TestDomainVO; | ||
import cn.hutool.core.bean.BeanUtil; | ||
|
||
public interface TestDomainMapper { | ||
TestDomainMapper INSTANCE = new TestDomainMapper() { | ||
}; | ||
|
||
default TestDomain dtoToEntity(TestDomainCreator dto) { | ||
return BeanUtil.copyProperties(dto, TestDomain.class); | ||
} | ||
|
||
default TestDomainUpdater request2Updater(TestDomainUpdateRequest request) { | ||
return BeanUtil.copyProperties(request, TestDomainUpdater.class); | ||
} | ||
|
||
default TestDomainCreator request2Dto(TestDomainCreateRequest request) { | ||
return BeanUtil.copyProperties(request, TestDomainCreator.class); | ||
} | ||
|
||
default TestDomainQuery request2Query(TestDomainQueryRequest request) { | ||
return BeanUtil.copyProperties(request, TestDomainQuery.class); | ||
} | ||
|
||
default TestDomainResponse vo2Response(TestDomainVO vo) { | ||
return BeanUtil.copyProperties(vo, TestDomainResponse.class); | ||
} | ||
|
||
default TestDomainResponse vo2CustomResponse(TestDomainVO vo) { | ||
return vo2Response(vo); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...main/java/cn/chenyunlong/qing/samples/codegen/domain/repository/TestDomainRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package cn.chenyunlong.qing.samples.codegen.domain.repository; | ||
|
||
import cn.chenyunlong.jpa.support.BaseRepository; | ||
import cn.chenyunlong.qing.samples.codegen.domain.TestDomain; | ||
|
||
public interface TestDomainRepository extends BaseRepository<TestDomain, Long> { | ||
} |
Oops, something went wrong.