|
@@ -1,18 +1,21 @@
|
|
|
package com.zhaoliangsz.grainsearch.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.zhaoliangsz.grainsearch.domain.entity.TestTable;
|
|
|
import com.zhaoliangsz.grainsearch.mapper.TestTableMapper;
|
|
|
import com.zhaoliangsz.grainsearch.service.ITestTableService;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.zhaoliangsz.grainsearch.basic.exception.ServiceException;
|
|
|
import com.zhaoliangsz.grainsearch.basic.result.PageResult;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+
|
|
|
+import java.sql.Wrapper;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.zhaoliangsz.grainsearch.basic.exception.ExceptionDefinition;
|
|
|
/**
|
|
@@ -20,12 +23,14 @@ import com.zhaoliangsz.grainsearch.basic.exception.ExceptionDefinition;
|
|
|
* 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
- * @author chengchangjiang
|
|
|
+ * @author zyw
|
|
|
* @since 2023-08-21 14:40:08
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class TestTableServiceImpl extends ServiceImpl<TestTableMapper, TestTable> implements ITestTableService {
|
|
|
+ @Autowired
|
|
|
+ private TestTableMapper testTableMapper;
|
|
|
@Override
|
|
|
public PageResult<TestTable> queryTestTableList(TestTable queryTestTable) throws ServiceException{
|
|
|
try{
|
|
@@ -47,7 +52,23 @@ public class TestTableServiceImpl extends ServiceImpl<TestTableMapper, TestTable
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String addTestTable(TestTable addTestTable) throws ServiceException {
|
|
|
- boolean flag = this.save(addTestTable);
|
|
|
+ TestTable testTable=testTableMapper.selectOne(new QueryWrapper<TestTable>()
|
|
|
+ .eq("type",addTestTable.getType())
|
|
|
+ .eq("banci",addTestTable.getBanci())
|
|
|
+ .eq("banzu",addTestTable.getBanzu())
|
|
|
+ .eq("date",addTestTable.getDate()));
|
|
|
+ boolean flag;
|
|
|
+ if (testTable!=null){
|
|
|
+ addTestTable.setUpdateTime(new Date());
|
|
|
+ addTestTable.setId(testTable.getId());
|
|
|
+ flag= this.updateById(addTestTable);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ addTestTable.setCreateTime(new Date());
|
|
|
+ addTestTable.setUpdateTime(new Date());
|
|
|
+ flag= this.save(addTestTable);
|
|
|
+ }
|
|
|
+
|
|
|
if(flag){
|
|
|
return "ok";
|
|
|
}
|
|
@@ -79,4 +100,15 @@ public class TestTableServiceImpl extends ServiceImpl<TestTableMapper, TestTable
|
|
|
throw new ServiceException(ExceptionDefinition.DELETE_DATA_EXCEPTION);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 每天23.55点更新(新)
|
|
|
+ */
|
|
|
+// @Transactional(rollbackFor = Exception.class)
|
|
|
+// @Scheduled(cron = "0 55 23 * * ?")
|
|
|
+// public String addInfo() {
|
|
|
+// if ("3".equals(ENV)) {
|
|
|
+// }
|
|
|
+// return "OK";
|
|
|
+// }
|
|
|
}
|