| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- package com.ydtech.modules.inv.controller;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.ydtech.core.page.HttpResult;
- import com.ydtech.modules.inv.model.InvAccount;
- import com.ydtech.modules.inv.model.InvAccountCard;
- import com.ydtech.modules.inv.model.vo.InvAccountQueryVo;
- import com.ydtech.modules.inv.service.InvAccountCardService;
- import com.ydtech.modules.inv.service.InvAccountService;
- 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.sql.Wrapper;
- /**
- * @author jianlong
- * @date 2024-01-05 09:31
- */
- @Api(tags = "账户管理", value = "账户管理")
- @RequestMapping("/invAccount")
- @RestController
- public class InvAccountController {
- @Autowired
- private InvAccountService invAccountService;
- @Autowired
- private InvAccountCardService invAccountCardService;
- @PostMapping("excel")
- @ApiOperation("导出账户信息")
- public HttpResult selectAccountExcel(@RequestBody InvAccountQueryVo invAccountQueryVo) {
- return invAccountService.selectAccountExcel(invAccountQueryVo);
- }
- @ApiOperation("获取账户列表")
- @PostMapping("getAccount")
- public HttpResult<IPage<InvAccount>> getInsAccountList(@RequestBody InvAccountQueryVo invAccountQueryVo) {
- return HttpResult.ok("", invAccountService.selectAccountsListPage(invAccountQueryVo));
- }
- @ApiOperation("查询账户卡列表")
- @PostMapping("getAccountCardList")
- public HttpResult getInsAccountCardList(@RequestBody InvAccountCard invAccountCard) {
- LambdaQueryWrapper<InvAccountCard> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
- objectLambdaQueryWrapper.eq(InvAccountCard::getAccountId, invAccountCard.getAccountId());
- if (invAccountCard.getBankCardNum() != null) {
- objectLambdaQueryWrapper.eq(InvAccountCard::getBankCardNum, invAccountCard.getBankCardNum());
- } else if (invAccountCard.getBank() != null) {
- objectLambdaQueryWrapper.eq(InvAccountCard::getBank, invAccountCard.getBank());
- }
- return HttpResult.ok("", invAccountCardService.list(objectLambdaQueryWrapper));
- }
- @ApiOperation("删除账户(只传一个id就行)")
- @DeleteMapping("{accountId}")
- public HttpResult deleteInsAccount(@PathVariable("accountId") String accountId) {
- if (accountId != null) {
- InvAccount invAccount = invAccountService.getById(accountId);
- invAccount.setDelFlag("1");
- if (invAccountService.updateById(invAccount)) {
- return HttpResult.ok("删除成功");
- } else {
- return HttpResult.error();
- }
- } else {
- return HttpResult.error("id不能为空");
- }
- }
- @ApiOperation("删除账户卡")
- @DeleteMapping("card/{bankCardNum}")
- public HttpResult deleteInsAccountCard(@PathVariable("bankCardNum") String bankCardNum) {
- if (bankCardNum == null) {
- throw new RuntimeException("卡号为空");
- }
- if (invAccountCardService.removeById(bankCardNum)){
- return HttpResult.ok("删除成功");
- }else {
- return HttpResult.error("删除失败");
- }
- }
- @ApiOperation("插入账户信息")
- @PostMapping("insertAccount")
- public HttpResult insertInsAccount(@RequestBody InvAccount invAccount) {
- if (invAccountService.save(invAccount)) {
- return HttpResult.ok();
- } else {
- return HttpResult.error();
- }
- }
- @ApiOperation("插入账户卡信息")
- @PostMapping("insertAccountCard")
- public HttpResult insertInsAccountCard(@RequestBody InvAccountCard invAccountCard) {
- if (invAccountCard.getAccountId() == null) {
- throw new RuntimeException("账户id为空");
- }
- if (invAccountCardService.insertInsAccountCard(invAccountCard) > 0) {
- return HttpResult.ok();
- } else {
- return HttpResult.error();
- }
- }
- @ApiOperation("修改账户信息")
- @PostMapping("updateAccount")
- public HttpResult updateInsAccount(@RequestBody InvAccount invAccount) {
- if (invAccountService.updateById(invAccount)) {
- return HttpResult.ok();
- } else {
- return HttpResult.error();
- }
- }
- @ApiOperation("修改账户卡信息")
- @PostMapping("updateAccountCard")
- public HttpResult updateInsAccountCard(@RequestBody InvAccountCard invAccountCard) {
- if (invAccountCard.getBankCardNum() == null) {
- throw new RuntimeException("卡号不能为空");
- }
- if (invAccountCardService.updateInsAccountCard(invAccountCard) > 0) {
- return HttpResult.ok();
- } else {
- return HttpResult.error();
- }
- }
- @ApiOperation("根据户名分类")
- @GetMapping("getAccountByAccountName")
- public HttpResult selectByAccountName() {
- return invAccountService.selectByAccountName();
- }
- }
|