liusheng
2024-03-20 4c95b4e5fee50a03c8ba964264ea3ef163e7805b
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceExternalpersonController.java
@@ -1,9 +1,16 @@
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;
@@ -24,24 +31,28 @@
/**
 * 外围单位人员Controller
 *
 *
 * @author ruoyi
 * @date 2021-11-24
 */
@RestController
@RequestMapping("/project/externalperson")
public class ServiceExternalpersonController extends BaseController
{
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)
    {
    public TableDataInfo list(ServiceExternalperson serviceExternalperson) {
        startPage();
        List<ServiceExternalperson> list = serviceExternalpersonService.queryList(serviceExternalperson);
        return getDataTable(list);
@@ -53,8 +64,7 @@
    //@PreAuthorize("@ss.hasPermi('project:externalperson:export')")
    @Log(title = "外围单位人员", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ServiceExternalperson serviceExternalperson)
    {
    public AjaxResult export(ServiceExternalperson serviceExternalperson) {
        List<ServiceExternalperson> list = serviceExternalpersonService.queryList(serviceExternalperson);
        ExcelUtil<ServiceExternalperson> util = new ExcelUtil<ServiceExternalperson>(ServiceExternalperson.class);
        return util.exportExcel(list, "外围单位人员数据");
@@ -65,8 +75,7 @@
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(serviceExternalpersonService.getById(id));
    }
@@ -75,11 +84,16 @@
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:add')")
    @Log(title = "外围单位人员", businessType = BusinessType.INSERT)
    @PostMapping
    @PostMapping("/add")
    @RepeatSubmit
    public AjaxResult add(@RequestBody ServiceExternalperson serviceExternalperson)
    {
        return toAjax(serviceExternalpersonService.save(serviceExternalperson));
    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);
    }
    /**
@@ -87,10 +101,9 @@
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:edit')")
    @Log(title = "外围单位人员", businessType = BusinessType.UPDATE)
    @PutMapping
    @RepeatSubmit
    public AjaxResult edit(@RequestBody ServiceExternalperson serviceExternalperson)
    {
    @PostMapping("/editZJInfo")
    @RepeatSubmit
    public AjaxResult edit(@RequestBody ServiceExternalperson serviceExternalperson) {
        return toAjax(serviceExternalpersonService.updateById(serviceExternalperson));
    }
@@ -99,9 +112,8 @@
     */
    //@PreAuthorize("@ss.hasPermi('project:externalperson:remove')")
    @Log(title = "外围单位人员", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(serviceExternalpersonService.removeByIds(Arrays.asList(ids)));
    }
@@ -111,8 +123,7 @@
     */
    @GetMapping(value = "/getInfoByUserNo/{userno}")
    public AjaxResult getInfoByUserNo(@PathVariable("userno") String userno)
    {
    public AjaxResult getInfoByUserNo(@PathVariable("userno") String userno) {
        return AjaxResult.success(serviceExternalpersonService.getInfoByUserNo(userno));
    }
}