优化接口代码

This commit is contained in:
linfeng 2023-12-08 11:04:09 +08:00
parent 1721c84604
commit 1e831853d6
5 changed files with 15 additions and 7 deletions

View File

@ -66,6 +66,8 @@ public class Constant {
*/
public static final String SMS_PREFIX = "code_";
public static final String DEFAULT_TAG = "新人";
/**
* 注册账户默认分配头像
*/

View File

@ -31,6 +31,6 @@ public interface SystemService extends IService<SystemEntity> {
PageUtils queryPage(Map<String, Object> params);
SystemEntity miniConfig();
}

View File

@ -177,7 +177,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
appUser.setCreateTime(DateUtil.nowDateTime());
appUser.setUpdateTime(DateUtil.nowDateTime());
List<String> list = new ArrayList<>();
list.add("新人");
list.add(Constant.DEFAULT_TAG);
appUser.setTagStr(JSON.toJSONString(list));
baseMapper.insert(appUser);
AppUserEntity user = this.lambdaQuery()
@ -341,7 +341,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
appUser.setUpdateTime(DateUtil.nowDateTime());
appUser.setOpenid(openId);
List<String> list = new ArrayList<>();
list.add("新人");
list.add(Constant.DEFAULT_TAG);
appUser.setTagStr(JSON.toJSONString(list));
baseMapper.insert(appUser);
AppUserEntity users = this.lambdaQuery().eq(AppUserEntity::getOpenid, openId).one();

View File

@ -12,6 +12,7 @@
*/
package io.linfeng.modules.admin.service.impl;
import io.linfeng.common.utils.ConfigConstant;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -38,5 +39,12 @@ public class SystemServiceImpl extends ServiceImpl<SystemDao, SystemEntity> impl
return new PageUtils(page);
}
@Override
public SystemEntity miniConfig() {
return this.lambdaQuery()
.eq(SystemEntity::getConfig, ConfigConstant.MINIAPP)
.one();
}
}

View File

@ -11,7 +11,6 @@
*/
package io.linfeng.modules.app.controller;
import io.linfeng.common.utils.ConfigConstant;
import io.linfeng.common.utils.R;
import io.linfeng.modules.admin.entity.SystemEntity;
import io.linfeng.modules.admin.service.SystemService;
@ -34,12 +33,11 @@ public class AppSystemConfigController {
@Autowired
private SystemService systemService;
@ApiOperation("logo配置")
@GetMapping("/miniConfig")
public R miniConfig(){
SystemEntity system = systemService.lambdaQuery()
.eq(SystemEntity::getConfig, ConfigConstant.MINIAPP)
.one();
SystemEntity system = systemService.miniConfig();
return R.ok().put("logo",system.getIntro());
}