123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package com.its.vds.dao.mapper.batch;
- import com.its.app.utils.Elapsed;
- import com.its.vds.dao.mapper.BatchDaoService;
- import com.its.vds.entity.voVdsDtctClct;
- import lombok.extern.slf4j.Slf4j;
- import org.apache.ibatis.session.SqlSessionFactory;
- import org.springframework.stereotype.Repository;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- @Slf4j
- @Repository
- public class VdsDtctDao extends BatchDaoService {
- public VdsDtctDao(SqlSessionFactory sqlSessionFactory) {
- super(sqlSessionFactory);
- this.serviceName = "VdsDtctDao";
- this.mapperName = "";//com.its.vds.dao.mapper.VdsDtctMapper.";
- }
- public List<HashMap<String, Object>> getClctList(List<voVdsDtctClct> req) {
- List<HashMap<String, Object>> lists = new ArrayList<>();
- req.forEach(obj -> {
- HashMap<String, Object> param = new HashMap<>();
- param.put("VDS_DTCT_NMBR", obj.getVDS_DTCT_NMBR());
- param.put("CLCT_DT", obj.getCLCT_DT());
- param.put("SYST_KIND_DVSN", obj.getSYST_KIND_DVSN());
- param.put("TRAF_CLCT_CYCL", obj.getTRAF_CLCT_CYCL());
- param.put("TFVL", obj.getTFVL());
- param.put("SPED", obj.getSPED());
- param.put("AVRG_OCPY_RATE", obj.getAVRG_OCPY_RATE());
- param.put("AVRG_LNGT", obj.getAVRG_LNGT());
- param.put("HDWY", obj.getHDWY());
- param.put("SPCE_OCPY_RATE", obj.getSPCE_OCPY_RATE());
- param.put("SPCE_AVRG_SPED", obj.getSPCE_AVRG_SPED());
- lists.add(param);
- });
- return lists;
- }
- public int updateClct(List<voVdsDtctClct> req, boolean isHistory) {
- log.info("{}.updateStts: START. {} EA. History {}", this.serviceName, req.size(), isHistory);
- Elapsed elapsed = new Elapsed();
- this.mapper = this.mapperName + "batchUpdateVdsDtctClctPnst";
- int total = updateBatch(this.mapper, getClctList(req));
- log.info("{}.updateStts: ..END. {} EA. {} ms.", this.serviceName, total, elapsed.milliSeconds());
- return total;
- }
- public int insertClct(List<voVdsDtctClct> req) {
- log.info("{}.insertStts: START. {} EA.", this.serviceName, req.size());
- Elapsed elapsed = new Elapsed();
- this.mapper = this.mapperName + "batchInsertVdsDtctClct";
- int total = insertBatch(this.mapper, getClctList(req));
- log.info("{}.insertStts: ..END. {} EA. {} ms.", this.serviceName, total, elapsed.milliSeconds());
- return total;
- }
- }
|