|
|
|
|
@ -0,0 +1,154 @@
|
|
|
|
|
package cn.jyjz.xiaoyao.ocr.controller;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.admin.service.TenantService;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.util.RequestBaseUtil;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.UserToken;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.mybatisplus.util.SearchQueryFormat;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPictureclass;
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrPictureclassService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.admin.service.UserService;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.service.UserTokenService;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.controller.BaseController;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.param.ParamterPage;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.util.requestFormat.SearchQuery;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.ResultVo;
|
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.ResultVoUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
|
|
|
|
|
@Api(tags="ocr-分类管理")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/ocr/ocrPictureclass")
|
|
|
|
|
public class OcrPictureclassController extends BaseController{
|
|
|
|
|
|
|
|
|
|
private Logger log = LoggerFactory.getLogger(this.getClass());
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private OcrPictureclassService ocrPictureclassService;
|
|
|
|
|
@Resource
|
|
|
|
|
private TenantService tenantService;
|
|
|
|
|
@Resource
|
|
|
|
|
private UserTokenService userTokenService;
|
|
|
|
|
@Resource
|
|
|
|
|
private UserService userService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页列表查询
|
|
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
//@AutoLog(value = "ocr_pictureclass-分页列表查询")
|
|
|
|
|
@ApiOperation(value="分类列表", notes="分类列表,无分页")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(paramType = "header", name = "X-Tenant-Id", value = "租户主键,用户登录时的信息“tenantList”中获得。", dataType = "String", required = true)
|
|
|
|
|
})
|
|
|
|
|
@GetMapping(value = "/rootList")
|
|
|
|
|
public ResultVo<List<OcrPictureclass>> rootList(HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
//租户主键,由前端页面传送
|
|
|
|
|
String tenantId = request.getHeader("X-Tenant-Id");
|
|
|
|
|
if(StringUtils.isBlank(tenantId)){
|
|
|
|
|
return ResultVoUtil.error("租户主键不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SearchQuery searchQuery = this.getParametersStartingWithToSearchJson(request, "search_");
|
|
|
|
|
OcrPictureclass ocrpictureclass = new OcrPictureclass();
|
|
|
|
|
QueryWrapper<OcrPictureclass> queryWrapper = SearchQueryFormat.queryStringFormat(searchQuery,ocrpictureclass);
|
|
|
|
|
queryWrapper.eq("TENANTID",tenantId);
|
|
|
|
|
queryWrapper.orderByDesc("REORDER");
|
|
|
|
|
|
|
|
|
|
List<OcrPictureclass> page = this.ocrPictureclassService.queryListNoPage(queryWrapper);;
|
|
|
|
|
return ResultVoUtil.success(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*方法描述:返回json字符串,接受参数,dto名称以及分页信息
|
|
|
|
|
*创建人:mail.zhangyong@gmail.com
|
|
|
|
|
*创建时间:2024-01-14 10:27:01
|
|
|
|
|
**/
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public ResultVo<IPage<OcrPictureclass>> listOcrPictureclass(ParamterPage paramterPage, HttpServletRequest request, HttpServletResponse response) throws IOException{
|
|
|
|
|
SearchQuery searchQuery = this.getParametersStartingWithToSearchJson(request, "search_");
|
|
|
|
|
OcrPictureclass ocrpictureclass = new OcrPictureclass();
|
|
|
|
|
QueryWrapper<OcrPictureclass> queryWrapper = SearchQueryFormat.queryStringFormat(searchQuery,ocrpictureclass);
|
|
|
|
|
IPage<OcrPictureclass> page = this.ocrPictureclassService.selectSearchListPage(paramterPage,queryWrapper);
|
|
|
|
|
for(OcrPictureclass ocrPictureclass:page.getRecords()){
|
|
|
|
|
ocrPictureclass.setTenant(tenantService.selectDtoById(ocrPictureclass.getTenantid()));
|
|
|
|
|
}
|
|
|
|
|
return ResultVoUtil.success(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*方法描述:保存添加数据
|
|
|
|
|
*创建人:mail.zhangyong@gmail.com
|
|
|
|
|
*创建时间:2024-01-14 10:27:01
|
|
|
|
|
**/
|
|
|
|
|
@PostMapping("/save")
|
|
|
|
|
public ResultVo saveOcrPictureclass(HttpServletResponse response,HttpServletRequest request,OcrPictureclass tab) throws IOException{
|
|
|
|
|
UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request));
|
|
|
|
|
tab.setCreateby(userToken.getLoginname());
|
|
|
|
|
tab.setCreatetime(System.currentTimeMillis());
|
|
|
|
|
this.ocrPictureclassService.save(tab);
|
|
|
|
|
return ResultVoUtil.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*方法描述:根据页面form传来的对象修改数据
|
|
|
|
|
*创建人:mail.zhangyong@gmail.com
|
|
|
|
|
*创建时间:2024-01-14 10:27:01
|
|
|
|
|
**/
|
|
|
|
|
@PostMapping("/edit")
|
|
|
|
|
public ResultVo editOcrPictureclass(HttpServletResponse response,HttpServletRequest request,OcrPictureclass tab) throws IOException{
|
|
|
|
|
UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request));
|
|
|
|
|
|
|
|
|
|
tab.setUpdateby(userToken.getLoginname());
|
|
|
|
|
tab.setUpdatetime(System.currentTimeMillis());
|
|
|
|
|
this.ocrPictureclassService.updateById(tab);
|
|
|
|
|
return ResultVoUtil.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*方法描述:通过主键获得对象信息
|
|
|
|
|
*创建人:mail.zhangyong@gmail.com
|
|
|
|
|
*创建时间:2024-01-14 10:27:01
|
|
|
|
|
**/
|
|
|
|
|
@GetMapping("/getdata/{id}")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultVo getdateOcrPictureclass(HttpServletResponse response,HttpServletRequest request,@PathVariable("id") Long id) throws IOException{
|
|
|
|
|
OcrPictureclass dto = this.ocrPictureclassService.selectDtoById(id);
|
|
|
|
|
if(null != dto){
|
|
|
|
|
return ResultVoUtil.success(dto);
|
|
|
|
|
}else{
|
|
|
|
|
return ResultVoUtil.error();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*方法描述:根据id字符串组删除对象方法,例如1,2,3
|
|
|
|
|
*创建人:mail.zhangyong@gmail.com
|
|
|
|
|
*创建时间:2024-01-14 10:27:01
|
|
|
|
|
**/
|
|
|
|
|
@GetMapping("/delmore")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultVo delMoreOcrPictureclass(HttpServletResponse response,HttpServletRequest request) throws IOException{
|
|
|
|
|
String ids = request.getParameter("id");
|
|
|
|
|
this.ocrPictureclassService.deleteByIdMore(ids);
|
|
|
|
|
return ResultVoUtil.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|