| | |
| | | package com.kidgrow.oprationcenter.service.impl; |
| | | |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.oprationcenter.vo.DataNeedExcel; |
| | | import org.springframework.cglib.beans.BeanCopier; |
| | | import org.springframework.stereotype.Service; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.commons.collections4.MapUtils; |
| | |
| | | public DataNeed findByObject(DataNeed dataNeed){ |
| | | return baseMapper.findByObject(dataNeed); |
| | | } |
| | | |
| | | @Override |
| | | public List<DataNeedExcel> findListExportByParam(Map<String, Object> params) { |
| | | List<DataNeed> dataNeeds = baseMapper.selectByMap(params); |
| | | List<DataNeedExcel> voList=new ArrayList<>(); |
| | | dataNeeds.forEach(e ->{ |
| | | DataNeedExcel vo=new DataNeedExcel(); |
| | | BeanCopier beanCopier = BeanCopier.create(DataNeed.class, DataNeedExcel.class, false); |
| | | beanCopier.copy(e,vo,null); |
| | | voList.add(vo); |
| | | }); |
| | | return voList; |
| | | } |
| | | |
| | | @Override |
| | | public ResultBody updateEnabled(Map<String, Object> map) { |
| | | Long id = MapUtils.getLong(map, "id"); |
| | | if(id==null){ |
| | | return ResultBody.failed("请选择一条数据"); |
| | | }else { |
| | | DataNeed dataNeed = baseMapper.selectById(id); |
| | | if (dataNeed != null) { |
| | | Boolean enabled = MapUtils.getBoolean(map, "enabled"); |
| | | String dataFile = MapUtils.getString(map, "dataFile"); |
| | | dataNeed.setDataFile(dataFile); |
| | | dataNeed.setEnabled(enabled); |
| | | baseMapper.updateById(dataNeed); |
| | | }else { |
| | | return ResultBody.failed("查找数据失败"); |
| | | } |
| | | return ResultBody.ok(); |
| | | } |
| | | } |
| | | } |