Newer
Older
huludao / src / main / java / com / newfiber / api / pc / service / impl / CameraGroupRelationServiceImpl.java
package com.newfiber.api.pc.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.newfiber.api.pc.dao.CameraGroupRelationMapper;
import com.newfiber.api.pc.model.entity.CameraGroupRelation;
import com.newfiber.api.pc.service.CameraGroupRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("cameraGroupRelationService")
public class CameraGroupRelationServiceImpl extends ServiceImpl<CameraGroupRelationMapper, CameraGroupRelation> implements CameraGroupRelationService {

    @Autowired
    private CameraGroupRelationMapper cameraGroupRelationMapper;

    @Override
    public PageInfo<CameraGroupRelation> listForPage(String searchStr, Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        EntityWrapper<CameraGroupRelation> wapper = new EntityWrapper<>();
        //name 模糊匹配的字段
        wapper.like("name", searchStr);
        List<CameraGroupRelation> list = cameraGroupRelationMapper.selectList(wapper);
        PageInfo<CameraGroupRelation> result = new PageInfo<>();
        if (!list.isEmpty()) {
            result = new PageInfo<CameraGroupRelation>(list);
        }
        return result;
    }

    @Override
    public int deleteByIds(List<Long> groupIds) {
        if (groupIds == null || groupIds.size() == 0) {
            return 0;
        }
        return cameraGroupRelationMapper.deleteByIds(groupIds);
    }
}