|
@@ -0,0 +1,77 @@
|
|
|
|
+package cn.cslg.permission.service.associate;
|
|
|
|
+
|
|
|
|
+import cn.cslg.permission.common.model.Records;
|
|
|
|
+import cn.cslg.permission.common.model.dto.*;
|
|
|
|
+import cn.cslg.permission.common.model.vo.AppVipTypeVO;
|
|
|
|
+import cn.cslg.permission.domain.TenantVipType;
|
|
|
|
+import cn.cslg.permission.domain.associate.AssoFunctionModule;
|
|
|
|
+import cn.cslg.permission.domain.qiaobi.AppVipType;
|
|
|
|
+import cn.cslg.permission.mapper.associate.AssoFunctionModuleMapper;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @Author xiexiang
|
|
|
|
+ * @Date 2024/11/28
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
+public class AssoFunctionModuleService extends ServiceImpl<AssoFunctionModuleMapper, AssoFunctionModule> {
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增
|
|
|
|
+ */
|
|
|
|
+ public Records add(AssoFunctionModuleDTO assoFunctionModuleDTO) {
|
|
|
|
+ Records records = new Records();
|
|
|
|
+ List<Integer> ids = new ArrayList<>();
|
|
|
|
+ List<AssoFunctionModule> assoFunctionModules = new ArrayList<>();
|
|
|
|
+ List<AssoFunctionCodeDTO> codeDTOS = assoFunctionModuleDTO.getAssoFunctionCodeDTOS();
|
|
|
|
+ for (AssoFunctionCodeDTO codeDTO : codeDTOS) {
|
|
|
|
+ AssoFunctionModule assoFunctionModule = new AssoFunctionModule();
|
|
|
|
+ BeanUtils.copyProperties(assoFunctionModuleDTO, assoFunctionModule);
|
|
|
|
+ assoFunctionModule.setFunctionId(codeDTO.getFunctionId());
|
|
|
|
+ assoFunctionModule.setCode(codeDTO.getCode());
|
|
|
|
+ assoFunctionModules.add(assoFunctionModule);
|
|
|
|
+ }
|
|
|
|
+ if (!assoFunctionModules.isEmpty()) {
|
|
|
|
+ this.saveBatch(assoFunctionModules);
|
|
|
|
+ ids = assoFunctionModules.stream().map(AssoFunctionModule::getId).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ records.setRecords(ids);
|
|
|
|
+ return records;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更新
|
|
|
|
+ */
|
|
|
|
+ public Records update(AssoFunctionModuleUpdateDTO updateDTO) {
|
|
|
|
+ Records records = new Records();
|
|
|
|
+ AssoFunctionModule assoFunctionModule = this.getById(updateDTO.getId());
|
|
|
|
+ BeanUtils.copyProperties(updateDTO, assoFunctionModule);
|
|
|
|
+ assoFunctionModule.updateById();
|
|
|
|
+ records.setRecords(assoFunctionModule.getId());
|
|
|
|
+ return records;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Records queryAssoFunctionModules(QueryAssoFunctionModuleDTO queryDTO) {
|
|
|
|
+ Records records = new Records();
|
|
|
|
+ Long current = queryDTO.getPageNum();
|
|
|
|
+ Long size = queryDTO.getPageSize();
|
|
|
|
+ records.setCurrent(current);
|
|
|
|
+ records.setSize(size);
|
|
|
|
+ return records;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void delete(List<Integer> ids){
|
|
|
|
+ this.removeByIds(ids);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|