多语言-VIP特权多语言

This commit is contained in:
liaozetao
2024-04-18 11:23:26 +08:00
committed by khalil
parent 2b2e3969e4
commit f0d5f243fb
3 changed files with 14 additions and 8 deletions

View File

@@ -15,12 +15,14 @@ import com.accompany.admin.base.Pagination;
import com.accompany.business.model.vip.VipAuthInfo;
import com.accompany.business.service.vip.VipAuthInfoService;
import com.accompany.common.constant.Constant;
import com.accompany.core.util.I18NMessageSourceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -39,18 +41,18 @@ public class VipAuthInfoAdminService {
public Pagination listVipByPage(Integer page, Integer pageSize) {
public Pagination<VipAuthInfo> listVipByPage(Integer page, Integer pageSize) {
PageHelper.startPage(page, pageSize);
QueryWrapper<VipAuthInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(VipAuthInfo::getStatus, Constant.VipAuthInfoStatus.valid).orderByAsc(VipAuthInfo::getSeq);
List<VipAuthInfo> vipInfos = vipAuthInfoService.list();
PageInfo<VipAuthInfo> pageInfo = new PageInfo<>(vipInfos);
return new Pagination(pageInfo);
return new Pagination<>(pageInfo);
}
public void saveVipAuthInfo(VipAuthInfo vipAuthInfo) {
I18NMessageSourceUtil.deserialization(vipAuthInfo, Arrays.asList("authName", "authDesc", "authIntro"));
if (ObjectUtil.isNull(vipAuthInfo.getId())) {
vipAuthInfo.setCreateTime(new Date());
vipAuthInfo.setUpdateTime(new Date());

View File

@@ -28,19 +28,19 @@ public class vipAuthInfoAdminController extends BaseController {
private VipAuthInfoAdminService vipAuthInfoAdminService;
@GetMapping("/listByPage")
public Pagination listVipByPage(Integer page, Integer pageSize) {
public Pagination<VipAuthInfo> listVipByPage(Integer page, Integer pageSize) {
return vipAuthInfoAdminService.listVipByPage(page, pageSize);
}
@PostMapping("/save")
public BusiResult saveVipAuthInfo(@Validated VipAuthInfo vipAuthInfo) {
public BusiResult<Void> saveVipAuthInfo(@Validated VipAuthInfo vipAuthInfo) {
vipAuthInfoAdminService.saveVipAuthInfo(vipAuthInfo);
return new BusiResult(BusiStatus.SUCCESS);
return new BusiResult<>(BusiStatus.SUCCESS);
}
@GetMapping(value = "/getVipAuthInfoById")
public BusiResult getVipAuthInfoById(Long id){
return new BusiResult(BusiStatus.SUCCESS, vipAuthInfoAdminService.getVipAuthInfoById(id));
public BusiResult<VipAuthInfo> getVipAuthInfoById(Long id){
return new BusiResult<>(BusiStatus.SUCCESS, vipAuthInfoAdminService.getVipAuthInfoById(id));
}

View File

@@ -10,6 +10,7 @@
*/
package com.accompany.business.model.vip;
import com.accompany.core.annotation.I18nAdmin;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@@ -36,15 +37,18 @@ public class VipAuthInfo {
@TableField(value = "auth_type")
@ApiModelProperty(value = "特权类型1. 铭牌 2. 头饰 3. 座驾 4. 礼物 5.资料卡 6. 财富值经验加成 7.表情 8.麦序光圈 9.麦位昵称颜色 10. 好友红名")
private Byte authType;
@I18nAdmin(className = "VipAuthInfo", fieldName = "authName")
@TableField(value = "auth_name")
@ApiModelProperty(value = "特权名称")
private String authName;
@TableField(value = "auth_icon")
@ApiModelProperty(value = "特权icon")
private String authIcon;
@I18nAdmin(className = "VipAuthInfo", fieldName = "authDesc")
@TableField(value = "auth_desc")
@ApiModelProperty(value = "特权短描述")
private String authDesc;
@I18nAdmin(className = "VipAuthInfo", fieldName = "authIntro")
@TableField(value = "auth_intro")
@ApiModelProperty(value = "特权长描述")
private String authIntro;