2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-04-18 66080a0b82181aaa567e8080ee2b82315b840930
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java
@@ -12,10 +12,11 @@
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@AllArgsConstructor
public class LEDProgramService extends BaseServiceImpl<LEDProgramMapper, LEDProgram> {
    public boolean addProgram(LEDProgramParam receiveParam) {
@@ -34,7 +35,7 @@
    }
    public boolean updateProgram(Long pid,LEDProgramParam receiveParam) {
    public boolean updateProgram(Long pid, LEDProgramParam receiveParam) {
        LEDProgram byId = getById(pid);
        if (byId == null) {
@@ -63,13 +64,30 @@
    }
    public LambdaQueryWrapper<LEDProgram> listProgram() {
        if (SecurityUtils.getClientId() != null) {
            return Wrappers.lambdaQuery(LEDProgram.class).eq(LEDProgram::getUserId, SecurityUtils.getClientId());
        } else {
            return Wrappers.lambdaQuery(LEDProgram.class);
    public LEDProgramParam getByPid(Long id) {
        LEDProgram byId = getById(id);
        if (byId == null) {
            throw new BusinessException("未找到该节目");
        }
        LEDProgramParam param = new LEDProgramParam();
        param.setId(byId.getId());
        param.setHeight(byId.getHeight());
        param.setWidth(byId.getWidth());
        param.setName(byId.getName());
        param.setPreviewUrl(byId.getPreview());
        param.setPages(JSON.parseObject(byId.getPages(), List.class));
        return param;
    }
    public LambdaQueryWrapper<LEDProgram> listProgram() {
        if (SecurityUtils.getClientId() == null) {
            return Wrappers.lambdaQuery(LEDProgram.class);
        } else {
            return Wrappers.lambdaQuery(LEDProgram.class).eq(LEDProgram::getUserId, SecurityUtils.getUserId())
                    .or(w -> {
                        w.eq(LEDProgram::getClientId, SecurityUtils.getClientId());
                    });
        }
    }
}