38 lines
1.4 KiB
Java
38 lines
1.4 KiB
Java
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);
|
|
}
|
|
}
|