From c589a94b7ae014104198f1885a2426cf396966bf Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 9 Aug 2024 13:27:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=80=E6=9D=A5=E5=8D=95=E4=BD=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BmCustomerTypeController.java | 90 ++++++++ .../com/bonus/base/domain/BmCustomerType.java | 43 ++++ .../base/mapper/BmCustomerTypeMapper.java | 66 ++++++ .../base/service/BmCustomerTypeService.java | 72 +++++++ .../resources/mapper/BmCustomerTypeMapper.xml | 197 ++++++++++++++++++ 5 files changed, 468 insertions(+) create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmCustomerTypeController.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmCustomerType.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmCustomerTypeMapper.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmCustomerTypeService.java create mode 100644 bonus-modules/bonus-base/src/main/resources/mapper/BmCustomerTypeMapper.xml 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 new file mode 100644 index 0000000..67ec1a4 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmCustomerTypeController.java @@ -0,0 +1,90 @@ +package com.bonus.base.controller; + +import com.bonus.base.domain.BmCustomerType; +import com.bonus.base.service.BmCustomerTypeService; +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.log.annotation.SysLog; +import com.bonus.common.log.enums.OperaType; +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_customer_type)往来单位类型表控制层 + * + * @author 阮世耀 + */ +@RestController +@RequestMapping("/bm_customer_type") +public class BmCustomerTypeController extends BaseController { + + /** + * 服务对象 + */ + @Autowired + private BmCustomerTypeService bmCustomerTypeService; + + @RequiresPermissions("system:customerType:list") + @GetMapping("/list") + @SysLog(title = "往来单位类型", businessType = OperaType.QUERY, logType = 1, module = "往来单位类型->分页查询", details = "往来单位类型列表") + public TableDataInfo list(BmCustomerType bmCustomerType) { + startPage(); + List bmCustomerTypeList = bmCustomerTypeService.selectAll(); + return getDataTable(bmCustomerTypeList); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + @RequiresPermissions("system:customerType:list") + public ResultBean queryById(@PathVariable("id") Integer id) { + return ResultBean.success(this.bmCustomerTypeService.selectByPrimaryKey(id)); + } + + /** + * 新增数据 + * + * @param bmCustomerType 实体 + * @return 新增结果 + */ + @PostMapping(value = "/add") + @RequiresPermissions("system:customerType:add") + public ResultBean add(BmCustomerType bmCustomerType) { + this.bmCustomerTypeService.insertSelective(bmCustomerType); + return ResultBean.success(true); + } + + /** + * 编辑数据 + * + * @param bmCustomerType 实体 + * @return 编辑结果 + */ + @PutMapping(value = "/update") + @RequiresPermissions("system:customerType:update") + public ResultBean edit(BmCustomerType bmCustomerType) { + this.bmCustomerTypeService.updateByPrimaryKeySelective(bmCustomerType); + return ResultBean.success(true); + } + + /** + * 删除数据 + * + * @param id 主键 + * @return 删除是否成功 + */ + @PostMapping(value = "/delete/{id}") + @RequiresPermissions("system:customerType:delete") + 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/domain/BmCustomerType.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmCustomerType.java new file mode 100644 index 0000000..1be19fc --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/BmCustomerType.java @@ -0,0 +1,43 @@ +package com.bonus.base.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +/** + * @PackagePath: com.bonus.base + * @author : 阮世耀 + * @CreateTime: 2024-08-09 13:07 + * @Description: 往来单位类型 + * @version : 1.0 +*/ + +@ApiModel(description="往来单位类型") +@Data +public class BmCustomerType implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value="") + private Integer id; + + /** + * 往来单位类型 + */ + @ApiModelProperty(value="往来单位类型") + private String name; + + /** + * 是否启用0不启用1启用 + */ + @ApiModelProperty(value="是否启用0不启用1启用") + private String isActive; + + /** + * 数据所属组织 + */ + @ApiModelProperty(value="数据所属组织") + private Integer companyId; + +} \ No newline at end of file diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmCustomerTypeMapper.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmCustomerTypeMapper.java new file mode 100644 index 0000000..81ce05a --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/BmCustomerTypeMapper.java @@ -0,0 +1,66 @@ +package com.bonus.base.mapper; + +import com.bonus.base.domain.BmCustomerType; +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + *@PackagePath: com.bonus.base.mapper + *@author : 阮世耀 + *@CreateTime: 2024-08-09 13:07 + *@Description: 描述 + *@version : 1.0 +*/ +@Mapper +public interface BmCustomerTypeMapper { + /** + * delete by primary key + * @param id primaryKey + * @return deleteCount + */ + int deleteByPrimaryKey(Integer id); + + /** + * insert record to table + * @param record the record + * @return insert count + */ + int insert(BmCustomerType record); + + int insertOrUpdate(BmCustomerType record); + + int insertOrUpdateSelective(BmCustomerType record); + + /** + * insert record to table selective + * @param record the record + * @return insert count + */ + int insertSelective(BmCustomerType record); + + /** + * select by primary key + * @param id primary key + * @return object by primary key + */ + BmCustomerType selectByPrimaryKey(Integer id); + + /** + * update record selective + * @param record the updated record + * @return update count + */ + int updateByPrimaryKeySelective(BmCustomerType record); + + /** + * update record + * @param record the updated record + * @return update count + */ + int updateByPrimaryKey(BmCustomerType record); + + List selectAll(); + + int updateById(@Param("updated") BmCustomerType updated, @Param("id") Integer id); +} \ No newline at end of file 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 new file mode 100644 index 0000000..0ed7e3f --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/BmCustomerTypeService.java @@ -0,0 +1,72 @@ +package com.bonus.base.service; + +import org.springframework.stereotype.Service; + +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import com.bonus.base.domain.BmCustomerType; +import com.bonus.base.mapper.BmCustomerTypeMapper; +/** + * @PackagePath: com.bonus.base + * @author : 阮世耀 + * @CreateTime: 2024-08-09 13:07 + * @Description: 描述 + * @version : 1.0 +*/ +@Service +public class BmCustomerTypeService{ + + @Autowired + private BmCustomerTypeMapper bmCustomerTypeMapper; + + public int deleteByPrimaryKey(Integer id) { + return bmCustomerTypeMapper.deleteByPrimaryKey(id); + } + + + public int insert(BmCustomerType record) { + return bmCustomerTypeMapper.insert(record); + } + + + public int insertOrUpdate(BmCustomerType record) { + return bmCustomerTypeMapper.insertOrUpdate(record); + } + + + public int insertOrUpdateSelective(BmCustomerType record) { + return bmCustomerTypeMapper.insertOrUpdateSelective(record); + } + + + public int insertSelective(BmCustomerType record) { + return bmCustomerTypeMapper.insertSelective(record); + } + + + public BmCustomerType selectByPrimaryKey(Integer id) { + return bmCustomerTypeMapper.selectByPrimaryKey(id); + } + + + public int updateByPrimaryKeySelective(BmCustomerType record) { + return bmCustomerTypeMapper.updateByPrimaryKeySelective(record); + } + + + public int updateByPrimaryKey(BmCustomerType record) { + return bmCustomerTypeMapper.updateByPrimaryKey(record); + } + + + public List selectAll() { + return bmCustomerTypeMapper.selectAll(); + } + + + public int updateById(BmCustomerType updated,Integer id) { + return bmCustomerTypeMapper.updateById(updated,id); + } + +} diff --git a/bonus-modules/bonus-base/src/main/resources/mapper/BmCustomerTypeMapper.xml b/bonus-modules/bonus-base/src/main/resources/mapper/BmCustomerTypeMapper.xml new file mode 100644 index 0000000..cd2364b --- /dev/null +++ b/bonus-modules/bonus-base/src/main/resources/mapper/BmCustomerTypeMapper.xml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + ID, `NAME`, IS_ACTIVE, COMPANY_ID + + + + + + + delete from bm_customer_type + where ID = #{id,jdbcType=INTEGER} + + + + + insert into bm_customer_type (`NAME`, IS_ACTIVE, COMPANY_ID + ) + values (#{name,jdbcType=VARCHAR}, #{isActive,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER} + ) + + + + insert into bm_customer_type + + + `NAME`, + + + IS_ACTIVE, + + + COMPANY_ID, + + + + + #{name,jdbcType=VARCHAR}, + + + #{isActive,jdbcType=VARCHAR}, + + + #{companyId,jdbcType=INTEGER}, + + + + + + update bm_customer_type + + + `NAME` = #{name,jdbcType=VARCHAR}, + + + IS_ACTIVE = #{isActive,jdbcType=VARCHAR}, + + + COMPANY_ID = #{companyId,jdbcType=INTEGER}, + + + where ID = #{id,jdbcType=INTEGER} + + + + update bm_customer_type + set `NAME` = #{name,jdbcType=VARCHAR}, + IS_ACTIVE = #{isActive,jdbcType=VARCHAR}, + COMPANY_ID = #{companyId,jdbcType=INTEGER} + where ID = #{id,jdbcType=INTEGER} + + + + + + + update bm_customer_type + + + ID = #{updated.id,jdbcType=INTEGER}, + + + NAME = #{updated.name,jdbcType=VARCHAR}, + + + IS_ACTIVE = #{updated.isActive,jdbcType=VARCHAR}, + + + COMPANY_ID = #{updated.companyId,jdbcType=INTEGER}, + + + where ID = #{id,jdbcType=INTEGER} + + + + + insert into bm_customer_type + + + ID, + + `NAME`, + IS_ACTIVE, + COMPANY_ID, + + values + + + #{id,jdbcType=INTEGER}, + + #{name,jdbcType=VARCHAR}, + #{isActive,jdbcType=VARCHAR}, + #{companyId,jdbcType=INTEGER}, + + on duplicate key update + + + ID = #{id,jdbcType=INTEGER}, + + `NAME` = #{name,jdbcType=VARCHAR}, + IS_ACTIVE = #{isActive,jdbcType=VARCHAR}, + COMPANY_ID = #{companyId,jdbcType=INTEGER}, + + + + + + insert into bm_customer_type + + + ID, + + + `NAME`, + + + IS_ACTIVE, + + + COMPANY_ID, + + + values + + + #{id,jdbcType=INTEGER}, + + + #{name,jdbcType=VARCHAR}, + + + #{isActive,jdbcType=VARCHAR}, + + + #{companyId,jdbcType=INTEGER}, + + + on duplicate key update + + + ID = #{id,jdbcType=INTEGER}, + + + `NAME` = #{name,jdbcType=VARCHAR}, + + + IS_ACTIVE = #{isActive,jdbcType=VARCHAR}, + + + COMPANY_ID = #{companyId,jdbcType=INTEGER}, + + + + + \ No newline at end of file