| | |
| | | |
| | | import com.ycl.system.Result; |
| | | import com.ycl.system.domain.group.Add; |
| | | import com.ycl.system.domain.group.Update; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.ycl.platform.service.DynamicColumnService; |
| | | import com.ycl.platform.domain.form.DynamicColumnForm; |
| | | import com.ycl.platform.domain.query.DynamicColumnQuery; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | |
| | | public Result list() { |
| | | return dynamicColumnService.all(); |
| | | } |
| | | |
| | | @GetMapping("/listByTableName") |
| | | @ApiOperation(value = "列表", notes = "列表") |
| | | public Result listByTableName(@RequestParam @NotNull(message = "路径名不能为空")String pathName) { |
| | | String tableName = getTableNameByPathNane(pathName); |
| | | return dynamicColumnService.allByTableName(tableName); |
| | | } |
| | | |
| | | @PostMapping("/addByTableName") |
| | | @ApiOperation(value = "添加", notes = "添加") |
| | | @PreAuthorize("@ss.hasPermi('dynamicColumn:add')") |
| | | public Result addByTableName(@RequestParam @NotNull(message = "路径名不能为空")String pathName,@RequestBody @Validated(Add.class) DynamicColumnForm form){ |
| | | String tableName = getTableNameByPathNane(pathName); |
| | | return dynamicColumnService.addByTableName(tableName,form); |
| | | } |
| | | |
| | | private final static String COLUMN_NAME_VIDEO = "uy_record_meta_d_sum"; |
| | | private final static String COLUMN_NAME_POINT = ""; |
| | | |
| | | @PutMapping("/updateByTableName") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public Result updateByTableName(@RequestParam @NotNull(message = "路径名不能为空")String pathName, @RequestBody @NotEmpty(message = "数据为空,无法保存") List<DynamicColumnForm> columnList){ |
| | | String tableName = getTableNameByPathNane(pathName); |
| | | return dynamicColumnService.updateByTableName(tableName,columnList); |
| | | } |
| | | |
| | | private String getTableNameByPathNane(String pathName) { |
| | | String tableName = ""; |
| | | if ("录像可用率".equals(pathName)){ |
| | | tableName = COLUMN_NAME_VIDEO; |
| | | }else if("点位在线率".equals(pathName)){ |
| | | tableName = COLUMN_NAME_POINT; |
| | | } |
| | | return tableName; |
| | | } |
| | | } |