Browse Source

将传入的typeCode拼接即时时间存入

fuyuhchuan 1 year ago
parent
commit
2dddf7a489

+ 18 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionTypeServiceImpl.java

@@ -14,6 +14,10 @@ import com.usky.fire.service.PatrolInspectionTypeService;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import org.springframework.stereotype.Service;
 
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 /**
  * <p>
  * 类型表 服务实现类
@@ -25,6 +29,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class PatrolInspectionTypeServiceImpl extends AbstractCrudService<PatrolInspectionTypeMapper, PatrolInspectionType> implements PatrolInspectionTypeService {
 
+    /**
+     * 分页查询
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
     @Override
     public CommonPage<PatrolInspectionType> pageList(Integer pageNum, Integer pageSize) {
         IPage<PatrolInspectionType> page = new Page<>(pageNum,pageSize);
@@ -36,8 +46,16 @@ public class PatrolInspectionTypeServiceImpl extends AbstractCrudService<PatrolI
         page = this.page(page,queryWrapper);
         return new CommonPage<>(page.getRecords(),page.getTotal(),pageNum,pageSize);    }
 
+    /**
+     * 添加操作类型
+     * @param patrolInspectionType
+     */
     @Override
     public void add(PatrolInspectionType patrolInspectionType) {
+        DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+        Date date = new Date();
+        String timestamp = dateFormat.format(date);
+        patrolInspectionType.setTypeCode(patrolInspectionType.getTypeCode()+"-"+timestamp);
         baseMapper.insert(patrolInspectionType);
     }