liusheng
2024-03-21 c20c99f256e2f47bd45f0b48fb6b1bcc83960f1e
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
121
122
123
124
125
126
127
128
129
130
package com.ruoyi.web.controller.project;
 
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
 
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.domain.BaseOnlyvalue;
import com.ruoyi.project.service.IBaseOnlyvalueService;
import com.ruoyi.web.controller.common.OnlyValueCommon;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.project.domain.ServiceExternalperson;
import com.ruoyi.project.service.IServiceExternalpersonService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
 
/**
 * 外围单位人员Controller
 *
 * @author ruoyi
 * @date 2021-11-24
 */
@RestController
@RequestMapping("/project/externalperson")
public class ServiceExternalpersonController extends BaseController {
    @Autowired
    private IServiceExternalpersonService serviceExternalpersonService;
 
    @Autowired
    private IBaseOnlyvalueService baseOnlyvalueService;
 
    @Autowired
    private OnlyValueCommon onlyValueCommon;
 
    /**
     * 查询外围单位人员列表
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceExternalperson serviceExternalperson) {
        logger.info("询外围单位人员列表的入参为 :{}", serviceExternalperson);
        startPage();
        List<ServiceExternalperson> list = serviceExternalpersonService.queryList(serviceExternalperson);
        return getDataTable(list);
    }
 
    /**
     * 导出外围单位人员列表
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:export')")
    @Log(title = "外围单位人员", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ServiceExternalperson serviceExternalperson) {
        List<ServiceExternalperson> list = serviceExternalpersonService.queryList(serviceExternalperson);
        ExcelUtil<ServiceExternalperson> util = new ExcelUtil<ServiceExternalperson>(ServiceExternalperson.class);
        return util.exportExcel(list, "外围单位人员数据");
    }
 
    /**
     * 获取外围单位人员详细信息
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(serviceExternalpersonService.getById(id));
    }
 
    /**
     * 新增外围单位人员
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:add')")
    @Log(title = "外围单位人员", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @RepeatSubmit
    public AjaxResult add(@RequestBody ServiceExternalperson serviceExternalperson) {
        if (StringUtils.isEmpty(serviceExternalperson.getUserno())) {
            String zj = onlyValueCommon.addOnlyValue("zj");
            String formattedNumber = String.format("%05d", zj);
            serviceExternalperson.setUserno(formattedNumber);
        }
        boolean save1 = serviceExternalpersonService.save(serviceExternalperson);
        return AjaxResult.success(serviceExternalperson);
    }
 
    /**
     * 修改外围单位人员
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:edit')")
    @Log(title = "外围单位人员", businessType = BusinessType.UPDATE)
    @PostMapping("/editZJInfo")
    @RepeatSubmit
    public AjaxResult edit(@RequestBody ServiceExternalperson serviceExternalperson) {
        return toAjax(serviceExternalpersonService.updateById(serviceExternalperson));
    }
 
    /**
     * 删除外围单位人员
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:remove')")
    @Log(title = "外围单位人员", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(serviceExternalpersonService.removeByIds(Arrays.asList(ids)));
    }
 
 
    /**
     * 获取外围单位人员详细信息
     */
 
    @GetMapping(value = "/getInfoByUserNo/{userno}")
    public AjaxResult getInfoByUserNo(@PathVariable("userno") String userno) {
        return AjaxResult.success(serviceExternalpersonService.getInfoByUserNo(userno));
    }
}