|
@@ -0,0 +1,89 @@
|
|
|
+package com.usky.fire.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.usky.common.core.bean.CommonPage;
|
|
|
+import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
+import com.usky.common.security.utils.SecurityUtils;
|
|
|
+import com.usky.fire.service.BaseBuildService;
|
|
|
+import com.usky.fire.domain.BaseBuild;
|
|
|
+import com.usky.fire.mapper.BaseBuildMapper;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 建筑信息 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author JCB
|
|
|
+ * @since 2022-11-22
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class BaseBuildServiceImpl extends AbstractCrudService<BaseBuildMapper, BaseBuild> implements BaseBuildService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CommonPage<Object> baseBuildList(String buildNum, String buildName, Integer pageNum, Integer pageSize) {
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
+ IPage<BaseBuild> page = new Page<>(pageNum, pageSize);
|
|
|
+ LambdaQueryWrapper<BaseBuild> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(BaseBuild::getId, BaseBuild::getBuildNum, BaseBuild::getBuildName, BaseBuild::getAddress, BaseBuild::getBuildArea,
|
|
|
+ BaseBuild::getFireRating, BaseBuild::getUseCharacter, BaseBuild::getBuildStructure, BaseBuild::getBuildHigh,
|
|
|
+ BaseBuild::getCompleteYear, BaseBuild::getSafePerson, BaseBuild::getManagePerson, BaseBuild::getFireRisk, BaseBuild::getBuildPlan)
|
|
|
+ .eq(BaseBuild::getDeleteFlag, 0)
|
|
|
+ .like(StringUtils.isNotBlank(buildNum), BaseBuild::getBuildNum, buildNum)
|
|
|
+ .like(StringUtils.isNotBlank(buildName), BaseBuild::getBuildName, buildName)
|
|
|
+ .orderByDesc(BaseBuild::getId);
|
|
|
+ page = this.page(page, queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
|
|
+ for (int i = 0; i < page.getRecords().size(); i++) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", page.getRecords().get(i).getId());
|
|
|
+ map.put("buildNum", page.getRecords().get(i).getBuildNum());
|
|
|
+ map.put("buildName", page.getRecords().get(i).getBuildName());
|
|
|
+ map.put("address", page.getRecords().get(i).getAddress());
|
|
|
+ map.put("buildArea", page.getRecords().get(i).getBuildArea());
|
|
|
+ map.put("fireRating", page.getRecords().get(i).getFireRating());
|
|
|
+ map.put("useCharacter", page.getRecords().get(i).getUseCharacter());
|
|
|
+ map.put("buildStructure", page.getRecords().get(i).getBuildStructure());
|
|
|
+ map.put("buildHigh", page.getRecords().get(i).getBuildHigh());
|
|
|
+ map.put("completeYear", page.getRecords().get(i).getCompleteYear());
|
|
|
+ map.put("safePerson", page.getRecords().get(i).getSafePerson());
|
|
|
+ map.put("managePerson", page.getRecords().get(i).getManagePerson());
|
|
|
+ map.put("fireRisk", page.getRecords().get(i).getFireRisk());
|
|
|
+ map.put("buildPlan", page.getRecords().get(i).getBuildPlan());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new CommonPage<>(list, page.getTotal(), pageSize, pageNum);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateBaseBuild(BaseBuild baseBuild) {
|
|
|
+ baseBuild.setUpdatePerson(SecurityUtils.getLoginUser().getSysPerson().getFullName());
|
|
|
+ baseBuild.setUpdateTime(LocalDateTime.now());
|
|
|
+ this.updateById(baseBuild);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void delBaseBuild(Integer id) {
|
|
|
+ BaseBuild baseBuild = new BaseBuild();
|
|
|
+ baseBuild.setId(id);
|
|
|
+ baseBuild.setUpdatePerson(SecurityUtils.getLoginUser().getSysPerson().getFullName());
|
|
|
+ baseBuild.setUpdateTime(LocalDateTime.now());
|
|
|
+ baseBuild.setDeleteFlag("1");
|
|
|
+ this.updateById(baseBuild);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|