2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-05-10 3a8ecfd6062adb7f75777656fa7cb1a5a411535f
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostService.java
@@ -2,6 +2,8 @@
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.param.InterphoneHostParam;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.dao.bo.InterphoneHostBo;
import com.sandu.ximon.dao.domain.InterphoneHost;
import com.sandu.ximon.dao.mapper.InterphoneHostMapper;
import lombok.AllArgsConstructor;
@@ -12,27 +14,26 @@
@Service
@AllArgsConstructor
public class InterphoneHostService extends BaseServiceImpl <InterphoneHostMapper, InterphoneHost>{
public class InterphoneHostService extends BaseServiceImpl<InterphoneHostMapper, InterphoneHost> {
    private final InterphoneHostMapper interphoneHostMapper;
    /**
     * 添加主机
     *
     */
    public boolean addHost(InterphoneHostParam interphoneHostParam) {
        InterphoneHost interphoneHost = new InterphoneHost();
        BeanUtils.copyProperties(interphoneHostParam, interphoneHost);
       return save(interphoneHost);
        return save(interphoneHost);
    }
    /**
     * 修改主机
     */
    public boolean updateHost(Integer id,InterphoneHostParam interphoneHostParam) {
    public boolean updateHost(Integer id, InterphoneHostParam interphoneHostParam) {
        InterphoneHost byId = getById(id);
        if(byId == null){
        if (byId == null) {
            return false;
        }
        InterphoneHost interphoneHost = new InterphoneHost();
@@ -43,13 +44,13 @@
    /**
     * 删除主机
     *
     * @param id
     * @return
     *
      */
     */
    public boolean deleteHost(Integer id) {
        InterphoneHost byId = getById(id);
        if(byId == null){
        if (byId == null) {
            return false;
        }
        return removeById(id);
@@ -57,12 +58,13 @@
    /**
     * 查询主机
     *
     * @param id
     * @return
     */
    public InterphoneHost getHost(Integer id) {
        InterphoneHost byId = getById(id);
        if(byId == null){
        if (byId == null) {
            return null;
        }
        return byId;
@@ -71,9 +73,14 @@
    /**
     * 查询主机列表
     */
    public List<InterphoneHost> getHostList() {
        List<InterphoneHost> list = list();//TODO
        return list();
    public List<InterphoneHostBo> getInterphoneHostList(String keyword) {
        List<InterphoneHostBo> list;
        if (SecurityUtils.getClientId() == null) {
            list = interphoneHostMapper.getInterphoneHostList(keyword, null);
        } else {
            list = interphoneHostMapper.getInterphoneHostList(keyword, SecurityUtils.getUserId());
        }
        return list;
    }