From e9807ad8a8afeca5f269090600e3ca847bce4c18 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 9 Aug 2024 17:26:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/base/BonusBaseApplication.java | 6 ++++ .../controller/BmAgreementController.java | 2 +- .../controller/BmCustomerTypeController.java | 16 ++++----- .../base/controller/BmProjectController.java | 20 +++++++++++ .../com/bonus/base/domain/BmAgreement.java | 5 ++- .../bonus/base/mapper/BmProjectMapper.java | 4 +++ .../base/service/BmAgreementService.java | 32 +++++++++-------- .../base/service/BmCustomerTypeService.java | 2 ++ .../bonus/base/service/BmProjectService.java | 8 +++++ .../src/main/resources/bootstrap.yml | 6 ++-- .../resources/mapper/BmAgreementMapper.xml | 36 +++++-------------- .../main/resources/mapper/BmProjectMapper.xml | 10 +++++- 12 files changed, 89 insertions(+), 58 deletions(-) diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/BonusBaseApplication.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/BonusBaseApplication.java index dc11068..0312c1c 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/BonusBaseApplication.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/BonusBaseApplication.java @@ -1,9 +1,13 @@ package com.bonus.base; +import com.bonus.common.security.annotation.EnableCustomConfig; +import com.bonus.common.security.annotation.EnableRyFeignClients; import com.bonus.common.swagger.annotation.EnableCustomSwagger2; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.Configuration; /** * @author : 阮世耀 @@ -13,7 +17,9 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; * @Description: Base基础模块启动类 */ +@EnableCustomConfig @EnableCustomSwagger2 +@EnableRyFeignClients @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) public class BonusBaseApplication { public static void main(String[] args) { diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmAgreementController.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmAgreementController.java index da5fe6e..788c1bd 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmAgreementController.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmAgreementController.java @@ -41,7 +41,7 @@ public class BmAgreementController { @PostMapping(value = "/add") public ResultBean add(BmAgreement bmAgreement) { int result = this.bmAgreementService.insertSelective(bmAgreement); - return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "删除0条"); + return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "删除失败"); } /** diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmCustomerTypeController.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmCustomerTypeController.java index 67ec1a4..c2806c3 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmCustomerTypeController.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmCustomerTypeController.java @@ -19,7 +19,7 @@ import java.util.List; * @author 阮世耀 */ @RestController -@RequestMapping("/bm_customer_type") +@RequestMapping("/unittype") public class BmCustomerTypeController extends BaseController { /** @@ -28,8 +28,8 @@ public class BmCustomerTypeController extends BaseController { @Autowired private BmCustomerTypeService bmCustomerTypeService; - @RequiresPermissions("system:customerType:list") - @GetMapping("/list") +// @RequiresPermissions("base:customerType:query") + @GetMapping("/getUnitTypeList") @SysLog(title = "往来单位类型", businessType = OperaType.QUERY, logType = 1, module = "往来单位类型->分页查询", details = "往来单位类型列表") public TableDataInfo list(BmCustomerType bmCustomerType) { startPage(); @@ -44,7 +44,7 @@ public class BmCustomerTypeController extends BaseController { * @return 单条数据 */ @GetMapping("{id}") - @RequiresPermissions("system:customerType:list") + @RequiresPermissions("base:customerType:query") public ResultBean queryById(@PathVariable("id") Integer id) { return ResultBean.success(this.bmCustomerTypeService.selectByPrimaryKey(id)); } @@ -56,7 +56,7 @@ public class BmCustomerTypeController extends BaseController { * @return 新增结果 */ @PostMapping(value = "/add") - @RequiresPermissions("system:customerType:add") + @RequiresPermissions("base:customerType:add") public ResultBean add(BmCustomerType bmCustomerType) { this.bmCustomerTypeService.insertSelective(bmCustomerType); return ResultBean.success(true); @@ -69,7 +69,7 @@ public class BmCustomerTypeController extends BaseController { * @return 编辑结果 */ @PutMapping(value = "/update") - @RequiresPermissions("system:customerType:update") + @RequiresPermissions("base:customerType:edit") public ResultBean edit(BmCustomerType bmCustomerType) { this.bmCustomerTypeService.updateByPrimaryKeySelective(bmCustomerType); return ResultBean.success(true); @@ -81,8 +81,8 @@ public class BmCustomerTypeController extends BaseController { * @param id 主键 * @return 删除是否成功 */ - @PostMapping(value = "/delete/{id}") - @RequiresPermissions("system:customerType:delete") + @PostMapping(value = "/del/{id}") + @RequiresPermissions("base:customerType:remove") public ResultBean deleteById(@PathVariable("id") Integer id) { this.bmCustomerTypeService.deleteByPrimaryKey(id); return ResultBean.success(true); diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmProjectController.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmProjectController.java index 9f7892d..165fe7c 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmProjectController.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmProjectController.java @@ -1,12 +1,17 @@ package com.bonus.base.controller; +import com.bonus.base.domain.BmCustomerType; import com.bonus.base.domain.BmProject; import com.bonus.base.service.BmProjectService; import com.bonus.base.utils.ResultBean; import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.page.TableDataInfo; +import com.bonus.common.security.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; + /** * 工程项目管理(bm_project)表控制层 * @@ -22,6 +27,21 @@ public class BmProjectController extends BaseController { @Autowired private BmProjectService bmProjectService; + + /** + * 分页查询 + * @param bmCustomerType 请求条件 + * @return 工程列表 + */ + @GetMapping("/getProjectList") + @RequiresPermissions("base:project:query") + public TableDataInfo list(BmProject bmCustomerType) { + startPage(); + List list = bmProjectService.selectAll(); + return getDataTable(list); + } + + /** * 通过主键查询单条数据 * diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmAgreement.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmAgreement.java index 1244808..b201a17 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmAgreement.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmAgreement.java @@ -1,5 +1,6 @@ package com.bonus.base.domain; +import com.bonus.common.core.web.domain.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; @@ -16,9 +17,7 @@ import lombok.Data; @ApiModel(description="协议管理") @Data -public class BmAgreement implements Serializable { - - private static final long serialVersionUID = 1L; +public class BmAgreement extends BaseEntity implements Serializable { @ApiModelProperty(value="") private Integer id; diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmProjectMapper.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmProjectMapper.java index 7e16a5d..3a218c7 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmProjectMapper.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmProjectMapper.java @@ -3,6 +3,8 @@ package com.bonus.base.mapper; import com.bonus.base.domain.BmProject; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** *@PackagePath: com.bonus.base *@author : 阮世耀 @@ -44,6 +46,8 @@ public interface BmProjectMapper { */ BmProject selectByPrimaryKey(Integer id); + List selectAll(); + /** * update record selective * @param record the updated record diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmAgreementService.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmAgreementService.java index 5b35860..be1a323 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmAgreementService.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmAgreementService.java @@ -1,60 +1,64 @@ package com.bonus.base.service; +import com.baomidou.dynamic.datasource.annotation.DS; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import com.bonus.base.domain.BmAgreement; import com.bonus.base.mapper.BmAgreementMapper; + +import javax.annotation.Resource; + /** - *@PackagePath: com.bonus.base - *@author : 阮世耀 - *@CreateTime: 2024-08-09 10:33 - *@Description: 描述 - *@version : 1.0 + * @PackagePath: com.bonus.base + * @author : 阮世耀 + * @CreateTime: 2024-08-09 10:33 + * @Description: 描述 + * @version : 1.0 */ @Service +@DS("master") public class BmAgreementService{ - @Autowired + @Resource private BmAgreementMapper bmAgreementMapper; - public int deleteByPrimaryKey(Integer id) { return bmAgreementMapper.deleteByPrimaryKey(id); } - + public int insert(BmAgreement record) { return bmAgreementMapper.insert(record); } - + public int insertOrUpdate(BmAgreement record) { return bmAgreementMapper.insertOrUpdate(record); } - + public int insertOrUpdateSelective(BmAgreement record) { return bmAgreementMapper.insertOrUpdateSelective(record); } - + public int insertSelective(BmAgreement record) { return bmAgreementMapper.insertSelective(record); } - + public BmAgreement selectByPrimaryKey(Integer id) { return bmAgreementMapper.selectByPrimaryKey(id); } - + public int updateByPrimaryKeySelective(BmAgreement record) { return bmAgreementMapper.updateByPrimaryKeySelective(record); } - + public int updateByPrimaryKey(BmAgreement record) { return bmAgreementMapper.updateByPrimaryKey(record); } diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmCustomerTypeService.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmCustomerTypeService.java index 0ed7e3f..ce3442b 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmCustomerTypeService.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmCustomerTypeService.java @@ -1,5 +1,6 @@ package com.bonus.base.service; +import com.baomidou.dynamic.datasource.annotation.DS; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; @@ -15,6 +16,7 @@ import com.bonus.base.mapper.BmCustomerTypeMapper; * @version : 1.0 */ @Service +@DS("master") public class BmCustomerTypeService{ @Autowired diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmProjectService.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmProjectService.java index 0e8afd2..d638fe9 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmProjectService.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmProjectService.java @@ -1,5 +1,6 @@ package com.bonus.base.service; +import com.baomidou.dynamic.datasource.annotation.DS; import com.bonus.base.mapper.BmProjectMapper; import org.springframework.stereotype.Service; @@ -7,6 +8,8 @@ import org.springframework.beans.factory.annotation.Autowired; import com.bonus.base.domain.BmProject; +import java.util.List; + /** *@PackagePath: com.bonus.base *@author : 阮世耀 @@ -15,11 +18,16 @@ import com.bonus.base.domain.BmProject; *@version : 1.0 */ @Service +@DS("master") public class BmProjectService{ @Autowired private BmProjectMapper bmProjectMapper; + public List selectAll() { + return bmProjectMapper.selectAll(); + } + public int deleteByPrimaryKey(Integer id) { return bmProjectMapper.deleteByPrimaryKey(id); } diff --git a/bonus-modules/bonus-base/src/main/resources/bootstrap.yml b/bonus-modules/bonus-base/src/main/resources/bootstrap.yml index 9783640..e1c20e9 100644 --- a/bonus-modules/bonus-base/src/main/resources/bootstrap.yml +++ b/bonus-modules/bonus-base/src/main/resources/bootstrap.yml @@ -19,13 +19,13 @@ spring: discovery: # 服务注册地址 server-addr: 192.168.0.56:8848 - namespace: 9cde1ce1-98bc-4b9c-9213-f1fbf8a5b3cc + namespace: 693e01a9-1dc4-4858-b1ae-439da3d35f66 config: # 配置中心地址 server-addr: 192.168.0.56:8848 - namespace: 9cde1ce1-98bc-4b9c-9213-f1fbf8a5b3cc + namespace: 693e01a9-1dc4-4858-b1ae-439da3d35f66 # 配置文件格式 file-extension: yml # 共享配置 shared-configs: - - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} \ No newline at end of file diff --git a/bonus-modules/bonus-base/src/main/resources/mapper/BmAgreementMapper.xml b/bonus-modules/bonus-base/src/main/resources/mapper/BmAgreementMapper.xml index cef0c16..db96aea 100644 --- a/bonus-modules/bonus-base/src/main/resources/mapper/BmAgreementMapper.xml +++ b/bonus-modules/bonus-base/src/main/resources/mapper/BmAgreementMapper.xml @@ -7,7 +7,6 @@ - @@ -27,7 +26,7 @@ - id, code, sign_date, lease_company, project, start_time, lease_term, advance_charge, + id, code, sign_date, project, start_time, lease_term, advance_charge, authorizing_person, authorizing_phone, contract_number, creator, create_time, remark, settlement_time, is_balance, url, is_sure, company_id, is_push @@ -45,15 +44,14 @@ - insert into bm_agreement (id, code, sign_date, - lease_company, project, start_time, + insert into bm_agreement (id, code, sign_date, project, start_time, lease_term, advance_charge, authorizing_person, authorizing_phone, contract_number, creator, create_time, remark, settlement_time, is_balance, url, is_sure, company_id, is_push) values (#{id,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{signDate,jdbcType=VARCHAR}, - #{leaseCompany,jdbcType=INTEGER}, #{project,jdbcType=INTEGER}, #{startTime,jdbcType=VARCHAR}, + #{project,jdbcType=INTEGER}, #{startTime,jdbcType=VARCHAR}, #{leaseTerm,jdbcType=VARCHAR}, #{advanceCharge,jdbcType=VARCHAR}, #{authorizingPerson,jdbcType=VARCHAR}, #{authorizingPhone,jdbcType=VARCHAR}, #{contractNumber,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{settlementTime,jdbcType=VARCHAR}, @@ -73,9 +71,7 @@ sign_date, - - lease_company, - + project, @@ -135,9 +131,6 @@ #{signDate,jdbcType=VARCHAR}, - - #{leaseCompany,jdbcType=INTEGER}, - #{project,jdbcType=INTEGER}, @@ -198,9 +191,6 @@ sign_date = #{signDate,jdbcType=VARCHAR}, - - lease_company = #{leaseCompany,jdbcType=INTEGER}, - project = #{project,jdbcType=INTEGER}, @@ -257,7 +247,6 @@ update bm_agreement set code = #{code,jdbcType=VARCHAR}, sign_date = #{signDate,jdbcType=VARCHAR}, - lease_company = #{leaseCompany,jdbcType=INTEGER}, project = #{project,jdbcType=INTEGER}, start_time = #{startTime,jdbcType=VARCHAR}, lease_term = #{leaseTerm,jdbcType=VARCHAR}, @@ -279,12 +268,12 @@ insert into bm_agreement - (id, code, sign_date, lease_company, project, start_time, lease_term, advance_charge, + (id, code, sign_date, project, start_time, lease_term, advance_charge, authorizing_person, authorizing_phone, contract_number, creator, create_time, remark, settlement_time, is_balance, url, is_sure, company_id, is_push) values (#{id,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{signDate,jdbcType=VARCHAR}, - #{leaseCompany,jdbcType=INTEGER}, #{project,jdbcType=INTEGER}, #{startTime,jdbcType=VARCHAR}, + #{project,jdbcType=INTEGER}, #{startTime,jdbcType=VARCHAR}, #{leaseTerm,jdbcType=VARCHAR}, #{advanceCharge,jdbcType=VARCHAR}, #{authorizingPerson,jdbcType=VARCHAR}, #{authorizingPhone,jdbcType=VARCHAR}, #{contractNumber,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{settlementTime,jdbcType=VARCHAR}, @@ -294,8 +283,8 @@ id = #{id,jdbcType=INTEGER}, code = #{code,jdbcType=VARCHAR}, sign_date = #{signDate,jdbcType=VARCHAR}, - lease_company = #{leaseCompany,jdbcType=INTEGER}, - project = #{project,jdbcType=INTEGER}, + + project = #{project,jdbcType=INTEGER}, start_time = #{startTime,jdbcType=VARCHAR}, lease_term = #{leaseTerm,jdbcType=VARCHAR}, advance_charge = #{advanceCharge,jdbcType=VARCHAR}, @@ -325,9 +314,6 @@ sign_date, - - lease_company, - project, @@ -388,9 +374,6 @@ #{signDate,jdbcType=VARCHAR}, - - #{leaseCompany,jdbcType=INTEGER}, - #{project,jdbcType=INTEGER}, @@ -451,9 +434,6 @@ sign_date = #{signDate,jdbcType=VARCHAR}, - - lease_company = #{leaseCompany,jdbcType=INTEGER}, - project = #{project,jdbcType=INTEGER}, diff --git a/bonus-modules/bonus-base/src/main/resources/mapper/BmProjectMapper.xml b/bonus-modules/bonus-base/src/main/resources/mapper/BmProjectMapper.xml index f380e4e..452d5da 100644 --- a/bonus-modules/bonus-base/src/main/resources/mapper/BmProjectMapper.xml +++ b/bonus-modules/bonus-base/src/main/resources/mapper/BmProjectMapper.xml @@ -49,6 +49,14 @@ where id = #{id,jdbcType=INTEGER} + + delete from bm_project @@ -71,7 +79,7 @@ #{phone,jdbcType=VARCHAR}, #{fax,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{materialClerk,jdbcType=VARCHAR}, #{clerkPhone,jdbcType=VARCHAR}, #{voltageClass,jdbcType=INTEGER}, #{companyId,jdbcType=INTEGER}, #{isBalanceEnd,jdbcType=CHAR}, - #{time,jdbcType=VARCHAR}, #{isActive,jdbcType=VARCHAR}, #{lon,jdbcType=VARCHAR}, + #{time,jdbcType=VARCHAR}, '1', #{lon,jdbcType=VARCHAR}, #{lat,jdbcType=VARCHAR}, #{company,jdbcType=VARCHAR}, #{impUnit,jdbcType=VARCHAR}, #{deptName,jdbcType=VARCHAR}, #{proId,jdbcType=VARCHAR}, #{deptId,jdbcType=INTEGER}, #{cvo,jdbcType=VARCHAR}, #{stats,jdbcType=VARCHAR}, #{htzt,jdbcType=VARCHAR}) From 7e12da4b6d2ac27ba756df11e9033de15a836d7a Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 9 Aug 2024 17:50:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BmAgreementController.java | 21 +++++++++++++++++-- .../bonus/base/mapper/BmAgreementMapper.java | 4 ++++ .../base/service/BmAgreementService.java | 3 +++ .../java/com/bonus/base/utils/ResultBean.java | 4 +++- .../resources/mapper/BmAgreementMapper.xml | 8 +++++++ 5 files changed, 37 insertions(+), 3 deletions(-) diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmAgreementController.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmAgreementController.java index 788c1bd..bd0ffc1 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmAgreementController.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmAgreementController.java @@ -3,9 +3,14 @@ package com.bonus.base.controller; import com.bonus.base.domain.BmAgreement; import com.bonus.base.service.BmAgreementService; import com.bonus.base.utils.ResultBean; +import com.bonus.common.core.constant.HttpStatus; +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.page.TableDataInfo; import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; + /** * 协议管理(bm_agreement)表控制层 * @@ -13,7 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; */ @RestController @RequestMapping("/bm_agreement") -public class BmAgreementController { +public class BmAgreementController extends BaseController { /** * 服务对象 @@ -21,6 +26,18 @@ public class BmAgreementController { @Autowired private BmAgreementService bmAgreementService; + + /** + * 分页查询 + */ + @GetMapping("/list") + public TableDataInfo list(BmAgreement bmAgreement) { + startPage(); + List list = this.bmAgreementService.selectAll(); + return getDataTable(list); + } + + /** * 通过主键查询单条数据 * @@ -41,7 +58,7 @@ public class BmAgreementController { @PostMapping(value = "/add") public ResultBean add(BmAgreement bmAgreement) { int result = this.bmAgreementService.insertSelective(bmAgreement); - return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "删除失败"); + return result > 0 ? ResultBean.success(true) : ResultBean.error("删除失败"); } /** diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmAgreementMapper.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmAgreementMapper.java index 051c30d..6e40514 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmAgreementMapper.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmAgreementMapper.java @@ -3,6 +3,8 @@ package com.bonus.base.mapper; import com.bonus.base.domain.BmAgreement; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** *@PackagePath: com.bonus.base.mapper *@author : 阮世耀 @@ -44,6 +46,8 @@ public interface BmAgreementMapper { */ BmAgreement selectByPrimaryKey(Integer id); + List selectAll(); + /** * update record selective * @param record the updated record diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmAgreementService.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmAgreementService.java index be1a323..21e239d 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmAgreementService.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmAgreementService.java @@ -9,6 +9,7 @@ import com.bonus.base.domain.BmAgreement; import com.bonus.base.mapper.BmAgreementMapper; import javax.annotation.Resource; +import java.util.List; /** * @PackagePath: com.bonus.base @@ -24,6 +25,8 @@ public class BmAgreementService{ @Resource private BmAgreementMapper bmAgreementMapper; + public List selectAll() {return bmAgreementMapper.selectAll();} + public int deleteByPrimaryKey(Integer id) { return bmAgreementMapper.deleteByPrimaryKey(id); } diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/utils/ResultBean.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/utils/ResultBean.java index 0cd58ce..77dea27 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/utils/ResultBean.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/utils/ResultBean.java @@ -16,7 +16,9 @@ import lombok.RequiredArgsConstructor; public final class ResultBean { private final int code; + private final String message; + private final T data; /** @@ -37,7 +39,7 @@ public final class ResultBean { * @return 构建的ResultBean实例 */ public static ResultBean error(String message) { - return new ResultBean<>(500, message, null); + return new ResultBean<>(HttpStatus.ERROR, message, null); } diff --git a/bonus-modules/bonus-base/src/main/resources/mapper/BmAgreementMapper.xml b/bonus-modules/bonus-base/src/main/resources/mapper/BmAgreementMapper.xml index db96aea..1c1e076 100644 --- a/bonus-modules/bonus-base/src/main/resources/mapper/BmAgreementMapper.xml +++ b/bonus-modules/bonus-base/src/main/resources/mapper/BmAgreementMapper.xml @@ -37,6 +37,13 @@ from bm_agreement where id = #{id,jdbcType=INTEGER} + + + delete from bm_agreement @@ -484,4 +491,5 @@ + \ No newline at end of file From 05643ca2a0e03f06a741e8b729d6e9366f861a1c Mon Sep 17 00:00:00 2001 From: mashuai Date: Fri, 9 Aug 2024 18:00:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9C=BA=E5=85=B7=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/controller/BmSupplierController.java | 111 +++++++++++ .../com/bonus/base/domain/BmSupplier.java | 173 ++++++++++++++++++ .../bonus/base/mapper/BmSupplierMapper.java | 59 ++++++ .../bonus/base/service/BmSupplierService.java | 55 ++++++ .../service/impl/BmSupplierServiceImpl.java | 76 ++++++++ .../resources/mapper/BmSupplierMapper.xml | 129 +++++++++++++ 6 files changed, 603 insertions(+) create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmSupplierController.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmSupplier.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmSupplierMapper.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmSupplierService.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/BmSupplierServiceImpl.java create mode 100644 bonus-modules/bonus-base/src/main/resources/mapper/BmSupplierMapper.xml diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmSupplierController.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmSupplierController.java new file mode 100644 index 0000000..952ddb5 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmSupplierController.java @@ -0,0 +1,111 @@ +package com.bonus.base.controller; + +import com.bonus.base.domain.BmSupplier; +import com.bonus.base.service.BmSupplierService; +import com.bonus.base.utils.ResultBean; +import com.bonus.common.core.utils.poi.ExcelUtil; +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.page.TableDataInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 机具供应商管理(BmSupplier)表控制层 + * + * @author mashuai + * @since 2024-08-09 13:07:22 + */ +@RestController +@Api(tags = "供应商管理") +@RequestMapping("/bmSupplier") +public class BmSupplierController extends BaseController { + /** + * 服务对象 + */ + @Resource + private BmSupplierService bmSupplierService; + + /** + * 分页查询供应商列表 + * + * @param bmSupplier 筛选条件 + * @return 查询结果 + */ + @ApiOperation(value = "分页查询供应商列表") + @GetMapping("/list") + public TableDataInfo queryByPage(BmSupplier bmSupplier) { + startPage(); + List list = bmSupplierService.queryByPage(bmSupplier); + return getDataTable(list); + } + + /** + * 通过主键查询单条数据,供修改回显数据使用 + * + * @param id 主键 + * @return 单条数据详情 + */ + @ApiOperation(value = "查询供应商单条数据详情") + @GetMapping("/{id}") + public ResultBean queryById(@PathVariable("id") Integer id) { + return ResultBean.success(bmSupplierService.queryById(id)); + } + + /** + * 新增数据 + * + * @param bmSupplier 实体 + * @return 新增结果 + */ + @ApiOperation(value = "新增供应商管理数据") + @PostMapping("/add") + public ResultBean add(@RequestBody BmSupplier bmSupplier) { + int result = bmSupplierService.insert(bmSupplier); + return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "新增失败"); + } + + /** + * 编辑数据 + * + * @param bmSupplier 实体 + * @return 编辑结果 + */ + @ApiOperation(value = "编辑供应商管理数据") + @PutMapping("/update") + public ResultBean edit(@RequestBody BmSupplier bmSupplier) { + int result = bmSupplierService.update(bmSupplier); + return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "修改失败"); + } + + /** + * 单个或批量删除数据 + * + * @param ids 主键 + * @return 删除是否成功 + */ + @ApiOperation(value = "删除供应商管理数据") + @PostMapping(value = "/delete/{ids}") + public ResultBean deleteById(@PathVariable("ids") Long[] ids) { + int result = bmSupplierService.deleteById(ids); + return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "删除失败"); + } + + /** + * 导出供应商管理列表 + */ + @ApiOperation(value = "导出查询机具供应商列表") + @PostMapping("/export") + public void export(HttpServletResponse response, BmSupplier bmSupplier) + { + List list = bmSupplierService.queryByPage(bmSupplier); + ExcelUtil util = new ExcelUtil<>(BmSupplier.class); + util.exportExcel(response, list, "机具供应商数据"); + } + +} + diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmSupplier.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmSupplier.java new file mode 100644 index 0000000..9d3df7d --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmSupplier.java @@ -0,0 +1,173 @@ +package com.bonus.base.domain; + +import com.bonus.common.core.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; + +/** + * 机具供应商管理(BmSupplier)实体类 + * + * @author mashuai + * @since 2024-08-09 13:09:16 + */ +@ApiModel("机具供应商管理(BmSupplier)实体类") +public class BmSupplier implements Serializable { + private static final long serialVersionUID = -22518958223068479L; + + /** 主键id */ + @ApiModelProperty(value = "主键id") + private Integer id; + + /** 厂家名称 */ + @ApiModelProperty(value = "厂家名称") + @Excel(name = "厂家名称") + private String name; + + /** 厂家地址 */ + @ApiModelProperty(value = "厂家地址") + @Excel(name = "厂家地址") + private String address; + + /** 法人代表 */ + @ApiModelProperty(value = "法人代表") + @Excel(name = "法人代表") + private String companyMan; + + /** 主要联系人 */ + @ApiModelProperty(value = "主要联系人") + @Excel(name = "主要联系人") + private String mainPerson; + + /** 联系电话 */ + @ApiModelProperty(value = "联系电话") + @Excel(name = "联系电话") + private String phone; + + /** 主要经营范围 */ + @ApiModelProperty(value = "主要经营范围") + @Excel(name = "主要经营范围") + private String scopeBusiness; + + /** 营业执照 */ + @ApiModelProperty(value = "营业执照") + @Excel(name = "营业执照") + private String picUrl; + + /** 备注 */ + @ApiModelProperty(value = "备注") + @Excel(name = "备注") + private String notes; + + /** 是否启用 0不启用 1启用 */ + @ApiModelProperty(value = "是否启用 0不启用 1启用") + private String isActive; + + /** 数据所属组织 */ + @ApiModelProperty(value = "数据所属组织") + private Integer companyId; + + /** 模糊查询关键字 */ + @ApiModelProperty(value = "模糊查询关键字") + private String keyWord; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCompanyMan() { + return companyMan; + } + + public void setCompanyMan(String companyMan) { + this.companyMan = companyMan; + } + + public String getMainPerson() { + return mainPerson; + } + + public void setMainPerson(String mainPerson) { + this.mainPerson = mainPerson; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getScopeBusiness() { + return scopeBusiness; + } + + public void setScopeBusiness(String scopeBusiness) { + this.scopeBusiness = scopeBusiness; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public String getPicUrl() { + return picUrl; + } + + public void setPicUrl(String picUrl) { + this.picUrl = picUrl; + } + + public String getIsActive() { + return isActive; + } + + public void setIsActive(String isActive) { + this.isActive = isActive; + } + + public Integer getCompanyId() { + return companyId; + } + + public void setCompanyId(Integer companyId) { + this.companyId = companyId; + } + + public String getKeyWord() { + return keyWord; + } + + public void setKeyWord(String keyWord) { + this.keyWord = keyWord; + } + +} + diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmSupplierMapper.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmSupplierMapper.java new file mode 100644 index 0000000..326e625 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmSupplierMapper.java @@ -0,0 +1,59 @@ +package com.bonus.base.mapper; + +import com.bonus.base.domain.BmSupplier; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 机具供应商管理(BmSupplier)表数据库访问层 + * + * @author mashuai + * @since 2024-08-09 13:26:39 + */ +@Mapper +public interface BmSupplierMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + BmSupplier queryById(Integer id); + + /** + * 查询指定行数据 + * + * @param bmSupplier 查询条件 + * @return 对象列表 + */ + List queryAllByLimit(BmSupplier bmSupplier); + + /** + * 新增数据 + * + * @param bmSupplier 实例对象 + * @return 影响行数 + */ + int insert(BmSupplier bmSupplier); + + /** + * 修改数据 + * + * @param bmSupplier 实例对象 + * @return 影响行数 + */ + int update(BmSupplier bmSupplier); + + /** + * 通过主键删除数据 + * + * @param ids 主键 + * @return 影响行数 + */ + int deleteById(@Param("array") Long[] ids); + +} + diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmSupplierService.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmSupplierService.java new file mode 100644 index 0000000..2558ded --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmSupplierService.java @@ -0,0 +1,55 @@ +package com.bonus.base.service; + +import com.bonus.base.domain.BmSupplier; + +import java.util.List; + +/** + * 机具供应商管理(BmSupplier)表服务接口 + * + * @author mashuai + * @since 2024-08-09 13:07:35 + */ +public interface BmSupplierService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + BmSupplier queryById(Integer id); + + /** + * 分页查询 + * + * @param bmSupplier 筛选条件 + * @return 查询结果 + */ + List queryByPage(BmSupplier bmSupplier); + + /** + * 新增数据 + * + * @param bmSupplier 实例对象 + * @return 实例对象 + */ + int insert(BmSupplier bmSupplier); + + /** + * 修改数据 + * + * @param bmSupplier 实例对象 + * @return 实例对象 + */ + int update(BmSupplier bmSupplier); + + /** + * 通过主键删除数据 + * + * @param ids 主键 + * @return 是否成功 + */ + int deleteById(Long[] ids); + +} diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/BmSupplierServiceImpl.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/BmSupplierServiceImpl.java new file mode 100644 index 0000000..084ee2a --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/BmSupplierServiceImpl.java @@ -0,0 +1,76 @@ +package com.bonus.base.service.impl; + +import com.bonus.base.domain.BmSupplier; +import com.bonus.base.mapper.BmSupplierMapper; +import com.bonus.base.service.BmSupplierService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 机具供应商管理(BmSupplier)表服务实现类 + * + * @author mashuai + * @since 2024-08-09 13:07:35 + */ +@Service("bmSupplierService") +public class BmSupplierServiceImpl implements BmSupplierService { + @Resource + private BmSupplierMapper bmSupplierDao; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public BmSupplier queryById(Integer id) { + return bmSupplierDao.queryById(id); + } + + /** + * 分页查询 + * + * @param bmSupplier 筛选条件 + * @return 查询结果 + */ + @Override + public List queryByPage(BmSupplier bmSupplier) { + return bmSupplierDao.queryAllByLimit(bmSupplier); + } + + /** + * 新增数据 + * + * @param bmSupplier 实例对象 + * @return 实例对象 + */ + @Override + public int insert(BmSupplier bmSupplier) { + return bmSupplierDao.insert(bmSupplier); + } + + /** + * 修改数据 + * + * @param bmSupplier 实例对象 + * @return 实例对象 + */ + @Override + public int update(BmSupplier bmSupplier) { + return bmSupplierDao.update(bmSupplier); + } + + /** + * 通过主键删除数据 + * + * @param ids 主键 + * @return 是否成功 + */ + @Override + public int deleteById(Long[] ids) { + return bmSupplierDao.deleteById(ids); + } +} diff --git a/bonus-modules/bonus-base/src/main/resources/mapper/BmSupplierMapper.xml b/bonus-modules/bonus-base/src/main/resources/mapper/BmSupplierMapper.xml new file mode 100644 index 0000000..f58d7dc --- /dev/null +++ b/bonus-modules/bonus-base/src/main/resources/mapper/BmSupplierMapper.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + select id, name, address, company_man, main_person, phone, scope_business, notes, pic_url, is_active, company_id + from bm_supplier + + + + + + + + + + insert into bm_supplier( + + name, + address, + company_man, + main_person, + phone, + scope_business, + notes, + pic_url, + is_active, + company_id + + values + + #{name}, + #{address}, + #{companyMan}, + #{mainPerson}, + #{phone}, + #{scopeBusiness}, + #{notes}, + #{picUrl}, + "1", + #{companyId} + + + + + + update bm_supplier + + + name = #{name}, + + + address = #{address}, + + + company_man = #{companyMan}, + + + main_person = #{mainPerson}, + + + phone = #{phone}, + + + scope_business = #{scopeBusiness}, + + + notes = #{notes}, + + + pic_url = #{picUrl}, + + + is_active = #{isActive}, + + + company_id = #{companyId}, + + + where id = #{id} + + + + + update bm_supplier set is_active = 0 where id in + + #{supplierId} + + + + +