| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package com.ydtech.modules.inv.controller;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.ydtech.core.page.HttpResult;
- import com.ydtech.modules.base.controller.BaseController;
- import com.ydtech.modules.inv.model.po.InvChannelAccount;
- import com.ydtech.modules.inv.model.po.QueryInvChannelAccount;
- import com.ydtech.modules.inv.service.InvChannelAccountService;
- import com.ydtech.modules.order.entity.BasePageResult;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.time.LocalDateTime;
- /**
- *
- * @author jianlong
- * @date 2024-01-05 09:31
- */
- @Api(tags = "应收应付 - 渠道账号管理", value = "渠道账号管理")
- @RequestMapping("/InvChannelAccount")
- @RestController
- public class InvChannelAccountController extends BaseController {
- @Autowired
- private InvChannelAccountService invChannelAccountService;
- @ApiOperation("获取渠道列表")
- @PostMapping("getAccount")
- public HttpResult<BasePageResult<InvChannelAccount>> getInsAccountList(@RequestBody QueryInvChannelAccount queryInvChannelAccount){
- IPage<InvChannelAccount> invChannelAccountIPage = invChannelAccountService.selectAccountsList(queryInvChannelAccount);
- BasePageResult<InvChannelAccount> invChannelAccountBasePageResult = new BasePageResult<>(invChannelAccountIPage.getCurrent(), invChannelAccountIPage.getSize(), invChannelAccountIPage.getTotal(), invChannelAccountIPage.getPages(),
- invChannelAccountIPage.getRecords());
- return HttpResult.ok(invChannelAccountBasePageResult);
- }
- @ApiOperation("获取账户详细信息")
- @GetMapping("getAccountById")
- public HttpResult<InvChannelAccount> getInsAccountById(@RequestParam("accountId") String accountId){
- return HttpResult.ok("", invChannelAccountService.getById(accountId));
- }
- @ApiOperation("删除账户(只传一个id就行)")
- @DeleteMapping("{accountId}")
- public HttpResult deleteInsAccount(@PathVariable("accountId") String accountId){
- if (accountId!= null){
- InvChannelAccount invChannelAccount = invChannelAccountService.getById(accountId);
- if (invChannelAccountService.removeById(invChannelAccount.getId())){
- return HttpResult.ok("删除成功");
- }else {
- return HttpResult.error();
- }
- }else {
- return HttpResult.error("id不能为空");
- }
- }
- @ApiOperation("插入账户信息")
- @PostMapping("insertAccount")
- public HttpResult insertInsAccount(@RequestBody InvChannelAccount invChannelAccount){
- invChannelAccount.setCreateTime(LocalDateTime.now());
- invChannelAccount.setCreateName(getUserName());
- if (invChannelAccountService.save(invChannelAccount)){
- return HttpResult.ok();
- }else {
- return HttpResult.error();
- }
- }
- @ApiOperation("修改账户信息")
- @PostMapping("updateAccount")
- public HttpResult updateInsAccount(@RequestBody InvChannelAccount invChannelAccount){
- if (invChannelAccountService.saveOrUpdate(invChannelAccount)){
- return HttpResult.ok();
- }else {
- return HttpResult.error();
- }
- }
- }
|