feat: 产品中心
This commit is contained in:
parent
b69cbdca80
commit
878c73d602
|
|
@ -0,0 +1,56 @@
|
|||
package com.nflg.mobilebroken.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors
|
||||
public class FrontendProductModelSearchVO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 模块id
|
||||
*/
|
||||
private Integer moduleId;
|
||||
|
||||
/**
|
||||
* 系列名称
|
||||
*/
|
||||
private String seriesName;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 是否新品
|
||||
*/
|
||||
private Boolean recommend;
|
||||
|
||||
/**
|
||||
* 机型介绍
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 机型特点
|
||||
*/
|
||||
private String feature;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.nflg.mobilebroken.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FrontendProductSeriesSearchVO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 模块id
|
||||
*/
|
||||
private Integer moduleId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.nflg.mobilebroken.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class FrontendProductTypeSearchVO extends FrontendProductSeriesSearchVO{
|
||||
|
||||
/**
|
||||
* 系列名称
|
||||
*/
|
||||
private String seriesName;
|
||||
|
||||
/**
|
||||
* 机型说明
|
||||
*/
|
||||
private String modelDesc;
|
||||
}
|
||||
|
|
@ -1,19 +1,16 @@
|
|||
package com.nflg.mobilebroken.product.controller;
|
||||
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductCaseVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductHonorVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductIntroVO;
|
||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ProductSeriesSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.*;
|
||||
import com.nflg.mobilebroken.common.util.MultilingualUtil;
|
||||
import com.nflg.mobilebroken.repository.service.IProductCaseService;
|
||||
import com.nflg.mobilebroken.repository.service.IProductHonorService;
|
||||
import com.nflg.mobilebroken.repository.service.IProductIntroService;
|
||||
import com.nflg.mobilebroken.repository.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -33,6 +30,15 @@ public class InfoController extends BaseController{
|
|||
@Resource
|
||||
private IProductCaseService productCaseService;
|
||||
|
||||
@Resource
|
||||
private IProductSeriesService productSeriesService;
|
||||
|
||||
@Resource
|
||||
private IProductTypeService productTypeService;
|
||||
|
||||
@Resource
|
||||
private IProductModelService productModelService;
|
||||
|
||||
/**
|
||||
* 获取介绍列表
|
||||
*/
|
||||
|
|
@ -56,4 +62,28 @@ public class InfoController extends BaseController{
|
|||
public ApiResult<List<ProductCaseVO>> getCase(){
|
||||
return ApiResult.success(productCaseService.get(MultilingualUtil.getLanguage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索产品系列
|
||||
*/
|
||||
@PostMapping("/searchProductSeries")
|
||||
public ApiResult<PageData<FrontendProductSeriesSearchVO>> searchProductSeries(@Valid @RequestBody ProductSeriesSearchRequest request) {
|
||||
return ApiResult.success(productSeriesService.search(request, MultilingualUtil.getLanguage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索产品类型
|
||||
*/
|
||||
@PostMapping("/searchProductType")
|
||||
public ApiResult<PageData<FrontendProductTypeSearchVO>> searchProductType(@Valid @RequestBody ProductSeriesSearchRequest request) {
|
||||
return ApiResult.success(productTypeService.search(request, MultilingualUtil.getLanguage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索产品机型
|
||||
*/
|
||||
@PostMapping("/searchProductModel")
|
||||
public ApiResult<PageData<FrontendProductModelSearchVO>> searchProductModel(@Valid @RequestBody ProductSeriesSearchRequest request) {
|
||||
return ApiResult.success(productModelService.search(request, MultilingualUtil.getLanguage()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.mobilebroken.repository.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ProductModelSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.FrontendProductModelSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductModelInfoVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductModelSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductModelVO;
|
||||
|
|
@ -25,4 +26,6 @@ public interface ProductModelMapper extends BaseMapper<ProductModel> {
|
|||
List<ProductModelVO> get(String typeNo, String language);
|
||||
|
||||
ProductModelInfoVO getInfo(Integer modelId, String language);
|
||||
|
||||
Page<FrontendProductModelSearchVO> search(String name, String language, Page<?> page);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.mobilebroken.repository.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ProductSeriesSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.FrontendProductSeriesSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductSeriesSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductSeriesVO;
|
||||
import com.nflg.mobilebroken.repository.entity.ProductSeries;
|
||||
|
|
@ -25,4 +26,6 @@ public interface ProductSeriesMapper extends BaseMapper<ProductSeries> {
|
|||
List<ProductSeriesVO> get(Integer moduleId,String language);
|
||||
|
||||
void copyItems(@NotNull Integer oldId, Integer newId);
|
||||
|
||||
Page<FrontendProductSeriesSearchVO> search(String name, String language, Page<?> page);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.mobilebroken.repository.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ProductTypeSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.FrontendProductTypeSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductTypeSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductTypeVO;
|
||||
import com.nflg.mobilebroken.repository.entity.ProductType;
|
||||
|
|
@ -25,4 +26,6 @@ public interface ProductTypeMapper extends BaseMapper<ProductType> {
|
|||
List<ProductTypeVO> get(Integer moduleId,String seriesNo, String language);
|
||||
|
||||
void copyItems(@NotNull Integer oldId, Integer newId);
|
||||
|
||||
Page<FrontendProductTypeSearchVO> search(String name, String language, Page<?> page);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,4 +46,6 @@ public interface IProductModelService extends IService<ProductModel> {
|
|||
List<ProductModelSearchVO> getListForSort();
|
||||
|
||||
void saveSort(@NotEmpty List<Integer> ids);
|
||||
|
||||
Page<FrontendProductModelSearchVO> search(@Valid ProductSeriesSearchRequest request, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.mobilebroken.repository.service;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.mobilebroken.common.pojo.request.*;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.FrontendProductSeriesSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductSeriesInfoVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductSeriesSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductSeriesVO;
|
||||
|
|
@ -45,4 +46,6 @@ public interface IProductSeriesService extends IService<ProductSeries> {
|
|||
List<ProductSeriesSearchVO> getListForSort();
|
||||
|
||||
void saveSort(@NotEmpty List<Integer> ids);
|
||||
|
||||
Page<FrontendProductSeriesSearchVO> search(ProductSeriesSearchRequest request, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.mobilebroken.repository.service;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.mobilebroken.common.pojo.request.*;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.FrontendProductTypeSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductTypeInfoVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductTypeSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductTypeVO;
|
||||
|
|
@ -47,4 +48,6 @@ public interface IProductTypeService extends IService<ProductType> {
|
|||
List<ProductTypeSearchVO> getListForSort();
|
||||
|
||||
void saveSort(@NotEmpty List<Integer> ids);
|
||||
|
||||
Page<FrontendProductTypeSearchVO> search(@Valid ProductSeriesSearchRequest request, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,6 +327,11 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
|
|||
updateBatchById(datas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<FrontendProductModelSearchVO> search(ProductSeriesSearchRequest request, String language) {
|
||||
return baseMapper.search(request.getName(),language,new Page<>(request.getPage(), request.getPageSize()));
|
||||
}
|
||||
|
||||
private ProductModelCompareInfoVO getModelCompareInfo(Integer modelId, String language){
|
||||
ProductModel productModel = getById(modelId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(productModel)).throwMessage("无效的数据");
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.nflg.mobilebroken.common.constant.Constant;
|
||||
import com.nflg.mobilebroken.common.constant.PublishState;
|
||||
import com.nflg.mobilebroken.common.pojo.request.*;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.FrontendProductSeriesSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductSeriesInfoVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductSeriesSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductSeriesVO;
|
||||
|
|
@ -227,4 +228,9 @@ public class ProductSeriesServiceImpl extends ServiceImpl<ProductSeriesMapper, P
|
|||
}
|
||||
updateBatchById(datas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<FrontendProductSeriesSearchVO> search(ProductSeriesSearchRequest request, String language) {
|
||||
return baseMapper.search(request.getName(),language,new Page<>(request.getPage(),request.getPageSize()));
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.nflg.mobilebroken.common.constant.Constant;
|
||||
import com.nflg.mobilebroken.common.constant.PublishState;
|
||||
import com.nflg.mobilebroken.common.pojo.request.*;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.FrontendProductTypeSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductTypeInfoVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductTypeSearchVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductTypeVO;
|
||||
|
|
@ -249,6 +250,11 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
updateBatchById(datas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<FrontendProductTypeSearchVO> search(ProductSeriesSearchRequest request, String language) {
|
||||
return baseMapper.search(request.getName(), language, new Page<>(request.getPage(), request.getPageSize()));
|
||||
}
|
||||
|
||||
private void delete(Integer typeId){
|
||||
ProductType info=getById(typeId);
|
||||
removeById(typeId);
|
||||
|
|
|
|||
|
|
@ -36,17 +36,34 @@
|
|||
</select>
|
||||
|
||||
<select id="get" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductModelVO">
|
||||
SELECT pm.id,pmi.*
|
||||
SELECT pm.*
|
||||
FROM product_model pm
|
||||
LEFT JOIN product_model_info pmi ON pmi.mode_id=pm.id AND pmi.language_code=#{language}
|
||||
WHERE pm.type_name=#{typeNo} AND pm.enable=1 AND pm.state=1
|
||||
LEFT JOIN product_model_intro pmi ON pmi.model_id = pm.id
|
||||
LEFT JOIN product_model_intro_item pmii ON pmii.model_intro_id = pmi.id
|
||||
WHERE pm.enable = 1
|
||||
AND pm.state = 1
|
||||
AND pmi.state = 1
|
||||
AND pm.type_name = #{typeNo}
|
||||
AND pmii.language_code = #{language}
|
||||
ORDER BY pm.sort DESC;
|
||||
</select>
|
||||
|
||||
<select id="getInfo" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductModelInfoVO">
|
||||
SELECT pm.id,pmi.*
|
||||
SELECT pm.*
|
||||
FROM product_model pm
|
||||
LEFT JOIN product_model_info pmi ON pmi.mode_id=pm.id AND pmi.language_code= #{language}
|
||||
WHERE pm.id= #{modelId};
|
||||
</select>
|
||||
|
||||
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.FrontendProductModelSearchVO">
|
||||
SELECT pm.id, pm.`no`, pm.image, pm.recommend, pmii.`desc`, pmii.feature
|
||||
FROM product_model pm
|
||||
INNER JOIN product_model_intro pmi ON pm.id = pmi.model_id
|
||||
INNER JOIN product_model_intro_item pmii ON pmi.id = pmii.model_intro_id
|
||||
WHERE pm.state = 1
|
||||
AND pm.`enable` = 1
|
||||
AND pmi.state = 1
|
||||
AND pmii.language_code = #{language}
|
||||
AND (pm.`no` LIKE CONCAT('%', #{name}, '%') OR pmii.`desc` LIKE CONCAT('%', #{name}, '%') OR
|
||||
pmii.feature LIKE CONCAT('%', #{name}, '%'))
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -48,4 +48,15 @@
|
|||
FROM product_series_info
|
||||
WHERE series_id = #{oldId}
|
||||
</select>
|
||||
|
||||
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.FrontendProductSeriesSearchVO">
|
||||
SELECT ps.id,ps.module_id, psi.`name`, psi.content, psi.image
|
||||
FROM product_series ps
|
||||
INNER JOIN product_series_info psi ON ps.id = psi.series_id
|
||||
WHERE ps.state = 1
|
||||
AND ps.`enable` = 1
|
||||
AND psi.language_code = #{language}
|
||||
AND psi.`name` LIKE CONCAT('%', #{name}, '%')
|
||||
ORDER BY ps.sort,ps.id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -50,4 +50,15 @@
|
|||
FROM product_type_file
|
||||
WHERE type_id=#{oldId}
|
||||
</select>
|
||||
|
||||
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.FrontendProductTypeSearchVO">
|
||||
SELECT pt.id, pti.`name`, pti.content, pti.image, pti.model_desc
|
||||
FROM product_type pt
|
||||
INNER JOIN product_type_info pti ON pt.id = pti.type_id
|
||||
WHERE pt.state = 1
|
||||
AND pt.`enable` = 1
|
||||
AND pti.language_code = #{language}
|
||||
AND pti.`name` LIKE CONCAT('%', #{name}, '%')
|
||||
ORDER BY pt.sort,pt.id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue