wangyinsheng
2 months ago
8 changed files with 260 additions and 1 deletions
@ -0,0 +1,56 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.service.DataInstructService; |
||||||
|
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.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("/dataInstruct") |
||||||
|
@Api(value = "控制指令管理",tags = "控制指令管理") |
||||||
|
@AllArgsConstructor |
||||||
|
public class DataInstructController { |
||||||
|
|
||||||
|
private DataInstructService dataInstructService; |
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperation("保存控制指令") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
public R save(@RequestBody @Valid DataInstructEntity req) { |
||||||
|
return R.data(dataInstructService.save(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/update") |
||||||
|
@ApiOperation("编辑控制指令") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
public R update(@RequestBody DataInstructEntity req) { |
||||||
|
return R.data(dataInstructService.updateById(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/listPage") |
||||||
|
@ApiOperation("控制指令列表查询") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
public R<IPage<DataInstructEntity>> listPage(Query query, DataInstructEntity req) { |
||||||
|
return R.data(dataInstructService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("/removeByIds") |
||||||
|
@ApiOperation("删除控制指令") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
public R removeByIds(@RequestParam @ApiParam("id,按逗号分隔") String ids) { |
||||||
|
return R.status(dataInstructService.removeByIds(Func.toLongList(",",ids))); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,54 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.service.DataRecordService; |
||||||
|
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.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("/dataRecord") |
||||||
|
@Api(value = "数据记录管理",tags = "数据记录管理") |
||||||
|
@AllArgsConstructor |
||||||
|
public class DataRecordController { |
||||||
|
|
||||||
|
private DataRecordService dataRecordService; |
||||||
|
|
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperation("保存数据记录信息") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
public R save(@RequestBody @Valid DataRecordEntity req) { |
||||||
|
return R.data(dataRecordService.save(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/update") |
||||||
|
@ApiOperation("编辑数据记录信息") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
public R update(@RequestBody DataRecordEntity req) { |
||||||
|
return R.data(dataRecordService.updateById(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/listPage") |
||||||
|
@ApiOperation("数据记录列表查询") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
public R<IPage<DataRecordEntity>> listPage(Query query, DataRecordEntity req) { |
||||||
|
return R.data(dataRecordService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("/removeByIds") |
||||||
|
@ApiOperation("删除数据记录") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
public R removeByIds(@RequestParam @ApiParam("id,按逗号分隔") String ids) { |
||||||
|
return R.status(dataRecordService.removeByIds(Func.toLongList(",",ids))); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
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.mp.support.SqlCondition; |
||||||
|
import org.springblade.core.tenant.mp.TenantEntity; |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode |
||||||
|
@TableName("gglm_data_instruct") |
||||||
|
@ApiModel(value = "自定义控制指令表",description = "自定义控制指令表") |
||||||
|
public class DataInstructEntity extends TenantEntity { |
||||||
|
|
||||||
|
@ApiModelProperty("item") |
||||||
|
private String itemId; |
||||||
|
|
||||||
|
@ApiModelProperty("站点名称") |
||||||
|
@QueryField(condition = SqlCondition.LIKE) |
||||||
|
private String stationName; |
||||||
|
|
||||||
|
@ApiModelProperty("站点ID") |
||||||
|
private String stationId; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控的设备名称") |
||||||
|
@QueryField(condition = SqlCondition.LIKE) |
||||||
|
private String deviceName; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控的设备ID") |
||||||
|
private String deviceId; |
||||||
|
|
||||||
|
@ApiModelProperty("遥控名称(不包含站点)") |
||||||
|
@QueryField(condition = SqlCondition.LIKE) |
||||||
|
private String ykName; |
||||||
|
|
||||||
|
@ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称") |
||||||
|
private String itemName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; |
||||||
|
|
||||||
|
public interface DataInstructMapper extends BaseMapper<DataInstructEntity> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; |
||||||
|
|
||||||
|
public interface DataRecordMapper extends BaseMapper<DataRecordEntity> { |
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.mapper.DataInstructMapper; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@AllArgsConstructor |
||||||
|
public class DataInstructService extends BaseServiceImpl<DataInstructMapper, DataInstructEntity> { |
||||||
|
|
||||||
|
public boolean save(DataInstructEntity entity) { |
||||||
|
//对遥控名称判重
|
||||||
|
LambdaQueryWrapper<DataInstructEntity> queryWrapper = new QueryWrapper<DataInstructEntity>() |
||||||
|
.lambda().eq(DataInstructEntity::getYkName, entity.getYkName()); |
||||||
|
Long count = baseMapper.selectCount(queryWrapper); |
||||||
|
if (count > 0) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
//保存信息
|
||||||
|
return save(entity); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean updateById(DataInstructEntity entity) { |
||||||
|
LambdaQueryWrapper<DataInstructEntity> queryWrapper = new QueryWrapper<DataInstructEntity>() |
||||||
|
.lambda().eq(DataInstructEntity::getItemName, entity.getItemName()) |
||||||
|
.ne(DataInstructEntity::getId, entity.getId()); |
||||||
|
Long count = baseMapper.selectCount(queryWrapper); |
||||||
|
if (count > 0) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
//对遥控名称判重
|
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package com.hnac.gglm.bigmodel.maintenance.service; |
||||||
|
|
||||||
|
import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; |
||||||
|
import com.hnac.gglm.bigmodel.maintenance.mapper.DataRecordMapper; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@AllArgsConstructor |
||||||
|
public class DataRecordService extends BaseServiceImpl<DataRecordMapper, DataRecordEntity> { |
||||||
|
} |
Loading…
Reference in new issue