2024-07-08 17:47:02 +08:00
|
|
|
package com.gunshi.project.xyt.controller;
|
|
|
|
|
|
2024-07-17 17:38:06 +08:00
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
2024-07-08 17:47:02 +08:00
|
|
|
import com.gunshi.core.result.R;
|
2024-07-17 17:38:06 +08:00
|
|
|
import com.gunshi.project.xyt.entity.so.AttCctvBasePage;
|
2024-07-08 17:47:02 +08:00
|
|
|
import com.gunshi.project.xyt.model.AttCctvBase;
|
|
|
|
|
import com.gunshi.project.xyt.service.AttCctvBaseService;
|
|
|
|
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
|
|
|
|
import com.gunshi.project.xyt.validate.markers.Update;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
/**
|
|
|
|
|
* 描述: 视频基本信息表
|
|
|
|
|
* author: xusan
|
|
|
|
|
* date: 2024-07-08 17:40:37
|
|
|
|
|
*/
|
|
|
|
|
@Tag(name = "视频基本信息表")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping(value="/attCctvBase")
|
|
|
|
|
public class AttCctvBaseController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private AttCctvBaseService service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "新增")
|
|
|
|
|
@PostMapping("/insert")
|
|
|
|
|
public R<AttCctvBase> insert(@Validated(Insert.class) @RequestBody AttCctvBase dto) {
|
|
|
|
|
boolean result = service.save(dto);
|
|
|
|
|
return R.ok(result ? dto : null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "修改")
|
|
|
|
|
@PostMapping("/update")
|
|
|
|
|
public R<AttCctvBase> update(@Validated(Update.class) @RequestBody AttCctvBase dto) {
|
|
|
|
|
boolean result = service.updateById(dto);
|
|
|
|
|
return R.ok(result ? dto : null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "删除")
|
|
|
|
|
@GetMapping("/del/{id}")
|
|
|
|
|
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
|
|
|
|
return R.ok(service.removeById(id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "列表")
|
|
|
|
|
@PostMapping("/list")
|
|
|
|
|
public R<List<AttCctvBase>> list() {
|
|
|
|
|
return R.ok(service.lambdaQuery().list());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "分页")
|
|
|
|
|
@PostMapping("/page")
|
2024-07-17 17:38:06 +08:00
|
|
|
public R<Page<AttCctvBase>> page(@RequestBody @Validated AttCctvBasePage page) {
|
|
|
|
|
LambdaQueryChainWrapper<AttCctvBase> query = service.lambdaQuery();
|
|
|
|
|
if (ObjectUtils.isNotNull(page.getCode())) {
|
|
|
|
|
query.like(AttCctvBase::getIndexCode, page.getCode());
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtils.isNotNull(page.getMenuId())) {
|
|
|
|
|
query.like(AttCctvBase::getMenuId, page.getMenuId());
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtils.isNotNull(page.getName())) {
|
|
|
|
|
query.like(AttCctvBase::getName, page.getName());
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtils.isNotNull(page.getType())) {
|
|
|
|
|
query.eq(AttCctvBase::getType, Integer.valueOf(page.getType()));
|
|
|
|
|
}
|
|
|
|
|
return R.ok(service.page(page.getPageSo().toPage(), query));
|
2024-07-08 17:47:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|