1.
phpcjl
2024-12-10 1690d4d06b0c20b3606e50e0844ef67e07947a0d
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java
@@ -6,9 +6,8 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.SystemConfig;
import com.ruoyi.other.api.dto.IndexConfigSetDto;
import com.ruoyi.other.api.dto.StartPageSetDto;
import com.ruoyi.other.service.SystemConfigService;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.ApiOperation;
@@ -65,5 +64,31 @@
      return R.ok(one);
   }
    @GetMapping("/index/start")
    @ApiOperation(value = "宣传图片-公司简介", tags = {"小程序-启动页"})
    public R<StartPageSetDto> indexstart(){
        SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 1).one();
        if (one==null){
            return R.ok();
        }
        StartPageSetDto indexConfigSetDto = JSONObject.parseObject(one.getContent(), StartPageSetDto.class);
        return R.ok(indexConfigSetDto);
    }
    @PostMapping("/startPage/add")
    @ApiOperation(value = "添加", tags = {"后台-广告管理-启动页管理"})
    public R startPageadd(@RequestBody StartPageSetDto startPageSetDto){
        //先删除type=1的数据
        List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 1).list();
        systemConfigService.removeBatchByIds(list);
        SystemConfig  systemConfig = new SystemConfig();
        systemConfig.setType(1);
        systemConfig.setContent(JSON.toJSONString(startPageSetDto));
        systemConfigService.save(systemConfig);
        return R.ok();
    }
}