| | |
| | | package com.moral.service.impl;
|
| | |
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.moral.common.bean.PageBean;
|
| | | import com.moral.common.util.MyBatisBaseMapUtil;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.entity.MonitorPoint;
|
| | | import com.moral.mapper.MonitorPointMapper;
|
| | | import com.moral.service.MonitorPointService;
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | @Service
|
| | | public class MonitorPointServiceImpl implements MonitorPointService {
|
| | | @Resource
|
| | | private MonitorPointMapper monitorPointMapper;
|
| | |
|
| | | private static Class ENTITY_CLASS = MonitorPoint.class;
|
| | | @Override
|
| | | public List<MonitorPoint> getMonitorPointsByAreaName(Map<String, Object> parameters) {
|
| | | ValidateUtil.notNull(parameters.get("areaName"), "param.is.null");
|
| | | return monitorPointMapper.getMonitorPointsByAreaName(parameters);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public PageBean queryByPageBean(PageBean pageBean) {
|
| | | return MyBatisBaseMapUtil.queryPage(monitorPointMapper,pageBean,ENTITY_CLASS);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addOrModify(MonitorPoint monitorPoint) {
|
| | | try{
|
| | | if(monitorPoint.getId()==null){
|
| | | monitorPointMapper.insertSelective(monitorPoint);
|
| | | }else{
|
| | | monitorPointMapper.updateByPrimaryKeySelective(monitorPoint);
|
| | | }
|
| | | }
|
| | | catch (Exception ex){
|
| | | throw ex;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteByIds(Integer... ids) {
|
| | | if(ids!=null&&ids.length>0){
|
| | | if(ids.length==1){
|
| | | monitorPointMapper.deleteByPrimaryKey(ids[0]);
|
| | | }else{
|
| | | Example example = new Example(ENTITY_CLASS);
|
| | | example.or().andIn("id", Arrays.asList(ids));
|
| | | monitorPointMapper.deleteByExample(example);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | }
|