|
@@ -0,0 +1,69 @@
|
|
|
|
|
+package com.shkpr.service.warncore.dbdao.services;
|
|
|
|
|
+
|
|
|
|
|
+import com.global.base.log.LogLevelFlag;
|
|
|
|
|
+import com.global.base.log.LogPrintMgr;
|
|
|
|
|
+import com.shkpr.service.warncore.constants.LogFlagBusiType;
|
|
|
|
|
+import com.shkpr.service.warncore.dbdao.mapper.OrdWarnEventInfoMapper;
|
|
|
|
|
+import com.shkpr.service.warncore.dbdao.services.intef.OrdWarnEventInfoDBService;
|
|
|
|
|
+import com.shkpr.service.warncore.dbdao.tables.OrdWarnEventInfoTable;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
|
|
+@Service
|
|
|
|
|
+public class OrdWarnEventInfoDBServiceImpl implements OrdWarnEventInfoDBService, OrdWarnEventInfoTable {
|
|
|
|
|
+ private String mStrClassName = "";
|
|
|
|
|
+ private String mBusinessType = "";
|
|
|
|
|
+ private String logTag = "";
|
|
|
|
|
+ public OrdWarnEventInfoDBServiceImpl() {
|
|
|
|
|
+ mStrClassName = this.getClass().getSimpleName();
|
|
|
|
|
+ mBusinessType = LogFlagBusiType.BUSI_DB_ORD_WARN_EVENT_INFO.toStrValue();
|
|
|
|
|
+ logTag = "Ord Warn Event";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @SuppressWarnings("all")
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ OrdWarnEventInfoMapper ordWarnEventInfoMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int existsLineEx(String table, Map<String, Object> andWheres, Map<String, Object> orWheres, String extend) {
|
|
|
|
|
+ int nCode = 0;
|
|
|
|
|
+ String strMsg = "Success";
|
|
|
|
|
+ try {
|
|
|
|
|
+ return (ordWarnEventInfoMapper.existLine(table, andWheres, orWheres, extend)?1:0);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ nCode = LogLevelFlag.LOG_ERROR.ordinal();
|
|
|
|
|
+ strMsg = e.getLocalizedMessage();
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }finally {
|
|
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.valueFromInt(nCode)
|
|
|
|
|
+ , mBusinessType
|
|
|
|
|
+ , mStrClassName
|
|
|
|
|
+ , String.format("Exists The %s Line from database, code:{%d} msg:{%s} ...", logTag, nCode, strMsg));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<String, Object> fastGetFiled(String table, String filed, Object id) {
|
|
|
|
|
+ int nCode = 0;
|
|
|
|
|
+ String strMsg = "Success";
|
|
|
|
|
+ try {
|
|
|
|
|
+ Map<String, Object> mapRes = ordWarnEventInfoMapper.getOne(table, filed, id);//查询不到时也会返回null
|
|
|
|
|
+ if (mapRes == null)
|
|
|
|
|
+ return new HashMap<>();
|
|
|
|
|
+ else
|
|
|
|
|
+ return mapRes;
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ nCode = LogLevelFlag.LOG_ERROR.ordinal();
|
|
|
|
|
+ strMsg = e.getLocalizedMessage();
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }finally {
|
|
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.valueFromInt(nCode)
|
|
|
|
|
+ , mBusinessType
|
|
|
|
|
+ , mStrClassName
|
|
|
|
|
+ , String.format("Fast Get %s Filed from database, id:{%s} code:{%d} msg:{%s} ...", logTag, String.valueOf(id), nCode, strMsg));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|