|
|
|
@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
|
|
import org.jeecg.common.util.AssertUtils;
|
|
|
|
|
import org.jeecg.config.JeecgBaseConfig;
|
|
|
|
|
import org.jeecg.modules.ocr.entity.OcrTaskType;
|
|
|
|
|
import org.jeecg.modules.ocr.service.IOcrTaskTypeService;
|
|
|
|
@ -86,6 +87,7 @@ public class OcrTaskTypeController extends JeecgController<OcrTaskType, IOcrTask
|
|
|
|
|
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_task_type:add")
|
|
|
|
|
@PostMapping(value = "/add")
|
|
|
|
|
public Result<String> add(@RequestBody OcrTaskType ocrTaskType) {
|
|
|
|
|
ocrTaskTypeService.existsByTypeNameList(Arrays.asList(ocrTaskType));
|
|
|
|
|
ocrTaskTypeService.save(ocrTaskType);
|
|
|
|
|
return Result.OK("添加成功!");
|
|
|
|
|
}
|
|
|
|
@ -101,6 +103,7 @@ public class OcrTaskTypeController extends JeecgController<OcrTaskType, IOcrTask
|
|
|
|
|
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_task_type:edit")
|
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
|
|
public Result<String> edit(@RequestBody OcrTaskType ocrTaskType) {
|
|
|
|
|
ocrTaskTypeService.existsByTypeNameList(Arrays.asList(ocrTaskType));
|
|
|
|
|
ocrTaskTypeService.updateById(ocrTaskType);
|
|
|
|
|
return Result.OK("编辑成功!");
|
|
|
|
|
}
|
|
|
|
@ -116,6 +119,8 @@ public class OcrTaskTypeController extends JeecgController<OcrTaskType, IOcrTask
|
|
|
|
|
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_task_type:delete")
|
|
|
|
|
@DeleteMapping(value = "/delete")
|
|
|
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
|
|
boolean flag=ocrTaskTypeService.checkMetadataConfigUse(Arrays.asList(id));
|
|
|
|
|
AssertUtils.notTrue(flag,"任务类型不可删除,原因:被元数据配置使用中");
|
|
|
|
|
ocrTaskTypeService.removeById(id);
|
|
|
|
|
return Result.OK("删除成功!");
|
|
|
|
|
}
|
|
|
|
@ -131,6 +136,8 @@ public class OcrTaskTypeController extends JeecgController<OcrTaskType, IOcrTask
|
|
|
|
|
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_task_type:deleteBatch")
|
|
|
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
|
|
|
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
|
|
boolean flag=ocrTaskTypeService.checkMetadataConfigUse(Arrays.asList(ids.split(",")));
|
|
|
|
|
AssertUtils.notTrue(flag,"任务类型不可删除,原因:被元数据配置使用中");
|
|
|
|
|
this.ocrTaskTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
|
|
return Result.OK("批量删除成功!");
|
|
|
|
|
}
|
|
|
|
@ -182,6 +189,8 @@ public class OcrTaskTypeController extends JeecgController<OcrTaskType, IOcrTask
|
|
|
|
|
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_task_type:importExcel")
|
|
|
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
List<OcrTaskType> ocrTaskTypes = super.readExcel(request, response, OcrTaskType.class);
|
|
|
|
|
ocrTaskTypeService.existsByTypeNameList(ocrTaskTypes);
|
|
|
|
|
return super.importExcel(request, response, OcrTaskType.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|