init
This commit is contained in:
@@ -12,7 +12,11 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.xq.domain.User;
|
||||
import com.ruoyi.xq.domain.UserVip;
|
||||
import com.ruoyi.xq.dto.admin.user.UserVipAdminVo;
|
||||
import com.ruoyi.xq.dto.admin.user.req.AddVipReq;
|
||||
import com.ruoyi.xq.service.UserService;
|
||||
import com.ruoyi.xq.service.UserVipService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -35,14 +39,15 @@ import java.util.Arrays;
|
||||
public class UserVipController extends BaseController {
|
||||
|
||||
private final UserVipService userVipService;
|
||||
private final UserService userService;
|
||||
|
||||
/**
|
||||
* 查询VIP用户列表
|
||||
*/
|
||||
@SaCheckPermission("xq:userVip:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<UserVip> list(UserVip bo, PageQuery pageQuery) {
|
||||
Page<UserVip> page = userVipService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
||||
public TableDataInfo<UserVipAdminVo> list(UserVipAdminVo bo, PageQuery pageQuery) {
|
||||
Page<UserVipAdminVo> page = userVipService.pageApp(pageQuery, bo);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@@ -58,38 +63,28 @@ public class UserVipController extends BaseController {
|
||||
return R.ok(userVipService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增VIP用户
|
||||
*/
|
||||
@SaCheckPermission("xq:userVip:add")
|
||||
@Log(title = "VIP用户", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody UserVip bo) {
|
||||
return toAjax(userVipService.save(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改VIP用户
|
||||
*/
|
||||
@SaCheckPermission("xq:userVip:edit")
|
||||
@Log(title = "VIP用户", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody UserVip bo) {
|
||||
return toAjax(userVipService.updateById(bo));
|
||||
@PostMapping("/addVip")
|
||||
public R<Void> addVip(@RequestBody AddVipReq bo) {
|
||||
User user = userService.getByUsercode(bo.getUsercode());
|
||||
if(user == null){
|
||||
return R.fail("用户不存在!");
|
||||
}
|
||||
userVipService.updateVipOrderAdmin(bo,user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除VIP用户
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("xq:userVip:remove")
|
||||
@Log(title = "VIP用户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(userVipService.removeBatchByIds(Arrays.asList(ids)));
|
||||
@DeleteMapping("/{id}")
|
||||
public R<Void> remove(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
||||
userVipService.removeVip(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user