| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.github.pagehelper.PageHelper;
|
| | | import com.moral.common.bean.Constants;
|
| | | import com.moral.common.bean.PageBean;
|
| | | import com.moral.common.util.ExampleUtil;
|
| | | import com.moral.common.util.MyBatisBaseMapUtil;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | public PageBean queryByPageBean(PageBean pageBean) {
|
| | | return MyBatisBaseMapUtil.queryPage(monitorPointMapper,pageBean,ENTITY_CLASS);
|
| | | Example example = ExampleUtil.generateExample(ENTITY_CLASS,pageBean);
|
| | | List<Example.Criteria> criteriaList = example.getOredCriteria();
|
| | | if(criteriaList!=null&&criteriaList.size()>0){
|
| | | for(Example.Criteria cri : criteriaList){
|
| | | cri.andNotEqualTo("isDelete", Constants.IS_DELETE_TRUE);
|
| | | }
|
| | | }else {
|
| | | example.or().andNotEqualTo("isDelete",Constants.IS_DELETE_TRUE);
|
| | | }
|
| | | PageHelper.startPage(pageBean.getPageIndex(),pageBean.getPageSize());
|
| | | List<MonitorPoint> monitorPointList = monitorPointMapper.selectWithAreaNameByExample(example);
|
| | | return new PageBean(monitorPointList);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public MonitorPoint selectWithRelationById(Integer id){
|
| | | Example example = new Example(ENTITY_CLASS);
|
| | | example.or().andEqualTo("id",id);
|
| | | List<MonitorPoint> monitorPointList = monitorPointMapper.selectWithAreaNameByExample(example);
|
| | | return monitorPointList!=null&&monitorPointList.size()>0?monitorPointList.get(0):null;
|
| | | }
|
| | | @Override
|
| | | public void addOrModify(MonitorPoint monitorPoint) {
|
| | | try{
|
| | |
| | |
|
| | | @Override
|
| | | public void deleteByIds(Integer... ids) {
|
| | | MonitorPoint monitorPoint = new MonitorPoint();
|
| | | monitorPoint.setIsDelete(Constants.IS_DELETE_TRUE);
|
| | | if(ids!=null&&ids.length>0){
|
| | | if(ids.length==1){
|
| | | monitorPointMapper.deleteByPrimaryKey(ids[0]);
|
| | | monitorPoint.setId(ids[0]);
|
| | | monitorPointMapper.updateByPrimaryKeySelective(monitorPoint);
|
| | | }else{
|
| | | Example example = new Example(ENTITY_CLASS);
|
| | | example.or().andIn("id", Arrays.asList(ids));
|
| | | monitorPointMapper.deleteByExample(example);
|
| | | monitorPointMapper.updateByExampleSelective(monitorPoint,example);
|
| | | }
|
| | |
|
| | | }
|