haungxing
3 months ago
8 changed files with 184 additions and 0 deletions
@ -0,0 +1,57 @@
|
||||
package com.hnac.hzims.bigmodel.maintenance.entity; |
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField; |
||||
import com.baomidou.mybatisplus.annotation.SqlCondition; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.mp.support.QueryField; |
||||
import org.springblade.core.tenant.mp.TenantEntity; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @Author: huangxing |
||||
* @Date: 2024/08/19 18:33 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode |
||||
@ApiModel("设备控制实体类") |
||||
public class ControlEntity extends TenantEntity implements Serializable { |
||||
|
||||
@ApiModelProperty(value = "itemId",required = true) |
||||
private String itemId; |
||||
|
||||
@ApiModelProperty(value = "站点名称",required = true) |
||||
@QueryField(condition = SqlCondition.LIKE) |
||||
private String stationName; |
||||
|
||||
@ApiModelProperty(value = "站点ID") |
||||
@QueryField(condition = SqlCondition.EQUAL) |
||||
private String stationId; |
||||
|
||||
@ApiModelProperty(value = "遥控的设备名称") |
||||
@QueryField(condition = SqlCondition.LIKE) |
||||
private String deviceName; |
||||
|
||||
@ApiModelProperty(value = "遥控的设备ID") |
||||
@QueryField(condition = SqlCondition.EQUAL) |
||||
private String deviceId; |
||||
|
||||
@TableField("yk_name") |
||||
@JSONField(name = "yk_name") |
||||
@ApiModelProperty(value = "遥控名称(不包含站点)",required = true) |
||||
@QueryField(condition = SqlCondition.LIKE) |
||||
private String remoteName; |
||||
|
||||
@ApiModelProperty(value = "用于展示和匹配的全称,一般可设为 站点名称-遥控名称",required = true) |
||||
@QueryField(condition = SqlCondition.LIKE) |
||||
private String itemName; |
||||
|
||||
@ApiModelProperty(value = "类型,可为平台、业务",required = true) |
||||
@QueryField(condition = SqlCondition.LIKE) |
||||
private String type; |
||||
|
||||
} |
@ -0,0 +1,74 @@
|
||||
package com.hnac.hzims.bigmodel.maintenance.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService; |
||||
import com.hnac.hzims.bigmodel.maintenance.entity.ControlEntity; |
||||
import com.hnac.hzims.bigmodel.maintenance.entity.DatasourceEntity; |
||||
import com.hnac.hzims.bigmodel.maintenance.service.ControlService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
/** |
||||
* @Author: huangxing |
||||
* @Date: 2024/08/19 18:50 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/control") |
||||
@Api(tags = "设备控制指令管理",value = "设备控制指令管理") |
||||
@AllArgsConstructor |
||||
public class ControlController { |
||||
|
||||
private final ControlService service; |
||||
private final IHznlmInvokeService invokeService; |
||||
|
||||
@GetMapping("/listPage") |
||||
@ApiOperation(value = "分页查询") |
||||
@ApiOperationSupport(order = 1) |
||||
public R<IPage<ControlEntity>> listPage(Query query, ControlEntity req) { |
||||
return R.data(service.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); |
||||
} |
||||
|
||||
@GetMapping("/detail") |
||||
@ApiOperation(value = "查看详情") |
||||
@ApiOperationSupport(order = 2) |
||||
public R<ControlEntity> detail(@RequestParam @ApiParam("主键ID") Long id) { |
||||
return R.data(service.getById(id)); |
||||
} |
||||
|
||||
@PostMapping("/save") |
||||
@ApiOperation(value = "保存设备控制指令配置") |
||||
@ApiOperationSupport(order = 3) |
||||
public R save(@RequestBody ControlEntity req) { |
||||
return R.status(service.save(req)); |
||||
} |
||||
|
||||
@DeleteMapping("/remove") |
||||
@ApiOperation(value = "删除设备控制指令配置") |
||||
@ApiOperationSupport(order = 4) |
||||
public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) { |
||||
return R.status(service.removeByIds(Func.toLongList(",",ids))); |
||||
} |
||||
|
||||
@PutMapping("/updateById") |
||||
@ApiOperation(value = "编辑设备控制指令") |
||||
@ApiOperationSupport(order = 5) |
||||
public R updateById(@RequestBody ControlEntity req) { |
||||
return R.status(service.updateById(req)); |
||||
} |
||||
|
||||
@PutMapping("/updateKnowledge") |
||||
@ApiOperation(value = "更新设备控制知识库") |
||||
@ApiOperationSupport(order = 6) |
||||
public R updateKnowledge() { |
||||
invokeService.updateKnowledge("yk"); |
||||
return R.success("操作成功!"); |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.hnac.hzims.bigmodel.maintenance.mapper; |
||||
|
||||
import com.hnac.hzims.bigmodel.maintenance.entity.ControlEntity; |
||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||
|
||||
/** |
||||
* @Author: huangxing |
||||
* @Date: 2024/08/19 18:42 |
||||
*/ |
||||
public interface ControlMapper extends UserDataScopeBaseMapper<ControlEntity> { |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.hnac.hzims.bigmodel.maintenance.service; |
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.hnac.hzims.bigmodel.maintenance.entity.ControlEntity; |
||||
import com.hnac.hzims.bigmodel.maintenance.mapper.ControlMapper; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @Author: huangxing |
||||
* @Date: 2024/08/19 18:48 |
||||
*/ |
||||
@Service |
||||
@DS("hznlm") |
||||
@AllArgsConstructor |
||||
@Slf4j |
||||
public class ControlService extends ServiceImpl<ControlMapper, ControlEntity> { |
||||
|
||||
} |
Loading…
Reference in new issue