From 80ebfe6bf09e13afba341f54e18341deb2b3313f Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Mon, 11 Mar 2024 12:59:39 +0800 Subject: [PATCH] '123' --- .../java/com/ruoyi/web/Utils/DataDBUtils.java | 8 +- .../java/com/ruoyi/web/Utils/batchInsert.java | 26 +- .../sapAccount/SapAccountController.java | 104 ++++++ .../controller/system/SysUserController.java | 5 - .../src/main/resources/application.yml | 5 + .../generator/controller/GenController.java | 2 +- .../ruoyi/sapAccount/domain/SapAccount.java | 107 ++++++ .../sapAccount/mapper/SapAccountMapper.java | 61 ++++ .../service/ISapAccountService.java | 61 ++++ .../service/impl/SapAccountServiceImpl.java | 93 +++++ .../mapper/sapAccount/SapAccountMapper.xml | 76 ++++ ruoyi-ui/src/api/sapAccount/sapAccount.js | 44 +++ .../src/views/sapAccount/sapAccount/index.vue | 330 ++++++++++++++++++ 13 files changed, 906 insertions(+), 16 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/sapAccount/SapAccountController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/sapAccount/domain/SapAccount.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/sapAccount/mapper/SapAccountMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/sapAccount/service/ISapAccountService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/sapAccount/service/impl/SapAccountServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/sapAccount/SapAccountMapper.xml create mode 100644 ruoyi-ui/src/api/sapAccount/sapAccount.js create mode 100644 ruoyi-ui/src/views/sapAccount/sapAccount/index.vue diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/DataDBUtils.java b/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/DataDBUtils.java index cc398ba..e84ad4c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/DataDBUtils.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/DataDBUtils.java @@ -1,3 +1,4 @@ +/* package com.ruoyi.web.Utils; import com.mchange.v2.c3p0.ComboPooledDataSource; @@ -6,12 +7,14 @@ import javax.sql.DataSource; import java.beans.PropertyVetoException; import java.sql.Connection; +*/ /** - * 物流系统数据库操作 + * 数据库操作 * * @author Administrator * - */ + *//* + public class DataDBUtils { private static DataSource ds; @@ -57,3 +60,4 @@ public class DataDBUtils { return con; } } +*/ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/batchInsert.java b/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/batchInsert.java index fc4fddc..b72522c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/batchInsert.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/Utils/batchInsert.java @@ -1,3 +1,4 @@ +/* package com.ruoyi.web.Utils; import com.ruoyi.system.domain.cost; @@ -13,9 +14,11 @@ public class batchInsert extends JFrame { public static PreparedStatement stmt; public static ResultSet rs; - /** + */ +/** * 对数据库进行批量插入数据操作 执行次数100万 - */ + *//* + public static void insertMaterialBatch(List list) throws Exception { // 思路:将100万条数据分成n等份,1等份为1000条数据 // 如何实现? @@ -23,8 +26,10 @@ public class batchInsert extends JFrame { // 2、利用Statement接口中的如下三个方法:addBatch、clearBath、executeBatch conn = DataDBUtils.getConnection(); conn.setAutoCommit(false); - /*stmt = conn.prepareStatement( - "insert into [dbo].[sapcontract_test](uid,bh,type,custom,salesman,project,htje,startdate,enddate,remark,htzt) values (?,?,?,?,?,?,?,?,?,?,?)");*/ + */ +/*stmt = conn.prepareStatement( + "insert into [dbo].[sapcontract_test](uid,bh,type,custom,salesman,project,htje,startdate,enddate,remark,htzt) values (?,?,?,?,?,?,?,?,?,?,?)");*//* + stmt = conn.prepareStatement( "insert into c_material(material_id, material_xingh, material_guig, material_diany, material_dw,material_type_id) values (?,?,?,?,?,?)"); int count = 0; @@ -52,9 +57,11 @@ public class batchInsert extends JFrame { } - /** + */ +/** * 对数据库进行批量插入数据操作 执行次数100万 - */ + *//* + public static void insertCostBatch(List list) throws Exception { // 思路:将100万条数据分成n等份,1等份为1000条数据 // 如何实现? @@ -62,8 +69,10 @@ public class batchInsert extends JFrame { // 2、利用Statement接口中的如下三个方法:addBatch、clearBath、executeBatch conn = DataDBUtils.getConnection(); conn.setAutoCommit(false); - /*stmt = conn.prepareStatement( - "insert into [dbo].[sapcontract_test](uid,bh,type,custom,salesman,project,htje,startdate,enddate,remark,htzt) values (?,?,?,?,?,?,?,?,?,?,?)");*/ + */ +/*stmt = conn.prepareStatement( + "insert into [dbo].[sapcontract_test](uid,bh,type,custom,salesman,project,htje,startdate,enddate,remark,htzt) values (?,?,?,?,?,?,?,?,?,?,?)");*//* + stmt = conn.prepareStatement( "insert into c_material_cost(cost_id, cost_material_id, cost_cl_id, cost_cl_qty, cost_cl_qty_2) values (?,?,?,?,?)"); int count = 0; @@ -106,3 +115,4 @@ public class batchInsert extends JFrame { } } +*/ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sapAccount/SapAccountController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sapAccount/SapAccountController.java new file mode 100644 index 0000000..1353fbf --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sapAccount/SapAccountController.java @@ -0,0 +1,104 @@ +package com.ruoyi.web.controller.sapAccount; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.sapAccount.domain.SapAccount; +import com.ruoyi.sapAccount.service.ISapAccountService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 业务账户Controller + * + * @author ruoyi + * @date 2024-03-11 + */ +@RestController +@RequestMapping("/sapAccount/sapAccount") +public class SapAccountController extends BaseController +{ + @Autowired + private ISapAccountService sapAccountService; + + /** + * 查询业务账户列表 + */ + @PreAuthorize("@ss.hasPermi('sapAccount:sapAccount:list')") + @GetMapping("/list") + public TableDataInfo list(SapAccount sapAccount) + { + startPage(); + List list = sapAccountService.selectSapAccountList(sapAccount); + return getDataTable(list); + } + + /** + * 导出业务账户列表 + */ + @PreAuthorize("@ss.hasPermi('sapAccount:sapAccount:export')") + @Log(title = "业务账户", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SapAccount sapAccount) + { + List list = sapAccountService.selectSapAccountList(sapAccount); + ExcelUtil util = new ExcelUtil(SapAccount.class); + util.exportExcel(response, list, "业务账户数据"); + } + + /** + * 获取业务账户详细信息 + */ + @PreAuthorize("@ss.hasPermi('sapAccount:sapAccount:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sapAccountService.selectSapAccountById(id)); + } + + /** + * 新增业务账户 + */ + @PreAuthorize("@ss.hasPermi('sapAccount:sapAccount:add')") + @Log(title = "业务账户", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SapAccount sapAccount) + { + return toAjax(sapAccountService.insertSapAccount(sapAccount)); + } + + /** + * 修改业务账户 + */ + @PreAuthorize("@ss.hasPermi('sapAccount:sapAccount:edit')") + @Log(title = "业务账户", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SapAccount sapAccount) + { + return toAjax(sapAccountService.updateSapAccount(sapAccount)); + } + + /** + * 删除业务账户 + */ + @PreAuthorize("@ss.hasPermi('sapAccount:sapAccount:remove')") + @Log(title = "业务账户", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sapAccountService.deleteSapAccountByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 32e158e..d8d3dce 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -1,22 +1,17 @@ package com.ruoyi.web.controller.system; -import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; - import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.system.domain.cost; import com.ruoyi.system.domain.material; -import com.ruoyi.system.domain.temp; import com.ruoyi.system.service.*; -import com.ruoyi.web.Utils.batchInsert; -import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index eb462b3..03d13e3 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -179,7 +179,12 @@ magic-api: username: admin password: magic-api.S web: /magic/web + show-sql: true #配置打印SQL show-url: false + response-code: + success: 200 #执行成功的code值 + invalid: 400 #参数验证未通过的code值 + exception: 500 #执行出现异常的code值 #存储设置 resource: type: database # 配置接口存储方式,这里选择存在数据库中 diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 78036b4..b08acb3 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -38,7 +38,7 @@ import com.ruoyi.generator.service.IGenTableService; */ @RestController @RequestMapping("/tool/gen") -@DataSource(value = DataSourceType.QUOT) +/*@DataSource(value = DataSourceType.QUOT)*/ public class GenController extends BaseController { @Autowired diff --git a/ruoyi-system/src/main/java/com/ruoyi/sapAccount/domain/SapAccount.java b/ruoyi-system/src/main/java/com/ruoyi/sapAccount/domain/SapAccount.java new file mode 100644 index 0000000..4638dec --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/sapAccount/domain/SapAccount.java @@ -0,0 +1,107 @@ +package com.ruoyi.sapAccount.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 业务账户对象 sap_account + * + * @author ruoyi + * @date 2024-03-11 + */ +public class SapAccount extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** */ + private Long id; + + /** 账号 */ + @Excel(name = "账号") + private String userName; + + /** 姓名 */ + @Excel(name = "姓名") + private String nickName; + + /** 账户 */ + @Excel(name = "账户") + private String sapBm; + + /** 账户名 */ + @Excel(name = "账户名") + private String sapName; + + /** 片区 */ + @Excel(name = "片区") + private String sapArea; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserName() + { + return userName; + } + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + public String getNickName() + { + return nickName; + } + public void setSapBm(String sapBm) + { + this.sapBm = sapBm; + } + + public String getSapBm() + { + return sapBm; + } + public void setSapName(String sapName) + { + this.sapName = sapName; + } + + public String getSapName() + { + return sapName; + } + public void setSapArea(String sapArea) + { + this.sapArea = sapArea; + } + + public String getSapArea() + { + return sapArea; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("userName", getUserName()) + .append("nickName", getNickName()) + .append("sapBm", getSapBm()) + .append("sapName", getSapName()) + .append("sapArea", getSapArea()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/sapAccount/mapper/SapAccountMapper.java b/ruoyi-system/src/main/java/com/ruoyi/sapAccount/mapper/SapAccountMapper.java new file mode 100644 index 0000000..8f453c4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/sapAccount/mapper/SapAccountMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.sapAccount.mapper; + +import java.util.List; +import com.ruoyi.sapAccount.domain.SapAccount; + +/** + * 业务账户Mapper接口 + * + * @author ruoyi + * @date 2024-03-11 + */ +public interface SapAccountMapper +{ + /** + * 查询业务账户 + * + * @param id 业务账户主键 + * @return 业务账户 + */ + public SapAccount selectSapAccountById(Long id); + + /** + * 查询业务账户列表 + * + * @param sapAccount 业务账户 + * @return 业务账户集合 + */ + public List selectSapAccountList(SapAccount sapAccount); + + /** + * 新增业务账户 + * + * @param sapAccount 业务账户 + * @return 结果 + */ + public int insertSapAccount(SapAccount sapAccount); + + /** + * 修改业务账户 + * + * @param sapAccount 业务账户 + * @return 结果 + */ + public int updateSapAccount(SapAccount sapAccount); + + /** + * 删除业务账户 + * + * @param id 业务账户主键 + * @return 结果 + */ + public int deleteSapAccountById(Long id); + + /** + * 批量删除业务账户 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSapAccountByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/sapAccount/service/ISapAccountService.java b/ruoyi-system/src/main/java/com/ruoyi/sapAccount/service/ISapAccountService.java new file mode 100644 index 0000000..ad86b17 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/sapAccount/service/ISapAccountService.java @@ -0,0 +1,61 @@ +package com.ruoyi.sapAccount.service; + +import java.util.List; +import com.ruoyi.sapAccount.domain.SapAccount; + +/** + * 业务账户Service接口 + * + * @author ruoyi + * @date 2024-03-11 + */ +public interface ISapAccountService +{ + /** + * 查询业务账户 + * + * @param id 业务账户主键 + * @return 业务账户 + */ + public SapAccount selectSapAccountById(Long id); + + /** + * 查询业务账户列表 + * + * @param sapAccount 业务账户 + * @return 业务账户集合 + */ + public List selectSapAccountList(SapAccount sapAccount); + + /** + * 新增业务账户 + * + * @param sapAccount 业务账户 + * @return 结果 + */ + public int insertSapAccount(SapAccount sapAccount); + + /** + * 修改业务账户 + * + * @param sapAccount 业务账户 + * @return 结果 + */ + public int updateSapAccount(SapAccount sapAccount); + + /** + * 批量删除业务账户 + * + * @param ids 需要删除的业务账户主键集合 + * @return 结果 + */ + public int deleteSapAccountByIds(Long[] ids); + + /** + * 删除业务账户信息 + * + * @param id 业务账户主键 + * @return 结果 + */ + public int deleteSapAccountById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/sapAccount/service/impl/SapAccountServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/sapAccount/service/impl/SapAccountServiceImpl.java new file mode 100644 index 0000000..9b58406 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/sapAccount/service/impl/SapAccountServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.sapAccount.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.sapAccount.mapper.SapAccountMapper; +import com.ruoyi.sapAccount.domain.SapAccount; +import com.ruoyi.sapAccount.service.ISapAccountService; + +/** + * 业务账户Service业务层处理 + * + * @author ruoyi + * @date 2024-03-11 + */ +@Service +public class SapAccountServiceImpl implements ISapAccountService +{ + @Autowired + private SapAccountMapper sapAccountMapper; + + /** + * 查询业务账户 + * + * @param id 业务账户主键 + * @return 业务账户 + */ + @Override + public SapAccount selectSapAccountById(Long id) + { + return sapAccountMapper.selectSapAccountById(id); + } + + /** + * 查询业务账户列表 + * + * @param sapAccount 业务账户 + * @return 业务账户 + */ + @Override + public List selectSapAccountList(SapAccount sapAccount) + { + return sapAccountMapper.selectSapAccountList(sapAccount); + } + + /** + * 新增业务账户 + * + * @param sapAccount 业务账户 + * @return 结果 + */ + @Override + public int insertSapAccount(SapAccount sapAccount) + { + return sapAccountMapper.insertSapAccount(sapAccount); + } + + /** + * 修改业务账户 + * + * @param sapAccount 业务账户 + * @return 结果 + */ + @Override + public int updateSapAccount(SapAccount sapAccount) + { + return sapAccountMapper.updateSapAccount(sapAccount); + } + + /** + * 批量删除业务账户 + * + * @param ids 需要删除的业务账户主键 + * @return 结果 + */ + @Override + public int deleteSapAccountByIds(Long[] ids) + { + return sapAccountMapper.deleteSapAccountByIds(ids); + } + + /** + * 删除业务账户信息 + * + * @param id 业务账户主键 + * @return 结果 + */ + @Override + public int deleteSapAccountById(Long id) + { + return sapAccountMapper.deleteSapAccountById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/sapAccount/SapAccountMapper.xml b/ruoyi-system/src/main/resources/mapper/sapAccount/SapAccountMapper.xml new file mode 100644 index 0000000..f55cc61 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/sapAccount/SapAccountMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + select id, user_name, nick_name, sap_bm, sap_name, sap_area from sap_account + + + + + + + + insert into sap_account + + user_name, + nick_name, + sap_bm, + sap_name, + sap_area, + + + #{userName}, + #{nickName}, + #{sapBm}, + #{sapName}, + #{sapArea}, + + + + + update sap_account + + user_name = #{userName}, + nick_name = #{nickName}, + sap_bm = #{sapBm}, + sap_name = #{sapName}, + sap_area = #{sapArea}, + + where id = #{id} + + + + delete from sap_account where id = #{id} + + + + delete from sap_account where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/sapAccount/sapAccount.js b/ruoyi-ui/src/api/sapAccount/sapAccount.js new file mode 100644 index 0000000..e38d1f9 --- /dev/null +++ b/ruoyi-ui/src/api/sapAccount/sapAccount.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询业务账户列表 +export function listSapAccount(query) { + return request({ + url: '/sapAccount/sapAccount/list', + method: 'get', + params: query + }) +} + +// 查询业务账户详细 +export function getSapAccount(id) { + return request({ + url: '/sapAccount/sapAccount/' + id, + method: 'get' + }) +} + +// 新增业务账户 +export function addSapAccount(data) { + return request({ + url: '/sapAccount/sapAccount', + method: 'post', + data: data + }) +} + +// 修改业务账户 +export function updateSapAccount(data) { + return request({ + url: '/sapAccount/sapAccount', + method: 'put', + data: data + }) +} + +// 删除业务账户 +export function delSapAccount(id) { + return request({ + url: '/sapAccount/sapAccount/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/views/sapAccount/sapAccount/index.vue b/ruoyi-ui/src/views/sapAccount/sapAccount/index.vue new file mode 100644 index 0000000..4190337 --- /dev/null +++ b/ruoyi-ui/src/views/sapAccount/sapAccount/index.vue @@ -0,0 +1,330 @@ + + +