apkconfig

This commit is contained in:
wangjinlei
2024-07-09 13:33:20 +08:00
parent 8e86dc65e4
commit fe7f375f37
5 changed files with 106 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package com.peanut.modules.master.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.ApkConfigEntity;
import com.peanut.modules.common.service.ApkConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Slf4j
@RestController("masterApkConfig")
@RequestMapping("master/apkConfig")
public class ApkConfigController {
@Autowired
private ApkConfigService apkConfigService;
@RequestMapping("/getConfig")
public R getConfig(){
Map<String, Object> config = apkConfigService.getConfig();
return R.ok().put("list",config);
}
@RequestMapping("/setConfig")
public R setConfig(@RequestBody Map<String,Object> map){
int type = Integer.valueOf(map.get("type").toString());
String Url = map.get("url").toString();
ApkConfigEntity apkConfigEntity = apkConfigService.getBaseMapper().selectOne(new LambdaQueryWrapper<ApkConfigEntity>().eq(ApkConfigEntity::getType, type));
apkConfigEntity.setUrl(Url);
apkConfigService.updateById(apkConfigEntity);
return R.ok().put("result",apkConfigEntity);
}
}