package com.sandu.ximon.admin.service; import com.sandu.common.service.impl.BaseServiceImpl; import com.sandu.ximon.admin.param.InterphoneSubParam; import com.sandu.ximon.dao.domain.InterphoneSub; import com.sandu.ximon.dao.mapper.InterphoneSubMapper; import lombok.AllArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @Service @AllArgsConstructor public class InterphoneSubService extends BaseServiceImpl { private final InterphoneSubMapper interphoneSubMapper; /** * 新增子设备 */ public boolean addSub(InterphoneSubParam interphoneSubParam) { InterphoneSub interphoneSub = new InterphoneSub(); BeanUtils.copyProperties(interphoneSubParam, interphoneSub); return save(interphoneSub); } /** * 修改子设备 */ public boolean updateSub(Integer id, InterphoneSubParam interphoneSubParam) { InterphoneSub byId = getById(id); if (byId == null) { return false; } InterphoneSub interphoneSub = new InterphoneSub(); BeanUtils.copyProperties(interphoneSubParam, interphoneSub); interphoneSub.setSubId(id); return updateById(interphoneSub); } /** * 删除子设备 */ public boolean deleteSub(Integer id) { InterphoneSub byId = getById(id); if (byId == null) { return false; } return removeById(id); } /** * 查询子设备 */ public InterphoneSub getSub(Integer id) { InterphoneSub byId = getById(id); if (byId == null) { return null; } return byId; } }