public KpiSyncMapping save(KpiSyncMapping kpiMapping) throws Exception {
   try {
     Connection conn = MongoConnect.getConnection();
     PreparedStatement pstmt =
         conn.prepareStatement(
             "insert into KpiSyncMapping(name,cateId,dataSourceId,fieldMap,owner) values(?,?,?,?,?)");
     pstmt.setString(1, kpiMapping.getName() == null ? "" : kpiMapping.getName());
     pstmt.setString(2, kpiMapping.getCateId() == null ? "" : kpiMapping.getCateId());
     pstmt.setString(3, kpiMapping.getDataSourceId() == null ? "" : kpiMapping.getDataSourceId());
     pstmt.setString(
         4,
         kpiMapping.getFieldMap() == null
             ? "{}"
             : JSONObject.fromObject(kpiMapping.getFieldMap()).toString());
     pstmt.setString(5, kpiMapping.getOwner());
     pstmt.executeUpdate();
   } catch (Exception e) {
     throw e;
   }
   return getByName(kpiMapping.getName());
 }
 public KpiSyncMapping update(KpiSyncMapping kpiMapping) throws Exception {
   try {
     Connection conn = MongoConnect.getConnection();
     PreparedStatement pstmt =
         conn.prepareStatement(
             "update KpiSyncMapping set name=?,cateId=?,dataSourceId=?,fieldMap=? where _id=?");
     pstmt.setString(1, kpiMapping.getName() == null ? "" : kpiMapping.getName());
     pstmt.setString(2, kpiMapping.getCateId() == null ? "" : kpiMapping.getCateId());
     pstmt.setString(3, kpiMapping.getDataSourceId() == null ? "" : kpiMapping.getDataSourceId());
     pstmt.setString(
         4,
         kpiMapping.getFieldMap() == null
             ? "{}"
             : JSONObject.fromObject(kpiMapping.getFieldMap()).toString());
     pstmt.setString(5, kpiMapping.getId());
     pstmt.executeUpdate();
   } catch (Exception e) {
     throw e;
   }
   return kpiMapping;
 }