提交一次接线图实时调试
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.po;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CsPageUser implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组态界面ID
|
||||||
|
*/
|
||||||
|
private String pageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,8 +7,10 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csharmonic.param.CsPageParm;
|
import com.njcn.csharmonic.param.CsPageParm;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||||
import com.njcn.csharmonic.pojo.vo.CsPageVO;
|
import com.njcn.csharmonic.pojo.vo.CsPageVO;
|
||||||
import com.njcn.csharmonic.service.CsPagePOService;
|
import com.njcn.csharmonic.service.CsPagePOService;
|
||||||
|
import com.njcn.csharmonic.service.CsPageUserService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
@@ -32,6 +34,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class CsPagePOController extends BaseController {
|
public class CsPagePOController extends BaseController {
|
||||||
private final CsPagePOService csPagePOService;
|
private final CsPagePOService csPagePOService;
|
||||||
|
|
||||||
|
private final CsPageUserService csPageUserService;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新增组态页面")
|
@ApiOperation("新增组态页面")
|
||||||
@@ -54,7 +58,6 @@ public class CsPagePOController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryPage")
|
@PostMapping("/queryPage")
|
||||||
@ApiOperation("组态页面分页查询")
|
@ApiOperation("组态页面分页查询")
|
||||||
@@ -65,4 +68,23 @@ public class CsPagePOController extends BaseController {
|
|||||||
IPage<CsPageVO> page = csPagePOService.queryPage(csPageParam);
|
IPage<CsPageVO> page = csPagePOService.queryPage(csPageParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/savePageIdWithUser")
|
||||||
|
@ApiOperation("保存组态界面与用户的关系")
|
||||||
|
public HttpResult<Boolean> savePageIdWithUser(CsPageUser csPageUser) {
|
||||||
|
String methodDescribe = getMethodDescribe("savePageIdWithUser");
|
||||||
|
boolean flag = csPageUserService.savePageIdWithUser(csPageUser);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getByUserId")
|
||||||
|
@ApiOperation("根据用户id获取组件信息")
|
||||||
|
public HttpResult<CsPageUser> getByUserId(String userId) {
|
||||||
|
String methodDescribe = getMethodDescribe("getByUserId");
|
||||||
|
CsPageUser csPageUser = csPageUserService.getByUserId(userId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csPageUser, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.njcn.csharmonic.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 数据集表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface CsPageUserMapper extends BaseMapper<CsPageUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.csharmonic.mapper.CsPageUserMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.njcn.csharmonic.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||||
|
|
||||||
|
public interface CsPageUserService extends IService<CsPageUser> {
|
||||||
|
boolean savePageIdWithUser(CsPageUser csPageUser);
|
||||||
|
|
||||||
|
CsPageUser getByUserId(String userId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csharmonic.mapper.CsPageUserMapper;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||||
|
import com.njcn.csharmonic.service.CsPageUserService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CsPageUserServiceImpl extends ServiceImpl<CsPageUserMapper, CsPageUser> implements CsPageUserService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean savePageIdWithUser(CsPageUser csPageUser) {
|
||||||
|
// 首先获取该用户的数据,理论上只有一个,以后可能有多个
|
||||||
|
CsPageUser csPageUser1 = this.getOne(new QueryWrapper<CsPageUser>().eq("user_id", csPageUser.getUserId()));
|
||||||
|
if(Objects.isNull(csPageUser1)){
|
||||||
|
// 如果没有就插入
|
||||||
|
return this.save(csPageUser);
|
||||||
|
}else{
|
||||||
|
return this.update(csPageUser, new QueryWrapper<CsPageUser>().eq("user_id", csPageUser.getUserId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CsPageUser getByUserId(String userId) {
|
||||||
|
// 根据用户id获取组件信息
|
||||||
|
CsPageUser csPageUser = this.getOne(new QueryWrapper<CsPageUser>().eq("user_id", userId));
|
||||||
|
if(Objects.isNull(csPageUser)){
|
||||||
|
throw new BusinessException("该用户不存在组件信息");
|
||||||
|
}
|
||||||
|
return csPageUser;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user