feat: 产品中心

This commit is contained in:
曹鹏飞 2025-06-03 10:50:23 +08:00
parent ab47a6c450
commit a01c75f9a5
48 changed files with 290 additions and 14 deletions

View File

@ -1,9 +1,12 @@
package com.nflg.mobilebroken.admin.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.*;
import com.nflg.mobilebroken.common.pojo.vo.*;
import com.nflg.mobilebroken.repository.entity.DictionaryItem;
import com.nflg.mobilebroken.repository.service.IDictionaryItemService;
import com.nflg.mobilebroken.repository.service.IProductCaseService;
import com.nflg.mobilebroken.repository.service.IProductHonorService;
import com.nflg.mobilebroken.repository.service.IProductIntroService;
@ -13,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 产品中心基础信息
@ -22,6 +26,9 @@ import javax.validation.constraints.NotNull;
@RequestMapping("/product/base")
public class ProductBaseController extends ControllerBase{
@Resource
private IDictionaryItemService dictionaryItemService;
@Resource
private IProductIntroService productIntroService;
@ -31,6 +38,15 @@ public class ProductBaseController extends ControllerBase{
@Resource
private IProductCaseService productCaseService;
/**
* 获取栏目列表
* @return 栏目列表
*/
@GetMapping("/getCategoryList")
public ApiResult<List<DictionaryItem>> getCategoryList(){
return ApiResult.success(dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_PRODUCT_INTRO_CATEGORY));
}
/**
* 添加介绍
* @param request 请求参数

View File

@ -128,4 +128,6 @@ public class Constant {
public static final String DICTIONARY_AD_POSITION ="AdvertisementPosition";
public static final String DICTIONARY_PRODUCT_MODEL_MAIN_PARAMS ="ProductModelMainParams";
public static final String DICTIONARY_PRODUCT_INTRO_CATEGORY ="ProductIntroCategory";
}

View File

@ -1,6 +1,5 @@
package com.nflg.mobilebroken.common.pojo.request;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -27,7 +26,6 @@ public class ProductPartInfoAddRequest {
/**
* 介绍
*/
@TableField(value = "`desc`")
private String desc;
/**

View File

@ -1,14 +1,16 @@
package com.nflg.mobilebroken.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 产品中心-案例-详情
@ -41,6 +43,7 @@ public class ProductCaseInfo implements Serializable {
/**
* 描述
*/
@TableField(value = "`desc`")
private String desc;
/**

View File

@ -1,14 +1,16 @@
package com.nflg.mobilebroken.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 产品中心-介绍详情
@ -46,6 +48,7 @@ public class ProductIntroInfo implements Serializable {
/**
* 内容
*/
@TableField(value = "`desc`")
private String desc;
/**

View File

@ -1,14 +1,16 @@
package com.nflg.mobilebroken.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 产品中心-介绍详情
@ -41,6 +43,7 @@ public class ProductMobilebrokenIntroInfo implements Serializable {
/**
* 内容
*/
@TableField(value = "`desc`")
private String desc;
/**

View File

@ -1,14 +1,16 @@
package com.nflg.mobilebroken.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 产品中心-机型详情
@ -41,6 +43,7 @@ public class ProductModelInfo implements Serializable {
/**
* 机型介绍
*/
@TableField(value = "`desc`")
private String desc;
/**

View File

@ -1,13 +1,15 @@
package com.nflg.mobilebroken.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* 产品中心-部件详情
@ -60,5 +62,6 @@ public class ProductPartInfo implements Serializable {
/**
* 部件介绍
*/
@TableField(value = "`desc`")
private String desc;
}

View File

