Letianhua 1 год назад
Родитель
Сommit
090e69ae4d

+ 3 - 3
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/controller/GameVipController.java

@@ -39,10 +39,10 @@ public class GameVipController {
     }
 
     @ApiOperation(value = "删除vip档位")
-    @DeleteMapping("/delete/{id}")
+    @DeleteMapping("/delete/{ids}")
     @PreAuthorize(permissionKey = "manage:gameVip:delete")
-    public ResultVO<Boolean> deleteById(@PathVariable("id") Long id) {
-        return ResultVO.ok(gameVipService.deleteById(id));
+    public ResultVO<Boolean> deleteById(@PathVariable("ids") List<Long> ids) {
+        return ResultVO.ok(gameVipService.deleteById(ids));
     }
 
     @ApiOperation(value = "游戏VIP档位列表")

+ 3 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/IGameVipService.java

@@ -7,6 +7,8 @@ import com.zanxiang.game.module.manage.pojo.params.GameVipListParam;
 import com.zanxiang.game.module.manage.pojo.vo.GameVipListVO;
 import com.zanxiang.game.module.mybatis.entity.GameVip;
 
+import java.util.List;
+
 /**
  * @author tianhua
  * @version 1.0
@@ -17,7 +19,7 @@ public interface IGameVipService extends IService<GameVip> {
 
     boolean addOrUpdate(GameVipAddParam param);
 
-    boolean deleteById(Long id);
+    boolean deleteById(List<Long> ids);
 
     IPage<GameVipListVO> gameVipList(GameVipListParam param);
 

+ 24 - 22
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameVipServiceImpl.java

@@ -115,13 +115,13 @@ public class GameVipServiceImpl extends ServiceImpl<GameVipMapper, GameVip> impl
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public boolean deleteById(Long id) {
+    public boolean deleteById(List<Long> ids) {
         Long sysUserId = SecurityUtil.getUserId();
         return update(new LambdaUpdateWrapper<GameVip>()
                         .set(GameVip::getIsDelete, 1)
                         .set(GameVip::getUpdateBy, sysUserId)
                         .set(GameVip::getUpdateTime, LocalDateTime.now())
-                        .in(GameVip::getId, id)
+                        .in(GameVip::getId, ids)
         );
     }
 
@@ -132,27 +132,29 @@ public class GameVipServiceImpl extends ServiceImpl<GameVipMapper, GameVip> impl
                 .eq(null != param.getParentGameId(), GameVip::getParentGameId, param.getParentGameId())
                 .eq(null != param.getVipLevel(), GameVip::getVipLevel, param.getVipLevel())
                 .eq(GameVip::getIsDelete, 0))
-                .convert(vo ->{
-                    GameDTO game = gameService.getById(vo.getParentGameId());
-                    GameSupper gameSupper = gameSupperService.getById(vo.getSuperGameId());
-                    return GameVipListVO.builder()
-                            .id(vo.getId())
-                            .superGameId(vo.getSuperGameId())
-                            .superGameName(null == gameSupper ? null : gameSupper.getName())
-                            .parentGameId(vo.getParentGameId())
-                            .parentGameName(null == game ? null : game.getName())
-                            .rechargeMoneyMin(vo.getRechargeMoneyMin())
-                            .rechargeMoneyMax(vo.getRechargeMoneyMax())
-                            .vipLevel(vo.getVipLevel())
-                            .createTime(vo.getCreateTime())
-                            .createBy(vo.getCreateBy())
-                            .createName(sysUserRpc.getById(vo.getCreateBy()).getData().getNickname())
-                            .updateTime(vo.getUpdateTime())
-                            .updateBy(vo.getUpdateBy())
-                            .updateName(sysUserRpc.getById(vo.getUpdateBy()).getData().getNickname())
-                            .build();
-                });
+                .convert(this::toVO);
     }
 
 
+    private GameVipListVO toVO(GameVip vo) {
+        GameDTO game = gameService.getById(vo.getParentGameId());
+        GameSupper gameSupper = gameSupperService.getById(vo.getSuperGameId());
+        return GameVipListVO.builder()
+                .id(vo.getId())
+                .superGameId(vo.getSuperGameId())
+                .superGameName(null == gameSupper ? null : gameSupper.getName())
+                .parentGameId(vo.getParentGameId())
+                .parentGameName(null == game ? null : game.getName())
+                .rechargeMoneyMin(vo.getRechargeMoneyMin())
+                .rechargeMoneyMax(vo.getRechargeMoneyMax())
+                .vipLevel(vo.getVipLevel())
+                .createTime(vo.getCreateTime())
+                .createBy(vo.getCreateBy())
+                .createName(sysUserRpc.getById(vo.getCreateBy()).getData().getNickname())
+                .updateTime(vo.getUpdateTime())
+                .updateBy(vo.getUpdateBy())
+                .updateName(sysUserRpc.getById(vo.getUpdateBy()).getData().getNickname())
+                .build();
+    }
+
 }