From 84528f18187abe5bd895e60595cb45d83d84c158 Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Wed, 12 Apr 2023 07:28:35 +0000
Subject: [PATCH] 年度资金账户(公司流)
---
eladmin-web-master/src/api/capital/accountCompanySet.js | 35 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountCompanySetService.java | 83 ++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanySetDto.java | 47 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanySetQueryCriteria.java | 41 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountCompanySetMapper.java | 32 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountCompanySet.java | 68 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountCompanySetRepository.java | 44 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountCompanySetController.java | 95 +++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountCompanySetServiceImpl.java | 143 +++++++++++
eladmin-web-master/src/views/capital/accountCompanySet/index.vue | 154 +++++++++++
10 files changed, 742 insertions(+), 0 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountCompanySet.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountCompanySet.java
new file mode 100644
index 0000000..f52aeb7
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/domain/CapitalAccountCompanySet.java
@@ -0,0 +1,68 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.capital.domain;
+
+import lombok.Data;
+import cn.hutool.core.bean.BeanUtil;
+import io.swagger.annotations.ApiModelProperty;
+import cn.hutool.core.bean.copier.CopyOptions;
+import me.zhengjie.base.BaseEntity;
+
+import javax.persistence.*;
+import javax.validation.constraints.*;
+import java.sql.Timestamp;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2023-04-12
+**/
+@Entity
+@Data
+@Table(name="capital_account_company_set")
+public class CapitalAccountCompanySet extends BaseEntity implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "`id`")
+ @ApiModelProperty(value = "ID")
+ private Long id;
+
+ @Column(name = "`project_distinguish`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "项目区分")
+ private String projectDistinguish;
+
+ @Column(name = "`account_type`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "账户类型")
+ private String accountType;
+
+ @Column(name = "`account_name`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "账户名称")
+ private String accountName;
+
+ @Column(name = "`remarks`")
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+ public void copy(CapitalAccountCompanySet source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountCompanySetRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountCompanySetRepository.java
new file mode 100644
index 0000000..efe03a9
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/repository/CapitalAccountCompanySetRepository.java
@@ -0,0 +1,44 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.capital.repository;
+
+import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+import java.util.List;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-04-12
+**/
+public interface CapitalAccountCompanySetRepository extends JpaRepository<CapitalAccountCompanySet, Long>, JpaSpecificationExecutor<CapitalAccountCompanySet> {
+
+ /**
+ * 根据项目区分查询
+ * @param projectDistinguish
+ * @return
+ */
+ List<CapitalAccountCompanySet> findByProjectDistinguish(String projectDistinguish);
+
+ /**
+ * 根据账户类型查询
+ * @param accountType
+ * @return
+ */
+ List<CapitalAccountCompanySet> findByAccountType(String accountType);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountCompanySetController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountCompanySetController.java
new file mode 100644
index 0000000..c805d12
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/rest/CapitalAccountCompanySetController.java
@@ -0,0 +1,95 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.capital.rest;
+
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet;
+import me.zhengjie.modules.capital.service.CapitalAccountCompanySetService;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.*;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-04-12
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "年度资金账户(公司流)设定管理")
+@RequestMapping("/api/capitalAccountCompanySet")
+public class CapitalAccountCompanySetController {
+
+ private final CapitalAccountCompanySetService capitalAccountCompanySetService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('capitalAccountCompanySet:download')")
+ public void exportCapitalAccountCompanySet(HttpServletResponse response, CapitalAccountCompanySetQueryCriteria criteria) throws IOException {
+ capitalAccountCompanySetService.download(capitalAccountCompanySetService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询年度资金账户(公司流)设定")
+ @ApiOperation("查询年度资金账户(公司流)设定")
+ @PreAuthorize("@el.check('capitalAccountCompanySet:list')")
+ public ResponseEntity<Object> queryCapitalAccountCompanySet(CapitalAccountCompanySetQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(capitalAccountCompanySetService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/all")
+ @Log("查询年度资金账户(公司流)设定")
+ @ApiOperation("查询年度资金账户(公司流)设定")
+ @PreAuthorize("@el.check('capitalAccountCompanySet:list')")
+ public ResponseEntity<Object> queryCapitalAccountCompanySet(CapitalAccountCompanySetQueryCriteria criteria){
+ return new ResponseEntity<>(capitalAccountCompanySetService.queryAll(criteria),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增年度资金账户(公司流)设定")
+ @ApiOperation("新增年度资金账户(公司流)设定")
+ @PreAuthorize("@el.check('capitalAccountCompanySet:add')")
+ public ResponseEntity<Object> createCapitalAccountCompanySet(@Validated @RequestBody CapitalAccountCompanySet resources){
+ return new ResponseEntity<>(capitalAccountCompanySetService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改年度资金账户(公司流)设定")
+ @ApiOperation("修改年度资金账户(公司流)设定")
+ @PreAuthorize("@el.check('capitalAccountCompanySet:edit')")
+ public ResponseEntity<Object> updateCapitalAccountCompanySet(@Validated @RequestBody CapitalAccountCompanySet resources){
+ capitalAccountCompanySetService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除年度资金账户(公司流)设定")
+ @ApiOperation("删除年度资金账户(公司流)设定")
+ @PreAuthorize("@el.check('capitalAccountCompanySet:del')")
+ public ResponseEntity<Object> deleteCapitalAccountCompanySet(@RequestBody Long[] ids) {
+ capitalAccountCompanySetService.deleteAll(ids);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountCompanySetService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountCompanySetService.java
new file mode 100644
index 0000000..faf3d9f
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/CapitalAccountCompanySetService.java
@@ -0,0 +1,83 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.capital.service;
+
+import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetDto;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import java.util.Map;
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @description 服务接口
+* @author 赵士淞
+* @date 2023-04-12
+**/
+public interface CapitalAccountCompanySetService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(CapitalAccountCompanySetQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<CapitalAccountCompanySetDto>
+ */
+ List<CapitalAccountCompanySetDto> queryAll(CapitalAccountCompanySetQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return CapitalAccountCompanySetDto
+ */
+ CapitalAccountCompanySetDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return CapitalAccountCompanySetDto
+ */
+ CapitalAccountCompanySetDto create(CapitalAccountCompanySet resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(CapitalAccountCompanySet resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<CapitalAccountCompanySetDto> all, HttpServletResponse response) throws IOException;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanySetDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanySetDto.java
new file mode 100644
index 0000000..95fdd89
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanySetDto.java
@@ -0,0 +1,47 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.capital.service.dto;
+
+import lombok.Data;
+import me.zhengjie.base.BaseDTO;
+
+import java.sql.Timestamp;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2023-04-12
+**/
+@Data
+public class CapitalAccountCompanySetDto extends BaseDTO implements Serializable {
+
+ /** ID */
+ private Long id;
+
+ /** 项目区分 */
+ private String projectDistinguish;
+
+ /** 账户类型 */
+ private String accountType;
+
+ /** 账户名称 */
+ private String accountName;
+
+ /** 备注 */
+ private String remarks;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanySetQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanySetQueryCriteria.java
new file mode 100644
index 0000000..a50825c
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/dto/CapitalAccountCompanySetQueryCriteria.java
@@ -0,0 +1,41 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.capital.service.dto;
+
+import lombok.Data;
+import java.util.List;
+import me.zhengjie.annotation.Query;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-04-12
+**/
+@Data
+public class CapitalAccountCompanySetQueryCriteria{
+
+ /** 精确 */
+ @Query
+ private String projectDistinguish;
+
+ /** 精确 */
+ @Query
+ private String accountType;
+
+ /** 模糊 */
+ @Query(type = Query.Type.INNER_LIKE)
+ private String accountName;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountCompanySetServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountCompanySetServiceImpl.java
new file mode 100644
index 0000000..298d31a
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/impl/CapitalAccountCompanySetServiceImpl.java
@@ -0,0 +1,143 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.capital.service.impl;
+
+import me.zhengjie.exception.BadRequestException;
+import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet;
+import me.zhengjie.utils.ValidationUtil;
+import me.zhengjie.utils.FileUtil;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.capital.repository.CapitalAccountCompanySetRepository;
+import me.zhengjie.modules.capital.service.CapitalAccountCompanySetService;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetDto;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetQueryCriteria;
+import me.zhengjie.modules.capital.service.mapstruct.CapitalAccountCompanySetMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import me.zhengjie.utils.PageUtil;
+import me.zhengjie.utils.QueryHelp;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
+/**
+* @website https://eladmin.vip
+* @description 服务实现
+* @author 赵士淞
+* @date 2023-04-12
+**/
+@Service
+@RequiredArgsConstructor
+public class CapitalAccountCompanySetServiceImpl implements CapitalAccountCompanySetService {
+
+ private final CapitalAccountCompanySetRepository capitalAccountCompanySetRepository;
+ private final CapitalAccountCompanySetMapper capitalAccountCompanySetMapper;
+
+ @Override
+ public Map<String,Object> queryAll(CapitalAccountCompanySetQueryCriteria criteria, Pageable pageable){
+ Page<CapitalAccountCompanySet> page = capitalAccountCompanySetRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ return PageUtil.toPage(page.map(capitalAccountCompanySetMapper::toDto));
+ }
+
+ @Override
+ public List<CapitalAccountCompanySetDto> queryAll(CapitalAccountCompanySetQueryCriteria criteria){
+ return capitalAccountCompanySetMapper.toDto(capitalAccountCompanySetRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public CapitalAccountCompanySetDto findById(Long id) {
+ CapitalAccountCompanySet capitalAccountCompanySet = capitalAccountCompanySetRepository.findById(id).orElseGet(CapitalAccountCompanySet::new);
+ ValidationUtil.isNull(capitalAccountCompanySet.getId(),"CapitalAccountCompanySet","id",id);
+ return capitalAccountCompanySetMapper.toDto(capitalAccountCompanySet);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public CapitalAccountCompanySetDto create(CapitalAccountCompanySet resources) {
+ // 拷贝后校验
+ copyAfterCheck(resources);
+ return capitalAccountCompanySetMapper.toDto(capitalAccountCompanySetRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(CapitalAccountCompanySet resources) {
+ CapitalAccountCompanySet capitalAccountCompanySet = capitalAccountCompanySetRepository.findById(resources.getId()).orElseGet(CapitalAccountCompanySet::new);
+ ValidationUtil.isNull( capitalAccountCompanySet.getId(),"CapitalAccountCompanySet","id",resources.getId());
+ capitalAccountCompanySet.copy(resources);
+ // 拷贝后校验
+ copyAfterCheck(capitalAccountCompanySet);
+ capitalAccountCompanySetRepository.save(capitalAccountCompanySet);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ capitalAccountCompanySetRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<CapitalAccountCompanySetDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (CapitalAccountCompanySetDto capitalAccountCompanySet : all) {
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("项目区分", capitalAccountCompanySet.getProjectDistinguish());
+ map.put("账户类型", capitalAccountCompanySet.getAccountType());
+ map.put("账户名称", capitalAccountCompanySet.getAccountName());
+ map.put("备注", capitalAccountCompanySet.getRemarks());
+ map.put("创建者", capitalAccountCompanySet.getCreateBy());
+ map.put("创建时间", capitalAccountCompanySet.getCreateTime());
+ map.put("更新者", capitalAccountCompanySet.getUpdateBy());
+ map.put("更新时间", capitalAccountCompanySet.getUpdateTime());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+
+ /**
+ * 拷贝后校验
+ * @param resources
+ */
+ private void copyAfterCheck(CapitalAccountCompanySet resources) {
+ // 根据项目区分查询
+ List<CapitalAccountCompanySet> projectDistinguishCapitalAccountCompanySetList = capitalAccountCompanySetRepository.findByProjectDistinguish(resources.getProjectDistinguish());
+ // 判断结果集长度
+ if (projectDistinguishCapitalAccountCompanySetList.size() > 1) {
+ throw new BadRequestException("每个项目区分只能设置一个账户!");
+ } else if (projectDistinguishCapitalAccountCompanySetList.size() == 1) {
+ if (resources.getId() == null || projectDistinguishCapitalAccountCompanySetList.get(0).getId().longValue() != resources.getId().longValue()) {
+ throw new BadRequestException("每个项目区分只能设置一个账户!");
+ }
+ }
+ // 根据账户类型查询
+ List<CapitalAccountCompanySet> accountTypeCapitalAccountCompanySetList = capitalAccountCompanySetRepository.findByAccountType(resources.getAccountType());
+ // 判断结果集长度
+ if (accountTypeCapitalAccountCompanySetList.size() > 1) {
+ throw new BadRequestException("每个账户类型只能设置一个账户!");
+ } else if (accountTypeCapitalAccountCompanySetList.size() == 1) {
+ if (resources.getId() == null || accountTypeCapitalAccountCompanySetList.get(0).getId().longValue() != resources.getId().longValue()) {
+ throw new BadRequestException("每个账户类型只能设置一个账户!");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountCompanySetMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountCompanySetMapper.java
new file mode 100644
index 0000000..1eed831
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/capital/service/mapstruct/CapitalAccountCompanySetMapper.java
@@ -0,0 +1,32 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.capital.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.capital.domain.CapitalAccountCompanySet;
+import me.zhengjie.modules.capital.service.dto.CapitalAccountCompanySetDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2023-04-12
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface CapitalAccountCompanySetMapper extends BaseMapper<CapitalAccountCompanySetDto, CapitalAccountCompanySet> {
+
+}
\ No newline at end of file
diff --git a/eladmin-web-master/src/api/capital/accountCompanySet.js b/eladmin-web-master/src/api/capital/accountCompanySet.js
new file mode 100644
index 0000000..f27e6f3
--- /dev/null
+++ b/eladmin-web-master/src/api/capital/accountCompanySet.js
@@ -0,0 +1,35 @@
+import request from '@/utils/request'
+
+export function getAll(params) {
+ return request({
+ url: 'api/capitalAccountCompanySet/all',
+ method: 'get',
+ params
+ })
+}
+
+export function add(data) {
+ return request({
+ url: 'api/capitalAccountCompanySet',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/capitalAccountCompanySet/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/capitalAccountCompanySet',
+ method: 'put',
+ data
+ })
+}
+
+export default { getAll, add, edit, del }
diff --git a/eladmin-web-master/src/views/capital/accountCompanySet/index.vue b/eladmin-web-master/src/views/capital/accountCompanySet/index.vue
new file mode 100644
index 0000000..d773c0b
--- /dev/null
+++ b/eladmin-web-master/src/views/capital/accountCompanySet/index.vue
@@ -0,0 +1,154 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <div class="head-container">
+ <div v-if="crud.props.searchToggle">
+ <!-- 搜索 -->
+ <el-select v-model="query.projectDistinguish" filterable clearable placeholder="项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+ <el-option
+ v-for="item in dict[projectDistinguish]"
+ :key="item.id"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ <el-select v-model="query.accountType" filterable clearable placeholder="账户类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+ <el-option
+ v-for="item in dict[accountType]"
+ :key="item.id"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ <el-input v-model="query.accountName" clearable placeholder="账户名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
+ <rrOperation :crud="crud" />
+ </div>
+ <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
+ <crudOperation :permission="permission" />
+ <!--表单组件-->
+ <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
+ <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
+ <el-form-item label="项目区分" prop="projectDistinguish">
+ <el-select v-model="form.projectDistinguish" filterable placeholder="请选择" style="width: 370px;">
+ <el-option
+ v-for="item in dict[projectDistinguish]"
+ :key="item.id"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="账户类型" prop="accountType">
+ <el-select v-model="form.accountType" filterable placeholder="请选择" style="width: 370px;">
+ <el-option
+ v-for="item in dict[accountType]"
+ :key="item.id"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="账户名称" prop="accountName">
+ <el-input v-model="form.accountName" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="备注">
+ <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 370px;" />
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="text" @click="crud.cancelCU">取消</el-button>
+ <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
+ </div>
+ </el-dialog>
+ <!--表格渲染-->
+ <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
+ <el-table-column type="selection" width="55" />
+ <el-table-column :show-overflow-tooltip="true" prop="projectDistinguish" label="项目区分">
+ <template slot-scope="scope">
+ <el-tag>{{ dict.label[projectDistinguish][scope.row.projectDistinguish] }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="accountType" label="账户类型">
+ <template slot-scope="scope">
+ {{ dict.label[accountType][scope.row.accountType] }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="accountName" label="账户名称" />
+ <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" />
+ <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" />
+ <el-table-column v-if="checkPer(['admin','capitalAccountCompanySet:edit','capitalAccountCompanySet:del'])" label="操作" width="150px" align="center">
+ <template slot-scope="scope">
+ <udOperation
+ :data="scope.row"
+ :permission="permission"
+ />
+ </template>
+ </el-table-column>
+ </el-table>
+ <!--分页组件-->
+ <pagination />
+ </div>
+ </div>
+</template>
+
+<script>
+import crudCapitalAccountCompanySet from '@/api/capital/accountCompanySet'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import rrOperation from '@crud/RR.operation'
+import crudOperation from '@crud/CRUD.operation'
+import udOperation from '@crud/UD.operation'
+import pagination from '@crud/Pagination'
+import constant from '../../../utils/constant'
+
+const defaultForm = { id: null, projectDistinguish: null, accountType: null, accountName: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
+export default {
+ name: 'CapitalAccountCompanySet',
+ components: { pagination, crudOperation, rrOperation, udOperation },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ dicts: [constant.PROJECT_DISTINGUISH, constant.ACCOUNT_TYPE],
+ cruds() {
+ return CRUD({ title: '年度资金账户(公司流)设定', url: 'api/capitalAccountCompanySet', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCapitalAccountCompanySet }})
+ },
+ data() {
+ return {
+ permission: {
+ add: ['admin', 'capitalAccountCompanySet:add'],
+ edit: ['admin', 'capitalAccountCompanySet:edit'],
+ del: ['admin', 'capitalAccountCompanySet:del'],
+ download: ['admin', 'capitalAccountCompanySet:download']
+ },
+ rules: {
+ projectDistinguish: [
+ { required: true, message: '项目区分不能为空', trigger: 'change' }
+ ],
+ accountType: [
+ { required: true, message: '账户类型不能为空', trigger: 'change' }
+ ],
+ accountName: [
+ { required: true, message: '账户名称不能为空', trigger: 'blur' },
+ { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
+ ]
+ },
+ queryTypeOptions: [
+ { key: 'projectDistinguish', display_name: '项目区分' },
+ { key: 'accountType', display_name: '账户类型' },
+ { key: 'accountName', display_name: '账户名称' }
+ ],
+ // 字典:项目区分
+ projectDistinguish: constant.PROJECT_DISTINGUISH,
+ // 字典:账户类型
+ accountType: constant.ACCOUNT_TYPE
+ }
+ },
+ methods: {
+ // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+ [CRUD.HOOK.beforeRefresh]() {
+ return true
+ }
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
--
Gitblit v1.9.3