|
@@ -0,0 +1,65 @@
|
|
|
|
+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.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.domain.DemWaterSourceMaintain;
|
|
|
|
+import com.usky.fire.mapper.DemWaterSourceMaintainMapper;
|
|
|
|
+import com.usky.fire.service.DemWaterSourceMaintainService;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * <p>
|
|
|
|
+ * 天然水源信息表 服务实现类
|
|
|
|
+ * </p>
|
|
|
|
+ *
|
|
|
|
+ * @author JCB
|
|
|
|
+ * @since 2022-10-25
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class DemWaterSourceMaintainServiceImpl extends AbstractCrudService<DemWaterSourceMaintainMapper, DemWaterSourceMaintain> implements DemWaterSourceMaintainService {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public CommonPage<DemWaterSourceMaintain> waterSourceMaintainList(String squadron, Integer id, Integer pageNum, Integer pageSize) {
|
|
|
|
+ IPage<DemWaterSourceMaintain> page = new Page<>(pageNum, pageSize);
|
|
|
|
+ LambdaQueryWrapper<DemWaterSourceMaintain> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ queryWrapper.eq(DemWaterSourceMaintain::getDeleteFlag, "0")
|
|
|
|
+ .like(StringUtils.isNotBlank(squadron), DemWaterSourceMaintain::getSquadron, squadron)
|
|
|
|
+ .eq(id != 0 && id != null, DemWaterSourceMaintain::getId, id)
|
|
|
|
+ .orderByDesc(DemWaterSourceMaintain::getId);
|
|
|
|
+ List<DemWaterSourceMaintain> list = this.list(queryWrapper);
|
|
|
|
+ page = this.page(page, queryWrapper);
|
|
|
|
+ return new CommonPage<>(page.getRecords(), page.getTotal(), pageSize, pageNum);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void addWaterSourceMaintain(DemWaterSourceMaintain demWaterSourceMaintain) {
|
|
|
|
+ demWaterSourceMaintain.setCreator(SecurityUtils.getUsername());
|
|
|
|
+ demWaterSourceMaintain.setCreateTime(LocalDateTime.now());
|
|
|
|
+ demWaterSourceMaintain.setDeleteFlag("0");
|
|
|
|
+ this.save(demWaterSourceMaintain);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void updateWaterSourceMaintain(DemWaterSourceMaintain demWaterSourceMaintain) {
|
|
|
|
+ demWaterSourceMaintain.setUpdateTime(LocalDateTime.now());
|
|
|
|
+ demWaterSourceMaintain.setUpdatePerson(SecurityUtils.getUsername());
|
|
|
|
+ this.updateById(demWaterSourceMaintain);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void delWaterSourceMaintain(Integer id) {
|
|
|
|
+ DemWaterSourceMaintain demWaterSourceMaintain = new DemWaterSourceMaintain();
|
|
|
|
+ demWaterSourceMaintain.setId(id);
|
|
|
|
+ demWaterSourceMaintain.setDeleteFlag("1");
|
|
|
|
+ this.updateById(demWaterSourceMaintain);
|
|
|
|
+ }
|
|
|
|
+}
|