| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package com.hr.controller;
- import com.hr.param.IpAccountParam;
- import com.hr.param.SwitchStatusParam;
- import com.hr.service.IpAccountService;
- import com.hr.vo.IpAccountVO;
- import com.yy.basedevelop.common.data.BasePageResult;
- import com.yy.basedevelop.common.data.BaseReturnDto;
- import com.yy.basedevelop.common.http.config.TokenUtil;
- import com.yy.basedevelop.dto.LoginUser;
- import io.swagger.v3.oas.annotations.Operation;
- import io.swagger.v3.oas.annotations.tags.Tag;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.data.domain.Page;
- import org.springframework.web.bind.annotation.*;
- /**
- * 账户管理
- * @author : longhoo
- * @date : 2025-10-10
- */
- @RestController
- @RequestMapping("/ipAccount")
- @Tag(name = "账户管理")
- public class IpAccountController{
- @Autowired
- private IpAccountService ipAccountService;
-
- /**
- * 分页查询
- *
- * @param ipAccountParam 筛选条件
- * @return 查询结果
- */
- @Operation(summary = "分页查询")
- @GetMapping
- public BasePageResult<IpAccountVO> paginQuery(@RequestBody IpAccountParam ipAccountParam){
- Page<IpAccountVO> ipAccountPOS = ipAccountService.paginQuery(ipAccountParam, ipAccountParam.getPageNum(), ipAccountParam.getPageSize());
- return BasePageResult.success(ipAccountPOS.getContent(), ipAccountPOS.getTotalElements(), ipAccountParam.getPageNum(), ipAccountParam.getPageSize());
- }
-
- /**
- * 新增数据
- *
- * @param accountParam 实例对象
- * @return 实例对象
- */
- @Operation(summary = "新增/更新数据")
- @PostMapping
- public BaseReturnDto<IpAccountVO> saveOrUpdate(@RequestBody IpAccountParam accountParam){
- LoginUser user= TokenUtil.getUser();
- ipAccountService.saveOrUpdate(accountParam,user.getUsername(),user.getUserid());
- return BaseReturnDto.success();
- }
- /**
- * 通过主键删除数据
- *
- * @param id 主键
- * @return 是否成功
- */
- @Operation(summary = "通过主键删除数据")
- @DeleteMapping
- public BaseReturnDto<Boolean> deleteById(Long id){
- return BaseReturnDto.success(ipAccountService.deleteById(id));
- }
- /**
- * 修改状态
- *
- * @param switchStatusParam 主键
- * @return 是否成功
- */
- @Operation(summary = "修改状态")
- @PostMapping("/switchStatus")
- public BaseReturnDto<Boolean> switchStatus(@RequestBody SwitchStatusParam switchStatusParam){
- return BaseReturnDto.success(ipAccountService.switchStatus(switchStatusParam));
- }
- }
|