| | |
| | | package com.moral.service.impl;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
| | | }
|
| | | @Override
|
| | | public List<MonitorPoint> queryWithStateByMap(Map<String, Object> params){
|
| | | params.put("isDelete",Constants.IS_DELETE_FALSE);
|
| | | List<MonitorPoint> monitorPointList = monitorPointMapper.selectByMap(params);
|
| | | for(MonitorPoint monitorPoint:monitorPointList){
|
| | | Integer state = getStateFromRedis(monitorPoint.getId());
|
| | |
| | | Criteria criteria = example.createCriteria();
|
| | |
|
| | | criteria.andEqualTo("isDelete", Constants.IS_DELETE_FALSE).andLike("name", "%" + name + "%");
|
| | | example.or().andEqualTo("isDelete", Constants.IS_DELETE_FALSE).andCondition("getPY(REPLACE (REPLACE (name,'(',''),')','')) like ", "%" + name + "%");
|
| | | example.or().andEqualTo("isDelete", Constants.IS_DELETE_FALSE)
|
| | | .andCondition("getPY(" + getReplaceStr("name") + ") like ", "%" + name + "%");
|
| | |
|
| | | List<MonitorPoint> monitorPoints = monitorPointMapper.selectByExample(example);
|
| | | return monitorPoints;
|
| | | }
|
| | |
|
| | | private String getReplaceStr(String name){
|
| | | List<String[]> list = new ArrayList<String[]>();
|
| | | list.add(new String[]{"(",""});
|
| | | list.add(new String[]{")",""});
|
| | | for (String[] string : list) {
|
| | | name = replace(name,string[0],string[1]);
|
| | | }
|
| | | return name;
|
| | | }
|
| | | |
| | | private String replace(String name,String fromStr,String toStr){
|
| | | return "REPLACE (" + name + ",'" + fromStr + "','" + toStr + "')";
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | example.orderBy("name").asc();
|
| | | return monitorPointMapper.selectByExample(example);
|
| | | }
|
| | | @Override
|
| | | public List<MonitorPoint> getMonitorPointsByRegion(Map<String, Object> parameters) {
|
| | | Example example = new Example(MonitorPoint.class);
|
| | | Criteria criteria = example.createCriteria();
|
| | | |
| | | criteria.andEqualTo("isDelete", Constants.IS_DELETE_FALSE);
|
| | | criteria.andEqualTo(parameters.get("name").toString(), parameters.get("value"));
|
| | | return monitorPointMapper.selectByExample(example);
|
| | | }
|
| | | }
|