xuhy
2024-09-19 45403c689e2e0d6e69d32e1833faabc116f859e2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TFoundationPersonController.java
@@ -5,9 +5,11 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.TFoundationConfig;
import com.ruoyi.system.domain.TFoundationPerson;
import com.ruoyi.system.domain.TShop;
import com.ruoyi.system.dto.TFoundationPersonDTO;
import com.ruoyi.system.service.TFoundationConfigService;
import com.ruoyi.system.service.TFoundationPersonService;
import com.ruoyi.system.service.TShopService;
import com.ruoyi.system.vo.TFoundationPersonVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -15,6 +17,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -31,11 +34,13 @@
public class TFoundationPersonController {
    private final TFoundationPersonService foundationPersonService;
    private final TFoundationConfigService foundationConfigService;
    private final TShopService shopService;
    @Autowired
    public TFoundationPersonController(TFoundationPersonService foundationPersonService, TFoundationConfigService foundationConfigService) {
    public TFoundationPersonController(TFoundationPersonService foundationPersonService, TFoundationConfigService foundationConfigService, TShopService shopService) {
        this.foundationPersonService = foundationPersonService;
        this.foundationConfigService = foundationConfigService;
        this.shopService = shopService;
    }
    /**
     * 查询基础设置列表
@@ -52,6 +57,7 @@
    @ApiOperation( value = "添加基础设置")
    @PostMapping(value = "/add")
    public AjaxResult<Boolean> add(@RequestBody TFoundationPersonDTO dto) {
        dto.setCreateTime(LocalDateTime.now());
        foundationPersonService.add(dto);
        return AjaxResult.success();
    }
@@ -79,6 +85,9 @@
        TFoundationPersonVO foundationPersonVO = new TFoundationPersonVO();
        BeanUtils.copyProperties(foundationPerson, foundationPersonVO);
        foundationPersonVO.setFoundationConfigs(list);
        // 查询店铺
        TShop shop = shopService.getById(foundationPersonVO.getShopId());
        foundationPersonVO.setShop(shop);
        return AjaxResult.success(foundationPersonVO);
    }