package org.jeecg.modules.patent.controller;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import io.swagger.annotations.Api;
|
import lombok.extern.slf4j.Slf4j;
|
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.modules.patent.entity.PaSoftbook;
|
import org.jeecg.modules.patent.entity.PaSoftbookFile;
|
import org.jeecg.modules.patent.service.IPaSoftBookFileService;
|
import org.jeecg.modules.patent.service.IPaSoftBookService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletRequest;
|
import java.util.Arrays;
|
|
|
@Slf4j
|
@Api(tags = "专利软著")
|
@RestController
|
@RequestMapping("/pa/soft")
|
public class PaSoftBookController extends JeecgController<PaSoftbook, IPaSoftBookService> {
|
@Autowired
|
private IPaSoftBookService paSoftBookService;
|
@Autowired
|
private IPaSoftBookFileService paSoftBookFileService;
|
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
public Result<IPage<PaSoftbook>> queryPageList(PaSoftbook paSoftBook, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(name = "pageSize", defaultValue = "100") Integer pageSize, HttpServletRequest req) {
|
Result<IPage<PaSoftbook>> result = new Result<IPage<PaSoftbook>>();
|
QueryWrapper<PaSoftbook> queryWrapper = QueryGenerator.initQueryWrapper(paSoftBook, req.getParameterMap());
|
Page<PaSoftbook> page = new Page<PaSoftbook>(pageNo, pageSize);
|
IPage<PaSoftbook> pageList = paSoftBookService.page(page, queryWrapper);
|
result.setSuccess(true);
|
result.setResult(pageList);
|
return result;
|
}
|
|
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
@AutoLog(value = "添加专利软著")
|
@Transactional
|
public Result<PaSoftbook> add(@RequestBody PaSoftbook paSoftbook, HttpServletRequest request) {
|
Result<PaSoftbook> result = new Result<PaSoftbook>();
|
paSoftBookService.save(paSoftbook);
|
result.success("添加成功!");
|
result.setResult(paSoftbook);
|
return result;
|
}
|
|
|
@AutoLog(value = "修改专利软著")
|
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
public Result<PaSoftbook> edit(@RequestBody PaSoftbook paSoftbook) {
|
Result<PaSoftbook> result = new Result<PaSoftbook>();
|
paSoftBookService.updateById(paSoftbook);
|
result.success("修改成功!");
|
result.setResult(paSoftbook);
|
return result;
|
}
|
|
@AutoLog(value = "删除专利软著")
|
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
paSoftBookService.removeById(id);
|
return Result.ok("删除成功");
|
}
|
|
@AutoLog(value = "批量删除专利软著")
|
@DeleteMapping(value = "/deleteBatch")
|
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
this.paSoftBookService.removeByIds(Arrays.asList(ids.split(",")));
|
return Result.ok("批量删除成功!");
|
}
|
|
|
}
|