package com.openhis.web.check.appservice.impl;

import cn.hutool.core.util.ObjectUtil;
import com.core.common.core.domain.R;
import com.openhis.check.domain.LisGroupInfo;
import com.openhis.check.service.ILisGroupInfoService;
import com.openhis.web.check.appservice.ILisGroupInfoAppService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class LisGroupInfoAppServiceImpl implements ILisGroupInfoAppService {
    @Resource
    private ILisGroupInfoService lisGroupInfoService;
    @Override
    public R<?> getLisGroupInfoList() {
        List<LisGroupInfo> list = lisGroupInfoService.list();
        return R.ok(list);
    }

    @Override
    public R<?> add(LisGroupInfo lisGroupInfo) {
        if (ObjectUtil.isEmpty(lisGroupInfo)) {
            return R.fail("信息不能为空");
        }
        boolean save = lisGroupInfoService.save(lisGroupInfo);
        return R.ok(save);
    }

    @Override
    public R<?> update(LisGroupInfo lisGroupInfo) {
        if (ObjectUtil.isEmpty(lisGroupInfo)) {
            return R.fail("信息不能为空");
        }
        boolean update = lisGroupInfoService.updateById(lisGroupInfo);
        return R.ok( update);
    }

    @Override
    public R<?> delete(Integer lisGroupInfoId) {
        boolean b = lisGroupInfoService.removeById(lisGroupInfoId);
        return R.ok(b);
    }
}
