|
|
@@ -0,0 +1,142 @@
|
|
|
+package org.dromara.system.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.dromara.common.core.utils.MapstructUtils;
|
|
|
+import org.dromara.common.core.utils.StringUtils;
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.dromara.system.domain.bo.SysDecorationSectionBo;
|
|
|
+import org.dromara.system.domain.vo.SysDecorationSectionVo;
|
|
|
+import org.dromara.system.domain.SysDecorationSection;
|
|
|
+import org.dromara.system.mapper.SysDecorationSectionMapper;
|
|
|
+import org.dromara.system.service.ISysDecorationSectionService;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 装修模块标题配置Service业务层处理
|
|
|
+ *
|
|
|
+ * @author LionLi
|
|
|
+ * @date 2025-12-17
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RequiredArgsConstructor
|
|
|
+@Service
|
|
|
+public class SysDecorationSectionServiceImpl extends ServiceImpl<SysDecorationSectionMapper, SysDecorationSection> implements ISysDecorationSectionService {
|
|
|
+
|
|
|
+ private final SysDecorationSectionMapper baseMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询装修模块标题配置
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ * @return 装修模块标题配置
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public SysDecorationSectionVo queryById(Long id){
|
|
|
+ return baseMapper.selectVoById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询装修模块标题配置列表
|
|
|
+ *
|
|
|
+ * @param bo 查询条件
|
|
|
+ * @param pageQuery 分页参数
|
|
|
+ * @return 装修模块标题配置分页列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<SysDecorationSectionVo> queryPageList(SysDecorationSectionBo bo, PageQuery pageQuery) {
|
|
|
+ LambdaQueryWrapper<SysDecorationSection> lqw = buildQueryWrapper(bo);
|
|
|
+ Page<SysDecorationSectionVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ return TableDataInfo.build(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询符合条件的装修模块标题配置列表
|
|
|
+ *
|
|
|
+ * @param bo 查询条件
|
|
|
+ * @return 装修模块标题配置列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<SysDecorationSectionVo> queryList(SysDecorationSectionBo bo) {
|
|
|
+ LambdaQueryWrapper<SysDecorationSection> lqw = buildQueryWrapper(bo);
|
|
|
+ return baseMapper.selectVoList(lqw);
|
|
|
+ }
|
|
|
+
|
|
|
+ private LambdaQueryWrapper<SysDecorationSection> buildQueryWrapper(SysDecorationSectionBo bo) {
|
|
|
+ Map<String, Object> params = bo.getParams();
|
|
|
+ LambdaQueryWrapper<SysDecorationSection> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.orderByAsc(SysDecorationSection::getId);
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getPlatformCode()), SysDecorationSection::getPlatformCode, bo.getPlatformCode());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getSectionType()), SysDecorationSection::getSectionType, bo.getSectionType());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getTitle()), SysDecorationSection::getTitle, bo.getTitle());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getSubtitle()), SysDecorationSection::getSubtitle, bo.getSubtitle());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getLinkText()), SysDecorationSection::getLinkText, bo.getLinkText());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getLinkUrl()), SysDecorationSection::getLinkUrl, bo.getLinkUrl());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getBgColor()), SysDecorationSection::getBgColor, bo.getBgColor());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getTextColor()), SysDecorationSection::getTextColor, bo.getTextColor());
|
|
|
+ lqw.eq(bo.getSort() != null, SysDecorationSection::getSort, bo.getSort());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDecorationSection::getStatus, bo.getStatus());
|
|
|
+ return lqw;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增装修模块标题配置
|
|
|
+ *
|
|
|
+ * @param bo 装修模块标题配置
|
|
|
+ * @return 是否新增成功
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean insertByBo(SysDecorationSectionBo bo) {
|
|
|
+ SysDecorationSection add = MapstructUtils.convert(bo, SysDecorationSection.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ boolean flag = baseMapper.insert(add) > 0;
|
|
|
+ if (flag) {
|
|
|
+ bo.setId(add.getId());
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改装修模块标题配置
|
|
|
+ *
|
|
|
+ * @param bo 装修模块标题配置
|
|
|
+ * @return 是否修改成功
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean updateByBo(SysDecorationSectionBo bo) {
|
|
|
+ SysDecorationSection update = MapstructUtils.convert(bo, SysDecorationSection.class);
|
|
|
+ validEntityBeforeSave(update);
|
|
|
+ return baseMapper.updateById(update) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存前的数据校验
|
|
|
+ */
|
|
|
+ private void validEntityBeforeSave(SysDecorationSection entity){
|
|
|
+ //TODO 做一些数据校验,如唯一约束
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验并批量删除装修模块标题配置信息
|
|
|
+ *
|
|
|
+ * @param ids 待删除的主键集合
|
|
|
+ * @param isValid 是否进行有效性校验
|
|
|
+ * @return 是否删除成功
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
+ if(isValid){
|
|
|
+ //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
+ }
|
|
|
+ return baseMapper.deleteByIds(ids) > 0;
|
|
|
+ }
|
|
|
+}
|