feat: 产品中心
This commit is contained in:
parent
88cfd1df74
commit
e40199b564
|
|
@ -3,6 +3,8 @@ package com.nflg.mobilebroken.common.pojo.vo;
|
|||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductModelInfoVO {
|
||||
|
|
@ -43,4 +45,29 @@ public class ProductModelInfoVO {
|
|||
* 图片地址
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 热图
|
||||
*/
|
||||
private ProductHotImageInfoVO hotImage;
|
||||
|
||||
/**
|
||||
* 主要参数列表
|
||||
*/
|
||||
private List<ProductModelParamVO> params;
|
||||
|
||||
/**
|
||||
* 产品图册
|
||||
*/
|
||||
private List<ProductImageVO> images;
|
||||
|
||||
/**
|
||||
* 产品视频
|
||||
*/
|
||||
private List<ProductVideoVO> videos;
|
||||
|
||||
/**
|
||||
* 产品资料
|
||||
*/
|
||||
private List<ProductFileVO> files;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.nflg.mobilebroken.product.controller;
|
||||
|
||||
import com.nflg.mobilebroken.common.constant.Constant;
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
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.entity.DictionaryItem;
|
||||
import com.nflg.mobilebroken.repository.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -39,6 +41,9 @@ public class InfoController extends BaseController{
|
|||
@Resource
|
||||
private IProductModelService productModelService;
|
||||
|
||||
@Resource
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
|
||||
/**
|
||||
* 获取介绍列表
|
||||
*/
|
||||
|
|
@ -63,6 +68,14 @@ public class InfoController extends BaseController{
|
|||
return ApiResult.success(productCaseService.get(MultilingualUtil.getLanguage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模块列表
|
||||
*/
|
||||
@GetMapping("/getModuleList")
|
||||
public ApiResult<List<DictionaryItem>> getModuleList(){
|
||||
return ApiResult.success(dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_PRODUCT_MODULE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索产品系列
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
spring.application.name=product
|
||||
spring.profiles.active=dev
|
||||
server.port=8084
|
||||
server.port=8085
|
||||
# 设置最大文件大小 (默认为1MB)
|
||||
spring.servlet.multipart.max-file-size=100MB
|
||||
# 设置所有文件总大小 (默认为10MB)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.nflg.mobilebroken.common.pojo.vo.ProductFileVO;
|
||||
import com.nflg.mobilebroken.repository.entity.ProductModelFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品中心-产品机型-文件 Mapper 接口
|
||||
|
|
@ -14,7 +16,9 @@ import com.nflg.mobilebroken.repository.entity.ProductModelFile;
|
|||
*/
|
||||
public interface ProductModelFileMapper extends BaseMapper<ProductModelFile> {
|
||||
|
||||
ProductFileVO getListByLanguage(Integer modelId, String language);
|
||||
ProductFileVO getDefaultByLanguage(Integer modelId, String language);
|
||||
|
||||
void copyItems(Integer oldId, Integer newId);
|
||||
|
||||
List<ProductFileVO> getListByLanguage(Integer modelId, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,4 +50,6 @@ public interface IProductModelFileService extends IService<ProductModelFile> {
|
|||
List<FileDefaultConfigVO> getDefaultConfig(@Valid @NotNull Integer modelId);
|
||||
|
||||
void setFileDefaultCondig(@Valid FileDefaultConfigRequest request);
|
||||
|
||||
List<ProductFileVO> getListByLanguage(Integer modelId, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.mobilebroken.repository.service;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.mobilebroken.common.pojo.request.*;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductHotImageInfoVO;
|
||||
import com.nflg.mobilebroken.repository.entity.ProductModelHotimage;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
|
@ -37,4 +38,6 @@ public interface IProductModelHotimageService extends IService<ProductModelHotim
|
|||
void deleteByModel(@NotEmpty List<Integer> ids);
|
||||
|
||||
void copyTo(Integer oldId, Integer newId);
|
||||
|
||||
ProductHotImageInfoVO getListByLanguage(Integer modelId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class ProductCaseServiceImpl extends ServiceImpl<ProductCaseMapper, Produ
|
|||
.ge(Objects.nonNull(request.getStartTime()), ProductCase::getPublishTime, request.getStartTime())
|
||||
.le(Objects.nonNull(request.getEndTime()), ProductCase::getPublishTime, request.getEndTime())
|
||||
.orderByAsc(ProductCase::getState)
|
||||
.orderByAsc(ProductCase::getTitle)
|
||||
.orderByAsc(ProductCase::getSort)
|
||||
.orderByDesc(ProductCase::getId)
|
||||
.page(new Page<>(request.getPage(), request.getPageSize()));
|
||||
return PageUtil.convert(page, d -> Convert.convert(ProductCaseSearchVO.class, d));
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ public class ProductModelFileServiceImpl extends ServiceImpl<ProductModelFileMap
|
|||
|
||||
@Override
|
||||
public ProductFileVO getDefaultByLanguage(Integer modelId, String language) {
|
||||
return baseMapper.getListByLanguage(modelId,language);
|
||||
return baseMapper.getDefaultByLanguage(modelId,language);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -231,4 +231,9 @@ public class ProductModelFileServiceImpl extends ServiceImpl<ProductModelFileMap
|
|||
public void setFileDefaultCondig(FileDefaultConfigRequest request) {
|
||||
productModelFileItemService.setFileDefaultCondig(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductFileVO> getListByLanguage(Integer modelId, String language) {
|
||||
return baseMapper.getListByLanguage(modelId,language);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.mobilebroken.common.constant.PublishState;
|
||||
import com.nflg.mobilebroken.common.pojo.request.*;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductHotImageInfoVO;
|
||||
import com.nflg.mobilebroken.common.util.AdminUserUtil;
|
||||
import com.nflg.mobilebroken.common.util.VUtils;
|
||||
import com.nflg.mobilebroken.repository.entity.ProductModelHotimage;
|
||||
|
|
@ -131,4 +133,12 @@ public class ProductModelHotimageServiceImpl extends ServiceImpl<ProductModelHot
|
|||
public void copyTo(Integer oldId, Integer newId) {
|
||||
baseMapper.copyTo(oldId,newId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductHotImageInfoVO getListByLanguage(Integer modelId) {
|
||||
return Convert.convert(ProductHotImageInfoVO.class,lambdaQuery()
|
||||
.eq(ProductModelHotimage::getModelId, modelId)
|
||||
.eq(ProductModelHotimage::getState, PublishState.Published.getState())
|
||||
.one());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,6 +188,8 @@ public class ProductModelParamsItemServiceImpl extends ServiceImpl<ProductModelP
|
|||
.setIndexName(it.getIndexName())
|
||||
.setName(it.getName())
|
||||
.setValue(it.getValue())
|
||||
.setMain(it.getMain())
|
||||
.setCompare(it.getCompare())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now()))
|
||||
.collect(Collectors.toList())
|
||||
|
|
|
|||
|
|
@ -104,7 +104,8 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
|
|||
List<ProductModelIntro> intros = productModelIntroService.lambdaQuery().eq(ProductModelIntro::getModelId, oldId).list();
|
||||
if (CollectionUtil.isNotEmpty(intros)) {
|
||||
intros.forEach(intro -> {
|
||||
Integer oId=intro.getId();
|
||||
int oId = intro.getId();
|
||||
intro.setId(null);
|
||||
productModelIntroService.save(intro);
|
||||
productModelIntroService.copyItems(oId, intro.getId());
|
||||
});
|
||||
|
|
@ -113,6 +114,7 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
|
|||
if (CollectionUtil.isNotEmpty(files)) {
|
||||
files.forEach(file -> {
|
||||
Integer oId=file.getId();
|
||||
file.setId(null);
|
||||
productModelFileService.save(file);
|
||||
productModelFileService.copyItems(oId, file.getId());
|
||||
});
|
||||
|
|
@ -122,6 +124,7 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
|
|||
if (CollectionUtil.isNotEmpty(images)){
|
||||
images.forEach(image -> {
|
||||
Integer oId=image.getId();
|
||||
image.setId(null);
|
||||
productModelImageService.save(image);
|
||||
productModelImageService.copyItems(oId, image.getId());
|
||||
});
|
||||
|
|
@ -130,6 +133,7 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
|
|||
if (CollectionUtil.isNotEmpty(videos)){
|
||||
videos.forEach(video -> {
|
||||
Integer oId=video.getId();
|
||||
video.setId(null);
|
||||
productModelVideoService.save(video);
|
||||
productModelVideoService.copyItems(oId, video.getId());
|
||||
});
|
||||
|
|
@ -138,6 +142,7 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
|
|||
if (CollectionUtil.isNotEmpty(params)){
|
||||
params.forEach(param -> {
|
||||
Integer oId=param.getId();
|
||||
param.setId(null);
|
||||
productPartParamsService.save(param);
|
||||
productPartParamsService.copyItems(oId, param.getId());
|
||||
});
|
||||
|
|
@ -257,7 +262,12 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
|
|||
.setRecommend(productModel.getRecommend())
|
||||
.setSort(productModel.getSort())
|
||||
.setNo(productModel.getNo())
|
||||
.setImage(productModel.getImage());
|
||||
.setImage(productModel.getImage())
|
||||
.setHotImage(productModelHotimageService.getListByLanguage(modelId))
|
||||
.setParams(productPartParamsService.getAllListByLanguage(modelId, language))
|
||||
.setImages(productModelImageService.getListByLanguage(modelId, language))
|
||||
.setVideos(productModelVideoService.getListByLanguage(modelId, language))
|
||||
.setFiles(productModelFileService.getListByLanguage(modelId, language));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?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.nflg.mobilebroken.repository.mapper.ProductModelFileMapper">
|
||||
<select id="getListByLanguage" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductFileVO">
|
||||
<select id="getDefaultByLanguage" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductFileVO">
|
||||
SELECT pmfi.name, pmfi.*
|
||||
FROM product_model_file pmf
|
||||
INNER JOIN product_model_file_item pmfi ON pmf.id = pmfi.model_file_id
|
||||
|
|
@ -19,4 +19,11 @@
|
|||
FROM product_model_file_item
|
||||
WHERE model_file_id=#{oldId}
|
||||
</select>
|
||||
|
||||
<select id="getListByLanguage" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductFileVO">
|
||||
SELECT pmfi.name,pmf.*
|
||||
FROM product_model_file pmf
|
||||
INNER JOIN product_model_file_item pmfi ON pmf.id = pmfi.model_file_id
|
||||
WHERE pmf.`enable` = 1 AND pmf.state = 1 AND pmfi.show_in_list = 1 AND pmf.model_id = #{modelId} AND pmfi.language_code = #{language}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue