|
@@ -0,0 +1,75 @@
|
|
|
+package com.bizmatics.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.bizmatics.common.core.bean.CommonPage;
|
|
|
+import com.bizmatics.model.Device;
|
|
|
+import com.bizmatics.model.PatrolCheckEntry;
|
|
|
+import com.bizmatics.model.system.SysUser;
|
|
|
+import com.bizmatics.persistence.mapper.PatrolCheckEntryMapper;
|
|
|
+import com.bizmatics.service.PatrolCheckEntryService;
|
|
|
+import com.bizmatics.common.mvc.base.AbstractCrudService;
|
|
|
+import com.bizmatics.service.util.SecurityUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author ya
|
|
|
+ * @since 2021-10-15
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class PatrolCheckEntryServiceImpl extends AbstractCrudService<PatrolCheckEntryMapper, PatrolCheckEntry> implements PatrolCheckEntryService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void patrolCheckEntryAdd(PatrolCheckEntry patrolCheckEntry){
|
|
|
+ SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
+ patrolCheckEntry.setCreator(user.getUserName());
|
|
|
+ patrolCheckEntry.setCreateTime(new Date());
|
|
|
+ patrolCheckEntry.setStatus(1);
|
|
|
+ this.save(patrolCheckEntry);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void patrolCheckEntryUpdate(PatrolCheckEntry patrolCheckEntry){
|
|
|
+ this.updateById(patrolCheckEntry);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void patrolCheckEntryDel(Integer id){
|
|
|
+ PatrolCheckEntry patrolCheckEntry = new PatrolCheckEntry();
|
|
|
+ patrolCheckEntry.setId(id);
|
|
|
+ patrolCheckEntry.setStatus(0);
|
|
|
+ this.updateById(patrolCheckEntry);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CommonPage<PatrolCheckEntry> patrolCheckEntryList(String checkEntryName,Integer deviceTypeId,Integer size,Integer current,Integer id){
|
|
|
+ IPage<PatrolCheckEntry> page = new Page<PatrolCheckEntry>(size, current);
|
|
|
+ LambdaQueryWrapper<PatrolCheckEntry> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolCheckEntry::getStatus, 1).eq(PatrolCheckEntry::getDeviceTypeId, deviceTypeId);
|
|
|
+ if (checkEntryName!=null&&!checkEntryName.equals("")&&!checkEntryName.equals(null)){
|
|
|
+ queryWrapper.like(PatrolCheckEntry::getCheckEntryName, checkEntryName);
|
|
|
+ }
|
|
|
+ if (id!=null&&id!=0){
|
|
|
+ queryWrapper.eq(PatrolCheckEntry::getId,id);
|
|
|
+ }
|
|
|
+ page = this.page(page, queryWrapper);
|
|
|
+ this.ToCommonPage(page);
|
|
|
+ return new CommonPage<>(page.getRecords(), page.getTotal(), page.getCurrent(), page.getSize());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<PatrolCheckEntry> patrolCheckEntrydDroplist(Integer deviceTypeId){
|
|
|
+ LambdaQueryWrapper<PatrolCheckEntry> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolCheckEntry::getStatus, 1).in(PatrolCheckEntry::getDeviceTypeId, deviceTypeId);
|
|
|
+ return this.list(queryWrapper);
|
|
|
+ }
|
|
|
+}
|