zj
2025-01-06 0e7b38c2b3af72ea2a7f8a2fcbaad4d78e2c1977
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
package com.gear.admin.controller.finance;
 
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gear.common.builder.WhereBuilder;
import com.gear.common.vo.Result;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.gear.common.annotation.Log;
import com.gear.common.core.controller.BaseController;
import com.gear.common.enums.BusinessType;
import com.gear.finance.domain.FinanceProductUserRecord;
import com.gear.finance.service.IFinanceProductUserRecordService;
import com.gear.common.utils.poi.ExcelUtil;
 
/**
 * 产品投资记录Controller
 * 
 * @author czx
 * @date 2023-11-16
 */
@RestController
@RequestMapping("/finance/productRecord")
public class FinanceProductUserRecordController extends BaseController
{
    @Autowired
    private IFinanceProductUserRecordService financeProductUserRecordService;
 
    /**
     * 查询产品投资记录列表
     */
    @PreAuthorize("@ss.hasPermi('finance:productRecord:list')")
    @GetMapping("/list")
    public Result<IPage<FinanceProductUserRecord>> list(FinanceProductUserRecord financeProductUserRecord,
        @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
        @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
        QueryWrapper<FinanceProductUserRecord> queryWrapper = WhereBuilder.build(financeProductUserRecord);
        Page<FinanceProductUserRecord> page = new Page<FinanceProductUserRecord>(pageNo, pageSize);
        IPage<FinanceProductUserRecord> pageList = financeProductUserRecordService.page(page, queryWrapper);
        return Result.OK(pageList);
    }
 
    /**
     * 导出产品投资记录列表
     */
    @PreAuthorize("@ss.hasPermi('finance:productRecord:export')")
    @Log(title = "产品投资记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FinanceProductUserRecord financeProductUserRecord){
        QueryWrapper<FinanceProductUserRecord> queryWrapper = WhereBuilder.build(financeProductUserRecord);
        List<FinanceProductUserRecord> list = financeProductUserRecordService.list(queryWrapper);
        ExcelUtil<FinanceProductUserRecord> util = new ExcelUtil<FinanceProductUserRecord>(FinanceProductUserRecord.class);
        util.exportExcel(response, list, "产品投资记录数据");
    }
 
    /**
     * 获取产品投资记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('finance:productRecord:query')")
    @GetMapping(value = "/{id}")
    public Result<FinanceProductUserRecord>  getInfo(@PathVariable("id") String id){
        FinanceProductUserRecord financeProductUserRecord = financeProductUserRecordService.getById(id);
        if(financeProductUserRecord==null) {
            return Result.error("未找到对应数据");
        }
        return Result.OK(financeProductUserRecord);
    }
 
    /**
     * 新增产品投资记录
     */
    @PreAuthorize("@ss.hasPermi('finance:productRecord:add')")
    @Log(title = "产品投资记录", businessType = BusinessType.INSERT)
    @PostMapping
    public Result<String> add(@RequestBody FinanceProductUserRecord financeProductUserRecord){
        financeProductUserRecordService.save(financeProductUserRecord);
        return Result.ok("添加成功!");
    }
 
    /**
     * 修改产品投资记录
     */
    @PreAuthorize("@ss.hasPermi('finance:productRecord:edit')")
    @Log(title = "产品投资记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public  Result<String> edit(@RequestBody FinanceProductUserRecord financeProductUserRecord){
        financeProductUserRecordService.updateById(financeProductUserRecord);
        return Result.ok("编辑成功!");
    }
 
    /**
     * 删除产品投资记录
     */
    @PreAuthorize("@ss.hasPermi('finance:productRecord:remove')")
    @Log(title = "产品投资记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public  Result<String> remove(@PathVariable List<String> ids){
        financeProductUserRecordService.removeBatchByIds(ids);
        return Result.ok("删除成功!");
    }
}