| | |
| | | package com.iailab.module.model.mcs.pre.controller.admin; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictItemEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
| | | import com.iailab.module.model.mcs.pre.vo.CountItemtypeVO; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; |
| | | import com.iailab.module.model.mcs.pre.vo.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | |
| | | */ |
| | | @GetMapping("/page") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-predict:query')") |
| | | public CommonResult<PageResult<MmPredictItemRespVO>> page(@RequestParam Map<String, Object> params) { |
| | | PageResult<MmPredictItemRespVO> page = mmPredictItemService.getPageList(params); |
| | | return success(page); |
| | | public CommonResult<PageResult<MmPredictItemRespVO>> page(@Validated MmPredictItemPageReqVO reqVO) { |
| | | PageResult<MmPredictItemEntity> page = mmPredictItemService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, MmPredictItemRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/get/{id}") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-predict:query')") |
| | | public CommonResult<MmPredictItemDTO> info(@PathVariable("id") String id, @RequestParam Map<String, Object> params){ |
| | | MmPredictItemDTO predictItem = mmPredictItemService.getDetailById(id, params); |
| | | public CommonResult<MmPredictItemDTO> info(@PathVariable("id") String id){ |
| | | MmPredictItemDTO predictItem = mmPredictItemService.info(id); |
| | | return success(predictItem); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/create") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-predict:create')") |
| | | public CommonResult<Boolean> save(@RequestBody MmPredictItemDTO mmPredictItemDto){ |
| | | int count = mmPredictItemService.check(mmPredictItemDto.getMmPredictItem()); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | mmPredictItemService.savePredictItem(mmPredictItemDto); |
| | | @DSTransactional(rollbackFor= Exception.class) |
| | | public CommonResult<Boolean> save(@RequestBody MmPredictItemEntity mmPredictItemEntity){ |
| | | String id = UUID.randomUUID().toString(); |
| | | mmPredictItemEntity.setId(id); |
| | | mmPredictItemService.add(mmPredictItemEntity); |
| | | return success(true); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PutMapping("/update") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-predict:update')") |
| | | public CommonResult<Boolean> update(@RequestBody MmPredictItemDTO mmPredictItemDto){ |
| | | int count = mmPredictItemService.check(mmPredictItemDto.getMmPredictItem()); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | mmPredictItemService.update(mmPredictItemDto); |
| | | @DSTransactional(rollbackFor= Exception.class) |
| | | public CommonResult<Boolean> update(@RequestBody MmPredictItemEntity mmPredictItemEntity){ |
| | | mmPredictItemService.update(mmPredictItemEntity); |
| | | return success(true); |
| | | } |
| | | |
| | |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-predict:delete')") |
| | | @DSTransactional(rollbackFor= Exception.class) |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | mmPredictItemService.deleteBatch(new String[]{id}); |
| | | return success(true); |
| | |
| | | return success(list); |
| | | } |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | @GetMapping("/count") |
| | | public CommonResult<Long> count() { |
| | | Long count = mmPredictItemService.count(); |
| | | return success(count); |
| | | } |
| | | // /** |
| | | // * 数量 |
| | | // */ |
| | | // @GetMapping("/count") |
| | | // public CommonResult<Long> count() { |
| | | // Long count = mmPredictItemService.count(); |
| | | // return success(count); |
| | | // } |
| | | |
| | | /** |
| | | * 上传模型 |