zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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("批量删除成功!");
    }
 
 
}