From 05643ca2a0e03f06a741e8b729d6e9366f861a1c Mon Sep 17 00:00:00 2001 From: mashuai Date: Fri, 9 Aug 2024 18:00:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=BA=E5=85=B7=E4=BE=9B=E5=BA=94=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} + + + + +