parent
300d68938e
commit
78e3fbef8f
@ -0,0 +1,32 @@
|
|||||||
|
package com.cyl.h5.controller;
|
||||||
|
|
||||||
|
import com.cyl.h5.pojo.vo.HomeConfigVO;
|
||||||
|
import com.cyl.pms.service.ProductCategoryService;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/no-auth/home")
|
||||||
|
public class HomeController {
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService sysConfigService;
|
||||||
|
@Autowired
|
||||||
|
private ProductCategoryService categoryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页配置
|
||||||
|
*
|
||||||
|
* @return 首页配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/home-cfg")
|
||||||
|
public ResponseEntity<HomeConfigVO> getHomeConfig() {
|
||||||
|
HomeConfigVO res = new HomeConfigVO();
|
||||||
|
res.setBanners(sysConfigService.selectConfigByKey("h5.home.banner"));
|
||||||
|
res.setCategoryList(categoryService.queryCategoryWithProductsForH5());
|
||||||
|
return ResponseEntity.ok(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cyl.h5.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CategoryDTO {
|
||||||
|
private Long id;
|
||||||
|
private Integer sort;
|
||||||
|
private String name;
|
||||||
|
private String icon;
|
||||||
|
private List<ProductDTO> productList;
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.cyl.h5.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
@Data
|
||||||
|
public class ProductDTO {
|
||||||
|
private Long id;
|
||||||
|
private String pic;
|
||||||
|
private String name;
|
||||||
|
private BigDecimal price;
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cyl.h5.pojo.vo;
|
||||||
|
|
||||||
|
import com.cyl.h5.pojo.dto.CategoryDTO;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HomeConfigVO {
|
||||||
|
// 头部广告栏
|
||||||
|
private String banners;
|
||||||
|
// 品类列表
|
||||||
|
private List<CategoryDTO> categoryList;
|
||||||
|
}
|
||||||
Loading…
Reference in new issue