@ -1,14 +1,16 @@
package com.nflg.mobilebroken.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 产品中心-部件-参数
@ -46,6 +48,7 @@ public class ProductPartParams implements Serializable {
/**
* 参数值
*/
@TableField(value = "`value`")
private String value;
/**

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.mobilebroken.common.pojo.request.ProductCaseInfoAddRequest;
import com.nflg.mobilebroken.repository.entity.ProductCaseInfo;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -21,4 +22,6 @@ public interface IProductCaseInfoService extends IService<ProductCaseInfo> {
void update(List<ProductCaseInfoAddRequest> items);
List<ProductCaseInfoAddRequest> getInfo(Integer caseId);
void delete(@NotEmpty List<Integer> ids);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.mobilebroken.common.pojo.request.ProductHonorInfoAddRequest;
import com.nflg.mobilebroken.repository.entity.ProductHonorInfo;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -21,4 +22,6 @@ public interface IProductHonorInfoService extends IService<ProductHonorInfo> {
void update(List<ProductHonorInfoAddRequest> items);
List<ProductHonorInfoAddRequest> getInfo(Integer honorId);
void delete(@NotEmpty List<Integer> ids);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.mobilebroken.common.pojo.request.ProductIntroInfoAddRequest;
import com.nflg.mobilebroken.repository.entity.ProductIntroInfo;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -21,4 +22,6 @@ public interface IProductIntroInfoService extends IService<ProductIntroInfo> {
void update(List<ProductIntroInfoAddRequest> items);
List<ProductIntroInfoAddRequest> getInfo(Integer introId);
void delete(@NotEmpty List<Integer> ids);
}

View File

@ -4,6 +4,7 @@ import com.nflg.mobilebroken.common.pojo.request.ProductMobileIntroInfoAddReques
import com.nflg.mobilebroken.repository.entity.ProductMobilebrokenIntroInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -21,4 +22,6 @@ public interface IProductMobilebrokenIntroInfoService extends IService<ProductMo
void update(List<ProductMobileIntroInfoAddRequest> items);
List<ProductMobileIntroInfoAddRequest> getInfo(Integer introId);
void delete(@NotEmpty List<Integer> ids);
}

View File

@ -8,6 +8,7 @@ import com.nflg.mobilebroken.common.pojo.vo.ProductModelFileInfoVO;
import com.nflg.mobilebroken.repository.entity.ProductModelFile;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -35,4 +36,6 @@ public interface IProductModelFileService extends IService<ProductModelFile> {
ProductModelFileInfoVO getInfo(Integer modelFileId);
List<ProductFileVO> getListByLanguage(Integer modelId, String language);
void deleteByModel(@NotEmpty List<Integer> ids);
}

View File

@ -6,7 +6,9 @@ import com.nflg.mobilebroken.common.pojo.request.*;
import com.nflg.mobilebroken.repository.entity.ProductModelHotimage;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>
@ -31,4 +33,6 @@ public interface IProductModelHotimageService extends IService<ProductModelHotim
ProductModelHotimage getInfo(@Valid @NotNull Integer hotImageId);
ProductModelHotimage getPublishedInfo(Integer modelId);
void deleteByModel(@NotEmpty List<Integer> ids);
}

View File

@ -8,6 +8,7 @@ import com.nflg.mobilebroken.common.pojo.vo.ProductModelImagesInfoVO;
import com.nflg.mobilebroken.repository.entity.ProductModelImage;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -35,4 +36,6 @@ public interface IProductModelImageService extends IService<ProductModelImage> {
void enable(@Valid EnableRequest request);
List<ProductImageVO> getListByLanguage(Integer modelId, String language);
void deleteByModel(@NotEmpty List<Integer> ids);
}

View File

@ -10,6 +10,8 @@ import com.nflg.mobilebroken.common.pojo.vo.ProductModelInfoSearchVO;
import com.nflg.mobilebroken.repository.entity.ProductModelInfo;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
* <p>
@ -32,4 +34,6 @@ public interface IProductModelInfoService extends IService<ProductModelInfo> {
IPage<ProductModelInfoSearchVO> getList(ProductModelInfoSearchRequest request);
ProductModelInfo getInfo(Integer modelId, String language);
void deleteByModel(@NotEmpty List<Integer> ids);
}

View File

@ -10,6 +10,7 @@ import com.nflg.mobilebroken.common.pojo.vo.ProductModelParamVO;
import com.nflg.mobilebroken.repository.entity.ProductModelParams;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -35,4 +36,6 @@ public interface IProductModelParamsService extends IService<ProductModelParams>
List<ProductModelParamVO> getListByLanguage(Integer modelId, String language,boolean main);
List<ProductModelParamVO> getAllListByLanguage(Integer modelId, String language);
void deleteByModel(@NotEmpty List<Integer> ids);
}

View File

@ -39,4 +39,6 @@ public interface IProductModelService extends IService<ProductModel> {
List<ProductModelCompareInfoVO> getModelCompareInfo(@Valid BatchDeleteRequest request, String language);
List<ProductModelSimpleVO> getListForCompare(@Valid @NotNull String typeNo);
void deleteByParent(String seriesName, String name);
}

View File

@ -8,6 +8,7 @@ import com.nflg.mobilebroken.common.pojo.vo.ProductVideoVO;
import com.nflg.mobilebroken.repository.entity.ProductModelVideo;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -35,4 +36,6 @@ public interface IProductModelVideoService extends IService<ProductModelVideo> {
ProductModelVideoInfoVO getInfo(Integer modelVideoId);
List<ProductVideoVO> getListByLanguage(Integer modelId, String language);
void deleteByModel(@NotEmpty List<Integer> ids);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.mobilebroken.common.pojo.request.ProductPartInfoAddRequest;
import com.nflg.mobilebroken.repository.entity.ProductPartInfo;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -21,4 +22,6 @@ public interface IProductPartInfoService extends IService<ProductPartInfo> {
void update(List<ProductPartInfoAddRequest> items);
List<ProductPartInfoAddRequest> getInfo(Integer partId);
void delete(@NotEmpty List<Integer> ids);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.mobilebroken.common.pojo.request.ProductSeriesInfoAddRequest;
import com.nflg.mobilebroken.repository.entity.ProductSeriesInfo;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -21,4 +22,6 @@ public interface IProductSeriesInfoService extends IService<ProductSeriesInfo> {
void update(List<ProductSeriesInfoAddRequest> items);
List<ProductSeriesInfoAddRequest> getInfo(Integer seriesId);
void delete(@NotEmpty List<Integer> ids);
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.mobilebroken.common.pojo.request.ProductFileAddRequest;
import com.nflg.mobilebroken.repository.entity.ProductTypeFile;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -21,4 +22,6 @@ public interface IProductTypeFileService extends IService<ProductTypeFile> {
void update(Integer typeId, List<ProductFileAddRequest> files);
List<ProductFileAddRequest> getInfo(Integer typeId);
void delete(@NotEmpty List<Integer> ids);
}

View File

@ -5,6 +5,7 @@ import com.nflg.mobilebroken.common.pojo.request.ProductTypeInfoAddRequest;
import com.nflg.mobilebroken.repository.entity.ProductTypeInfo;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
@ -23,4 +24,6 @@ public interface IProductTypeInfoService extends IService<ProductTypeInfo> {
void update(List<ProductTypeInfoAddRequest> items);
List<ProductTypeInfoAddRequest> getInfo(Integer typeId);
void delete(@NotEmpty List<Integer> ids);
}

View File

@ -41,4 +41,6 @@ public interface IProductTypeService extends IService<ProductType> {
Set<String> getSimpleList(@Valid @NotBlank String seriesName);
ProductTypeInfoVO getInfo(@Valid @NotNull Integer typeId);
void deleteByParent(String name);
}

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.mobilebroken.common.pojo.request.ProductCaseInfoAddRequest;
import com.nflg.mobilebroken.common.util.AdminUserUtil;
@ -68,4 +69,9 @@ public class ProductCaseInfoServiceImpl extends ServiceImpl<ProductCaseInfoMappe
public List<ProductCaseInfoAddRequest> getInfo(Integer caseId) {
return baseMapper.getInfo(caseId);
}
@Override
public void delete(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductCaseInfo>().in(ProductCaseInfo::getCaseId, ids));
}
}

View File

@ -117,6 +117,7 @@ public class ProductCaseServiceImpl extends ServiceImpl<ProductCaseMapper, Produ
}
}
@Transactional
@Override
public void delete(BatchDeleteRequest request) {
VUtils.trueThrowBusinessError(lambdaQuery()
@ -125,6 +126,7 @@ public class ProductCaseServiceImpl extends ServiceImpl<ProductCaseMapper, Produ
.exists())
.throwMessage("禁止删除已发布的数据");
removeByIds(request.getIds());
productCaseInfoService.delete(request.getIds());
}
@Override

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.mobilebroken.common.pojo.request.ProductHonorInfoAddRequest;
import com.nflg.mobilebroken.common.util.AdminUserUtil;
@ -66,4 +67,9 @@ public class ProductHonorInfoServiceImpl extends ServiceImpl<ProductHonorInfoMap
public List<ProductHonorInfoAddRequest> getInfo(Integer honorId) {
return baseMapper.getInfo(honorId);
}
@Override
public void delete(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductHonorInfo>().in(ProductHonorInfo::getHonorId, ids));
}
}

View File

@ -118,6 +118,7 @@ public class ProductHonorServiceImpl extends ServiceImpl<ProductHonorMapper, Pro
updateById(info);
}
@Transactional
@Override
public void delete(BatchDeleteRequest request) {
VUtils.trueThrowBusinessError(lambdaQuery()
@ -126,6 +127,7 @@ public class ProductHonorServiceImpl extends ServiceImpl<ProductHonorMapper, Pro
.exists())
.throwMessage("禁止删除已发布的数据");
removeByIds(request.getIds());
productHonorInfoService.delete(request.getIds());
}
@Override

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.mobilebroken.common.pojo.request.ProductIntroInfoAddRequest;
import com.nflg.mobilebroken.common.util.AdminUserUtil;
@ -68,4 +69,9 @@ public class ProductIntroInfoServiceImpl extends ServiceImpl<ProductIntroInfoMap
public List<ProductIntroInfoAddRequest> getInfo(Integer introId) {
return baseMapper.getInfo(introId);
}
@Override
public void delete(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductIntroInfo>().in(ProductIntroInfo::getIntroId, ids));
}
}

View File

@ -107,6 +107,7 @@ public class ProductIntroServiceImpl extends ServiceImpl<ProductIntroMapper, Pro
updateById(info);
}
@Transactional
@Override
public void delete(BatchDeleteRequest request) {
VUtils.trueThrowBusinessError(lambdaQuery()
@ -115,6 +116,7 @@ public class ProductIntroServiceImpl extends ServiceImpl<ProductIntroMapper, Pro
.exists())
.throwMessage("禁止删除已发布的数据");
removeByIds(request.getIds());
introInfoService.delete(request.getIds());
}
@Override

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.mobilebroken.common.pojo.request.ProductMobileIntroInfoAddRequest;
import com.nflg.mobilebroken.common.util.AdminUserUtil;
@ -64,4 +65,9 @@ public class ProductMobilebrokenIntroInfoServiceImpl extends ServiceImpl<Product
public List<ProductMobileIntroInfoAddRequest> getInfo(Integer introId) {
return baseMapper.getInfo(introId);
}
@Override
public void delete(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductMobilebrokenIntroInfo>().in(ProductMobilebrokenIntroInfo::getMobilebrokenIntroId, ids));
}
}

View File

@ -58,6 +58,7 @@ public class ProductMobilebrokenIntroServiceImpl extends ServiceImpl<ProductMobi
}
}
@Transactional
@Override
public void delete(BatchDeleteRequest request) {
VUtils.trueThrowBusinessError(lambdaQuery()
@ -66,6 +67,7 @@ public class ProductMobilebrokenIntroServiceImpl extends ServiceImpl<ProductMobi
.exists())
.throwMessage("禁止删除已发布的数据");
removeByIds(request.getIds());
productMobilebrokenIntroInfoService.delete(request.getIds());
}
@Override

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.util.StrUtil;
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;
@ -162,4 +163,9 @@ public class ProductModelFileServiceImpl extends ServiceImpl<ProductModelFileMap
public List<ProductFileVO> getListByLanguage(Integer modelId, String language) {
return baseMapper.getListByLanguage(modelId,language);
}
@Override
public void deleteByModel(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductModelFile>().in(ProductModelFile::getModelId, ids));
}
}

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.repository.service.impl;
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;
@ -13,6 +14,7 @@ import com.nflg.mobilebroken.repository.service.IProductModelHotimageService;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
/**
@ -117,4 +119,9 @@ public class ProductModelHotimageServiceImpl extends ServiceImpl<ProductModelHot
.eq(ProductModelHotimage::getState,PublishState.Published.getState())
.one();
}
@Override
public void deleteByModel(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductModelHotimage>().in(ProductModelHotimage::getModelId, ids));
}
}

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.util.StrUtil;
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;
@ -164,4 +165,9 @@ public class ProductModelImageServiceImpl extends ServiceImpl<ProductModelImageM
public List<ProductImageVO> getListByLanguage(Integer modelId, String language) {
return baseMapper.getListByLanguage(modelId,language);
}
@Override
public void deleteByModel(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductModelImage>().in(ProductModelImage::getModelId, ids));
}
}

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.repository.service.impl;
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;
@ -17,6 +18,7 @@ import com.nflg.mobilebroken.repository.service.IProductModelInfoService;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
/**
@ -103,4 +105,9 @@ public class ProductModelInfoServiceImpl extends ServiceImpl<ProductModelInfoMap
.eq(ProductModelInfo::getLanguageCode,language)
.one();
}
@Override
public void deleteByModel(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductModelInfo>().in(ProductModelInfo::getModeId, ids));
}
}

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.repository.service.impl;
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;
@ -128,4 +129,9 @@ public class ProductModelParamsServiceImpl extends ServiceImpl<ProductModelParam
public List<ProductModelParamVO> getAllListByLanguage(Integer modelId, String language) {
return baseMapper.getAllListByLanguage(modelId, language);
}
@Override
public void deleteByModel(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductModelParams>().in(ProductModelParams::getModelId, ids));
}
}

View File

@ -103,6 +103,7 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
return Collections.emptyList();
}
@Transactional
@Override
public void delete(BatchDeleteRequest request) {
VUtils.trueThrowBusinessError(lambdaQuery()
@ -111,6 +112,12 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
.exists())
.throwMessage("禁止删除已发布的数据");
removeByIds(request.getIds());
productPartParamsService.deleteByModel(request.getIds());
productModelInfoService.deleteByModel(request.getIds());
productModelFileService.deleteByModel(request.getIds());
productModelImageService.deleteByModel(request.getIds());
productModelVideoService.deleteByModel(request.getIds());
productModelHotimageService.deleteByModel(request.getIds());
}
@Override
@ -213,6 +220,27 @@ public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, Pro
.collect(Collectors.toList());
}
@Transactional
@Override
public void deleteByParent(String seriesName, String typeName) {
List<Integer> ids = lambdaQuery()
.eq(ProductModel::getSeriesName, seriesName)
.eq(ProductModel::getTypeName, typeName)
.list()
.stream()
.map(ProductModel::getId)
.collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(ids)){
removeByIds(ids);
productPartParamsService.deleteByModel(ids);
productModelInfoService.deleteByModel(ids);
productModelFileService.deleteByModel(ids);
productModelImageService.deleteByModel(ids);
productModelVideoService.deleteByModel(ids);
productModelHotimageService.deleteByModel(ids);
}
}
private ProductModelCompareInfoVO getModelCompareInfo(Integer modelId, String language){
ProductModel productModel = getById(modelId);
VUtils.trueThrowBusinessError(Objects.isNull(productModel)).throwMessage("无效的数据");

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.util.StrUtil;
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;
@ -162,4 +163,9 @@ public class ProductModelVideoServiceImpl extends ServiceImpl<ProductModelVideoM
public List<ProductVideoVO> getListByLanguage(Integer modelId, String language) {
return baseMapper.getListByLanguage(modelId,language);
}
@Override
public void deleteByModel(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductModelVideo>().in(ProductModelVideo::getModelId, ids));
}
}

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.mobilebroken.common.pojo.request.ProductPartInfoAddRequest;
import com.nflg.mobilebroken.repository.entity.ProductPartInfo;
@ -65,4 +66,9 @@ public class ProductPartInfoServiceImpl extends ServiceImpl<ProductPartInfoMappe
public List<ProductPartInfoAddRequest> getInfo(Integer partId) {
return baseMapper.getInfo(partId);
}
@Override
public void delete(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductPartInfo>().in(ProductPartInfo::getPartId, ids));
}
}

View File

@ -122,6 +122,7 @@ public class ProductPartServiceImpl extends ServiceImpl<ProductPartMapper, Produ
}
}
@Transactional
@Override
public void delete(BatchDeleteRequest request) {
VUtils.trueThrowBusinessError(lambdaQuery()
@ -130,6 +131,7 @@ public class ProductPartServiceImpl extends ServiceImpl<ProductPartMapper, Produ
.exists())
.throwMessage("禁止删除已发布的数据");
removeByIds(request.getIds());
productPartInfoService.delete(request.getIds());
}
@Override

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.mobilebroken.common.pojo.request.ProductSeriesInfoAddRequest;
import com.nflg.mobilebroken.common.util.AdminUserUtil;
@ -67,4 +68,9 @@ public class ProductSeriesInfoServiceImpl extends ServiceImpl<ProductSeriesInfoM
public List<ProductSeriesInfoAddRequest> getInfo(Integer seriesId) {
return baseMapper.getInfo(seriesId);
}
@Override
public void delete(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductSeriesInfo>().in(ProductSeriesInfo::getSeriesId, ids));
}
}

View File

@ -16,6 +16,8 @@ import com.nflg.mobilebroken.repository.entity.ProductSeries;
import com.nflg.mobilebroken.repository.mapper.ProductSeriesMapper;
import com.nflg.mobilebroken.repository.service.IProductSeriesInfoService;
import com.nflg.mobilebroken.repository.service.IProductSeriesService;
import com.nflg.mobilebroken.repository.service.IProductTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -34,12 +36,16 @@ import java.util.stream.Collectors;
* @author 代码生成器生成
* @since 2025
*/
@Slf4j
@Service
public class ProductSeriesServiceImpl extends ServiceImpl<ProductSeriesMapper, ProductSeries> implements IProductSeriesService {
@Resource
private IProductSeriesInfoService productSeriesInfoService;
@Resource
private IProductTypeService productTypeService;
@Transactional
@Override
public void add(ProductSeriesAddRequest request) {
@ -82,6 +88,7 @@ public class ProductSeriesServiceImpl extends ServiceImpl<ProductSeriesMapper, P
return baseMapper.get(language);
}
@Transactional
@Override
public void delete(BatchDeleteRequest request) {
VUtils.trueThrowBusinessError(lambdaQuery()
@ -89,7 +96,20 @@ public class ProductSeriesServiceImpl extends ServiceImpl<ProductSeriesMapper, P
.eq(ProductSeries::getState, PublishState.Published.getState())
.exists())
.throwMessage("禁止删除已发布的数据");
Set<String> names = lambdaQuery()
.in(ProductSeries::getId, request.getIds())
.list()
.stream()
.map(ProductSeries::getName)
.collect(Collectors.toSet());
removeByIds(request.getIds());
productSeriesInfoService.delete(request.getIds());
names.forEach(name -> {
if (!lambdaQuery().eq(ProductSeries::getName, name).exists()){
log.info("删除对应的设备类型数据");
productTypeService.deleteByParent(name);
}
});
}
@Override

View File

@ -74,4 +74,9 @@ public class ProductTypeFileServiceImpl extends ServiceImpl<ProductTypeFileMappe
public List<ProductFileAddRequest> getInfo(Integer typeId) {
return baseMapper.getInfo(typeId);
}
@Override
public void delete(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductTypeFile>().in(ProductTypeFile::getTypeId, ids));
}
}

