Compare commits
2 Commits
6b793228e3
...
c93a74e9a5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c93a74e9a5 | ||
|
|
bdd48ead74 |
@@ -27,7 +27,7 @@ public class Knife4jConfiguration {
|
|||||||
.groupName("1.1.0版本")
|
.groupName("1.1.0版本")
|
||||||
.select()
|
.select()
|
||||||
//这里指定Controller扫描包路径
|
//这里指定Controller扫描包路径
|
||||||
.apis(RequestHandlerSelectors.basePackage("com.corewing.app.modules.app"))
|
.apis(RequestHandlerSelectors.basePackage("com.corewing.app.modules"))
|
||||||
.paths(PathSelectors.any())
|
.paths(PathSelectors.any())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
|||||||
.excludePathPatterns("/app_version/**")
|
.excludePathPatterns("/app_version/**")
|
||||||
// 排除获取最新app接口
|
// 排除获取最新app接口
|
||||||
.excludePathPatterns("/api/app", "/api/app/getAppVersion")
|
.excludePathPatterns("/api/app", "/api/app/getAppVersion")
|
||||||
|
.excludePathPatterns("/api/website/**")
|
||||||
// 排除模型接口
|
// 排除模型接口
|
||||||
.excludePathPatterns("/model/page", "/model/list", "/model/detail/**", "/model/category/**")
|
.excludePathPatterns("/model/page", "/model/list", "/model/detail/**", "/model/category/**")
|
||||||
// 排除咨询接口
|
// 排除咨询接口
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.corewing.app.dto.website;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProductCategoryRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品名称")
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.corewing.app.dto.website;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProductPageRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品名称")
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品分类")
|
||||||
|
private String categoryId;
|
||||||
|
|
||||||
|
}
|
||||||
47
src/main/java/com/corewing/app/entity/BizProduct.java
Normal file
47
src/main/java/com/corewing/app/entity/BizProduct.java
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package com.corewing.app.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.corewing.app.common.base.CommonEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@TableName("biz_product")
|
||||||
|
public class BizProduct extends CommonEntity {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String thumbnail;
|
||||||
|
|
||||||
|
private String hotStatus;
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
private String detailUrl;
|
||||||
|
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private int sortCode;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private String extJson;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String categoryId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.corewing.app.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.corewing.app.common.base.CommonEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@TableName("biz_product_category")
|
||||||
|
public class BizProductCategory extends CommonEntity {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
private String thumbnail;
|
||||||
|
|
||||||
|
private String categoryTitle;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private Integer sortCode;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private String extJson;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
Page<BizProduct> productPage;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.corewing.app.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("biz_product_category_relation")
|
||||||
|
public class BizProductCategoryRelation {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String productId;
|
||||||
|
|
||||||
|
private String categoryId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.corewing.app.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.corewing.app.dto.website.ProductCategoryRequest;
|
||||||
|
import com.corewing.app.entity.BizProductCategory;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface BizProductCategoryMapper extends BaseMapper<BizProductCategory> {
|
||||||
|
|
||||||
|
List<BizProductCategory> list(@Param("productCategoryRequest") ProductCategoryRequest productCategoryRequest);
|
||||||
|
}
|
||||||
14
src/main/java/com/corewing/app/mapper/BizProductMapper.java
Normal file
14
src/main/java/com/corewing/app/mapper/BizProductMapper.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.corewing.app.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.corewing.app.dto.website.ProductPageRequest;
|
||||||
|
import com.corewing.app.entity.BizProduct;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface BizProductMapper extends BaseMapper<BizProduct> {
|
||||||
|
|
||||||
|
Page<BizProduct> page(Page<BizProduct> page, @Param("productPageRequest") ProductPageRequest productPageRequest);
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.corewing.app.common.Result;
|
|||||||
import com.corewing.app.entity.AppVersion;
|
import com.corewing.app.entity.AppVersion;
|
||||||
import com.corewing.app.service.AppVersionService;
|
import com.corewing.app.service.AppVersionService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -13,14 +14,15 @@ import javax.annotation.Resource;
|
|||||||
/**
|
/**
|
||||||
* 获取最新的APP版本
|
* 获取最新的APP版本
|
||||||
*/
|
*/
|
||||||
@Api("最新APP版本")
|
@Api(tags = "官网APP版本")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/app")
|
@RequestMapping("/api/app")
|
||||||
public class AppVersionWebsiteController {
|
public class WebsiteAppVersionController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AppVersionService appVersionService;
|
private AppVersionService appVersionService;
|
||||||
|
|
||||||
|
@ApiOperation("获取最新APP版本")
|
||||||
@GetMapping("/getAppVersion")
|
@GetMapping("/getAppVersion")
|
||||||
public Result<AppVersion> getAppVersion() {
|
public Result<AppVersion> getAppVersion() {
|
||||||
return Result.success(appVersionService.getAppVersion());
|
return Result.success(appVersionService.getAppVersion());
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.corewing.app.modules.website;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.corewing.app.common.Result;
|
||||||
|
import com.corewing.app.dto.website.ProductCategoryRequest;
|
||||||
|
import com.corewing.app.dto.website.ProductPageRequest;
|
||||||
|
import com.corewing.app.entity.BizProduct;
|
||||||
|
import com.corewing.app.entity.BizProductCategory;
|
||||||
|
import com.corewing.app.service.BizProductCategoryService;
|
||||||
|
import com.corewing.app.service.BizProductService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品
|
||||||
|
*/
|
||||||
|
@Api(tags = "官网产品列表")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/website/product")
|
||||||
|
public class WebsiteProductController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizProductService productService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizProductCategoryService productCategoryService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("获取产品分页")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public Result<Page<BizProduct>> page(ProductPageRequest productPageRequest) {
|
||||||
|
return Result.success(productService.page(productPageRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取产品分类")
|
||||||
|
@GetMapping("/category/list")
|
||||||
|
public Result<List<BizProductCategory>> categoryList(ProductCategoryRequest productCategoryRequest) {
|
||||||
|
return Result.success(productCategoryService.list(productCategoryRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.corewing.app.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.corewing.app.dto.website.ProductCategoryRequest;
|
||||||
|
import com.corewing.app.entity.BizProductCategory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface BizProductCategoryService extends IService<BizProductCategory> {
|
||||||
|
|
||||||
|
List<BizProductCategory> list(ProductCategoryRequest productCategoryRequest);
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.corewing.app.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.corewing.app.dto.website.ProductPageRequest;
|
||||||
|
import com.corewing.app.entity.BizProduct;
|
||||||
|
|
||||||
|
public interface BizProductService extends IService<BizProduct> {
|
||||||
|
|
||||||
|
Page<BizProduct> page(ProductPageRequest productPageRequest);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.corewing.app.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.corewing.app.dto.website.ProductCategoryRequest;
|
||||||
|
import com.corewing.app.dto.website.ProductPageRequest;
|
||||||
|
import com.corewing.app.entity.BizProduct;
|
||||||
|
import com.corewing.app.entity.BizProductCategory;
|
||||||
|
import com.corewing.app.mapper.BizProductCategoryMapper;
|
||||||
|
import com.corewing.app.service.BizProductCategoryService;
|
||||||
|
import com.corewing.app.service.BizProductService;
|
||||||
|
import com.google.gson.internal.LinkedTreeMap;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BizProductCategroyServiceImpl extends ServiceImpl<BizProductCategoryMapper, BizProductCategory> implements BizProductCategoryService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizProductCategoryMapper bizProductCategoryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizProductService bizProductService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BizProductCategory> list(ProductCategoryRequest productCategoryRequest) {
|
||||||
|
List<BizProductCategory> bizProductCategory = bizProductCategoryMapper.list(productCategoryRequest);
|
||||||
|
bizProductCategory.forEach(item -> {
|
||||||
|
ProductPageRequest query = new ProductPageRequest();
|
||||||
|
query.setCategoryId(item.getId());
|
||||||
|
Page<BizProduct> page = bizProductService.page(query);
|
||||||
|
item.setProductPage(page);
|
||||||
|
});
|
||||||
|
return bizProductCategory;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.corewing.app.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.corewing.app.common.page.PageContext;
|
||||||
|
import com.corewing.app.dto.website.ProductPageRequest;
|
||||||
|
import com.corewing.app.entity.AppModel;
|
||||||
|
import com.corewing.app.entity.BizProduct;
|
||||||
|
import com.corewing.app.mapper.BizProductMapper;
|
||||||
|
import com.corewing.app.service.BizProductService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BizProductServiceImpl extends ServiceImpl<BizProductMapper, BizProduct> implements BizProductService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizProductMapper bizProductMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<BizProduct> page(ProductPageRequest productPageRequest) {
|
||||||
|
Page<BizProduct> page = PageContext.getPage(BizProduct.class);
|
||||||
|
return bizProductMapper.page(page, productPageRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
23
src/main/resources/mapper/BizProductCategoryMapper.xml
Normal file
23
src/main/resources/mapper/BizProductCategoryMapper.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.corewing.app.mapper.BizProductCategoryMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 基础查询SQL片段 -->
|
||||||
|
<sql id="selectVOSql">
|
||||||
|
SELECT pc.*
|
||||||
|
FROM biz_product_category pc
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="list" resultType="com.corewing.app.entity.BizProductCategory">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
<where>
|
||||||
|
<if test="productCategoryRequest.searchKey != null and productCategoryRequest.searchKey != ''">
|
||||||
|
pc.category_title like CONCAT('%', #{productCategoryRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
28
src/main/resources/mapper/BizProductMapper.xml
Normal file
28
src/main/resources/mapper/BizProductMapper.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.corewing.app.mapper.BizProductMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 基础查询SQL片段 -->
|
||||||
|
<sql id="selectVOSql">
|
||||||
|
SELECT p.*
|
||||||
|
FROM biz_product p
|
||||||
|
LEFT JOIN biz_product_category_relation pcr on p.id = pcr.product_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="page" resultType="com.corewing.app.entity.BizProduct">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
<where>
|
||||||
|
<if test="productPageRequest.categoryId != null and productPageRequest.categoryId != ''">
|
||||||
|
pcr.category_id = #{productPageRequest.categoryId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="productPageRequest.searchKey != null and productPageRequest.searchKey != ''">
|
||||||
|
p.title like CONCAT('%', #{productPageRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user