| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.SubInfMapper; |
| | | import com.whyc.pojo.CircleInf; |
| | | import com.whyc.pojo.SubInf; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | subList.stream().forEach(sinf->sinf.setDeviceId(devId)); |
| | | mapper.insertBatchSomeColumn(subList); |
| | | } |
| | | //获取子件信息 |
| | | public Response getSub(SubInf sub, int pageCurr, int pageSize) { |
| | | PageHelper.startPage(pageCurr,pageSize); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | if(sub.getSubType()!=null){ |
| | | wrapper.eq("sub_type",sub.getSubType()); |
| | | } |
| | | |
| | | if(sub.getSubPropertyName()!=null){ |
| | | wrapper.eq("sub_property_name",sub.getSubPropertyName()); |
| | | } |
| | | |
| | | if(sub.getStartTime()!=null){ |
| | | wrapper.ge("sub_inuse_date",sub.getStartTime()); |
| | | } |
| | | if(sub.getEndTime()!=null){ |
| | | wrapper.le("sub_inuse_date",sub.getEndTime()); |
| | | } |
| | | List<SubInf> list=mapper.selectList(wrapper); |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"获取子件信息"); |
| | | } |
| | | //添加动环 |
| | | public void addSub(SubInf sub) { |
| | | mapper.insert(sub); |
| | | } |
| | | //更新电源 |
| | | public void updateSub(SubInf sub) { |
| | | UpdateWrapper<SubInf> wrapper = new UpdateWrapper<SubInf>().eq("sub_id",sub.getSubId()); |
| | | mapper.update(sub,wrapper); |
| | | } |
| | | //删除电源 |
| | | public void deleteSub(Integer subId) { |
| | | QueryWrapper<SubInf> wrapper = new QueryWrapper<SubInf>().eq("sub_id",subId); |
| | | mapper.delete(wrapper); |
| | | } |
| | | } |