View File

@ -1,6 +1,7 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.mobilebroken.common.pojo.request.ProductTypeInfoAddRequest;
import com.nflg.mobilebroken.common.util.AdminUserUtil;
@ -71,4 +72,9 @@ public class ProductTypeInfoServiceImpl extends ServiceImpl<ProductTypeInfoMappe
public List<ProductTypeInfoAddRequest> getInfo(Integer typeId) {
return baseMapper.getInfo(typeId);
}
@Override
public void delete(List<Integer> ids) {
remove(new LambdaQueryWrapper<ProductTypeInfo>().in(ProductTypeInfo::getTypeId, ids));
}
}

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -14,14 +15,17 @@ import com.nflg.mobilebroken.common.util.AdminUserUtil;
import com.nflg.mobilebroken.common.util.VUtils;
import com.nflg.mobilebroken.repository.entity.ProductType;
import com.nflg.mobilebroken.repository.mapper.ProductTypeMapper;
import com.nflg.mobilebroken.repository.service.IProductModelService;
import com.nflg.mobilebroken.repository.service.IProductTypeFileService;
import com.nflg.mobilebroken.repository.service.IProductTypeInfoService;
import com.nflg.mobilebroken.repository.service.IProductTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@ -35,6 +39,7 @@ import java.util.stream.Collectors;
* @author 代码生成器生成
* @since 2025
*/
@Slf4j
@Service
public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, ProductType> implements IProductTypeService {
@ -44,6 +49,9 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
@Resource
private IProductTypeFileService productTypeFileService;
@Resource
private IProductModelService productModelService;
@Transactional
@Override
public void add(ProductTypeAddRequest request) {
@ -117,6 +125,7 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
}
}
@Transactional
@Override
public void delete(BatchDeleteRequest request) {
VUtils.trueThrowBusinessError(lambdaQuery()
@ -124,7 +133,23 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
.eq(ProductType::getState, PublishState.Published.getState())
.exists())
.throwMessage("禁止删除已发布的数据");
List<ProductType> list = lambdaQuery()
.in(ProductType::getId, request.getIds())
.list();
removeByIds(request.getIds());
productTypeInfoService.delete(request.getIds());
productTypeFileService.delete(request.getIds());
if (CollectionUtil.isNotEmpty(list)) {
list.forEach(it -> {
if (!lambdaQuery()
.eq(ProductType::getSeriesName, it.getSeriesName())
.eq(ProductType::getName, it.getName())
.exists()) {
log.info("删除对应的设备机型数据");
productModelService.deleteByParent(it.getSeriesName(), it.getName());
}
});
}
}
@Override
@ -177,4 +202,29 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
.setItems(productTypeInfoService.getInfo(typeId))
.setFiles(productTypeFileService.getInfo(typeId));
}
@Transactional
@Override
public void deleteByParent(String name) {
List<ProductType> list = lambdaQuery().eq(ProductType::getSeriesName, name).list();
if (CollectionUtil.isNotEmpty(list)) {
list.forEach(p -> {
delete(p.getId());
});
}
}
private void delete(Integer typeId){
ProductType info=getById(typeId);
removeById(typeId);
productTypeInfoService.delete(Collections.singletonList(typeId));
productTypeFileService.delete(Collections.singletonList(typeId));
if(!lambdaQuery()
.eq(ProductType::getName, info.getName())
.eq(ProductType::getSeriesName, info.getSeriesName())
.exists()){
log.info("删除对应的设备机型数据");
productModelService.deleteByParent(info.getSeriesName(), info.getName());
}
}
}

View File

@ -34,7 +34,8 @@ public class CodeGenerator {
)
.strategyConfig(builder -> {
builder
.addInclude("^product_.*") //只生成指定表
// .addInclude("^product_.*") //只生成指定表
.addInclude("product")
.entityBuilder()
.enableLombok()
.enableChainModel()