package com.gkhy.exam.system.service.impl; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.gkhy.exam.common.api.CommonPage; import com.gkhy.exam.common.api.CommonResult; import com.gkhy.exam.common.constant.UserConstant; import com.gkhy.exam.common.utils.PageUtils; import com.gkhy.exam.common.utils.SecurityUtils; import com.gkhy.exam.system.domain.InternalKnowledge; import com.gkhy.exam.system.domain.ProductService; import com.gkhy.exam.system.mapper.ProductServiceMapper; import com.gkhy.exam.system.service.ProductServiceService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.List; /** *

* 产品服务实现过程 服务实现类 *

* * @author hh * @since 2025-12-02 16:59:08 */ @Service public class ProductServiceServiceImpl extends ServiceImpl implements ProductServiceService { @Autowired private ProductServiceMapper productServiceMapper; @Override public CommonPage selectProductServiceList(ProductService productService) { PageUtils.startPage(); List productServices = productServiceMapper.selectProductServiceList(productService); return CommonPage.restPage(productServices); } @Override public CommonResult saveProductService(ProductService productService) { String[] split = productService.getFileUrl().split(","); if (split.length > 3){ return CommonResult.failed("最多上传3张图片"); } if (productService.getId() == null){ productService.setCreateTime(LocalDateTime.now()); productService.setCreateBy(SecurityUtils.getUsername()); productServiceMapper.insert(productService); }else { productService.setUpdateTime(LocalDateTime.now()); productService.setUpdateBy(SecurityUtils.getUsername()); productServiceMapper.updateById(productService); } return CommonResult.success(); } @Override public CommonResult delProductService(Long id) { productServiceMapper.update(new ProductService(), new LambdaUpdateWrapper().eq(ProductService::getId, id) .set(ProductService::getDelFlag, UserConstant.DISENABLE) .set(ProductService::getUpdateTime, LocalDateTime.now()) .set(ProductService::getUpdateBy, SecurityUtils.getUsername())); return CommonResult.success(); } }