智慧保安后台管理-外网项目备份
tangzy
2022-02-24 d4b00c05321d9373a33bfb26618735e2a5868a81
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package org.springblade.modules.apply.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.common.utils.arg;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.apply.entity.ExamPayment;
import org.springblade.modules.apply.service.ExamPaymentService;
import org.springblade.modules.apply.vo.ExamPaymentVO;
import org.springblade.modules.system.service.MyAsyncService;
import org.springframework.web.bind.annotation.*;
 
import java.util.Arrays;
import java.util.List;
 
/**
 * @author zhongrj
 * @time 2021-07-22
 * @desc 考试缴费管理控制层
 */
@RestController
@AllArgsConstructor
@RequestMapping("/examPayment")
public class ExamPaymentController {
 
    private final ExamPaymentService examPaymentService;
    private final MyAsyncService myAsyncService;
 
    /**
     * 自定义分页
     *
     * @param query       page,size
     * @param examPayment 考试缴费信息对象
     */
    @GetMapping("/page")
    public R<IPage<ExamPaymentVO>> page(ExamPaymentVO examPayment, Query query) {
        IPage<ExamPaymentVO> pages = examPaymentService.selectExamPaymentPage(Condition.getPage(query), examPayment);
        return R.data(pages);
    }
 
    /**
     * 分页
     */
    @GetMapping("/list")
    public R<IPage<ExamPayment>> list(ExamPayment examPayment, Query query) {
        IPage<ExamPayment> pages = examPaymentService.page(Condition.getPage(query), Condition.getQueryWrapper(examPayment));
        return R.data(pages);
    }
 
    /**
     * 新增
     *
     * @param examPayment 考试缴费信息对象
     */
    @PostMapping("/save")
    @ApiOperation(value = "新增", notes = "传入examPayment")
    public R save(@RequestBody ExamPayment examPayment) {
        return R.status(examPaymentService.save(examPayment));
    }
 
 
    /**
     * 修改
     *
     * @param examPayment 考试缴费信息对象
     */
    @PostMapping("/update")
    public R update(@RequestBody ExamPayment examPayment) {
        return R.status(examPaymentService.updateById(examPayment));
    }
 
    /**
     * 新增或修改
     *
     * @param examPayment 考试缴费信息对象
     */
    @PostMapping("/submit")
    public R submit(@RequestBody ExamPayment examPayment) throws Exception {
        return R.status(examPaymentService.saveOrUpdate(examPayment));
    }
 
 
    /**
     * 删除
     *
     * @param ids 考试缴费信息ids 数组
     */
    @PostMapping("/remove")
    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
        List<String> list = Arrays.asList(ids.split(","));
        list.forEach(id -> {
            //内网同步
            String s1 = "delete from sys_exam_payment where id = " + "'" + id + "'";
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
        });
        return R.status(examPaymentService.removeByIds(Func.toLongList(ids)));
    }
 
    /**
     * 详情
     *
     * @param examPayment 考试缴费信息对象
     */
    @GetMapping("/detail")
    @ApiOperation(value = "详情", notes = "传入examPayment")
    public R<ExamPaymentVO> details(ExamPayment examPayment) {
        //查询考试缴费详情
        ExamPaymentVO detail = examPaymentService.selectExamPaymentInfo(examPayment);
        //返回
        return R.data(detail);
    }
 
}