Compare commits
2 Commits
3a44280abe
...
2ec65fe29f
Author | SHA1 | Date | |
---|---|---|---|
2ec65fe29f | |||
d392021952 |
@ -65,7 +65,7 @@ public class TbLightInfoController extends BaseController {
|
|||||||
@SaCheckPermission("property:lightInfo:query")
|
@SaCheckPermission("property:lightInfo:query")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<TbLightInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<TbLightInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable("id") Long id) {
|
@PathVariable("id") Long id) {
|
||||||
return R.ok(tbLightInfoService.queryById(id));
|
return R.ok(tbLightInfoService.queryById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,4 +103,14 @@ public class TbLightInfoController extends BaseController {
|
|||||||
@PathVariable("ids") Long[] ids) {
|
@PathVariable("ids") Long[] ids) {
|
||||||
return toAjax(tbLightInfoService.deleteWithValidByIds(List.of(ids), true));
|
return toAjax(tbLightInfoService.deleteWithValidByIds(List.of(ids), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 灯开关控制
|
||||||
|
*
|
||||||
|
* @param bo bean
|
||||||
|
*/
|
||||||
|
@PostMapping("/switch")
|
||||||
|
public R<Void> switchSingleLight(@RequestBody TbLightInfoBo bo) {
|
||||||
|
return toAjax(tbLightInfoService.switchSingleLight(bo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,4 +143,18 @@ public class TbLightInfoServiceImpl implements ITbLightInfoService {
|
|||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单个灯开关控制
|
||||||
|
*
|
||||||
|
* @param bo bean
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean switchSingleLight(TbLightInfoBo bo){
|
||||||
|
TbLightInfo update = MapstructUtils.convert(bo, TbLightInfo.class);
|
||||||
|
boolean flag = baseMapper.updateById(update) > 0;
|
||||||
|
Assert.isTrue(flag, "修改灯开关失败");
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,4 +65,11 @@ public interface ITbLightInfoService {
|
|||||||
* @return 是否删除成功
|
* @return 是否删除成功
|
||||||
*/
|
*/
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单个灯开关控制
|
||||||
|
*
|
||||||
|
* @param bo bean
|
||||||
|
*/
|
||||||
|
Boolean switchSingleLight(TbLightInfoBo bo);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user