- 增加 demo 项目,用于作为脚手架的示例。目前暂未完成,提交保存下。
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.mall.demo.application;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.demo"})
|
||||
@EnableAsync(proxyTargetClass = true)
|
||||
public class DemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.mall.demo.application.controller;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.demo.application.convert.DemoProductConvert;
|
||||
import cn.iocoder.mall.demo.application.vo.DemoProductVO;
|
||||
import cn.iocoder.mall.demo.business.api.DemoProductService;
|
||||
import cn.iocoder.mall.demo.business.bo.DemoProductBO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/product")
|
||||
public class DemoProductController {
|
||||
|
||||
@Autowired
|
||||
private DemoProductService productService;
|
||||
|
||||
@GetMapping("/get")
|
||||
public CommonResult<DemoProductVO> get(@RequestParam("id") Integer id) {
|
||||
DemoProductBO product = productService.get(id);
|
||||
return CommonResult.success(DemoProductConvert.INSTANCE.convert(product));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.mall.demo.application.convert;
|
||||
|
||||
import cn.iocoder.mall.demo.application.vo.DemoProductVO;
|
||||
import cn.iocoder.mall.demo.business.bo.DemoProductBO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface DemoProductConvert {
|
||||
|
||||
DemoProductConvert INSTANCE = Mappers.getMapper(DemoProductConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
DemoProductVO convert(DemoProductBO object);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package cn.iocoder.mall.demo.application.vo;
|
||||
|
||||
public class DemoProductVO {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
# server
|
||||
server:
|
||||
port: 8080
|
||||
servlet:
|
||||
context-path: /demo-api/
|
||||
Reference in New Issue
Block a user