往来单位类型

This commit is contained in:
syruan 2024-08-09 13:27:25 +08:00
parent 69068dea81
commit c589a94b7a
5 changed files with 468 additions and 0 deletions

View File

@ -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<BmCustomerType> bmCustomerTypeList = bmCustomerTypeService.selectAll();
return getDataTable(bmCustomerTypeList);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
@RequiresPermissions("system:customerType:list")
public ResultBean<BmCustomerType> queryById(@PathVariable("id") Integer id) {
return ResultBean.success(this.bmCustomerTypeService.selectByPrimaryKey(id));
}
/**
* 新增数据
*
* @param bmCustomerType 实体
* @return 新增结果
*/
@PostMapping(value = "/add")
@RequiresPermissions("system:customerType:add")
public ResultBean<Boolean> add(BmCustomerType bmCustomerType) {
this.bmCustomerTypeService.insertSelective(bmCustomerType);
return ResultBean.success(true);
}
/**
* 编辑数据
*
* @param bmCustomerType 实体
* @return 编辑结果
*/
@PutMapping(value = "/update")
@RequiresPermissions("system:customerType:update")
public ResultBean<Boolean> edit(BmCustomerType bmCustomerType) {
this.bmCustomerTypeService.updateByPrimaryKeySelective(bmCustomerType);
return ResultBean.success(true);
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@PostMapping(value = "/delete/{id}")
@RequiresPermissions("system:customerType:delete")
public ResultBean<Boolean> deleteById(@PathVariable("id") Integer id) {
this.bmCustomerTypeService.deleteByPrimaryKey(id);
return ResultBean.success(true);
}
}

View File

@ -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;
}

View File

@ -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<BmCustomerType> selectAll();
int updateById(@Param("updated") BmCustomerType updated, @Param("id") Integer id);
}

View File

@ -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<BmCustomerType> selectAll() {
return bmCustomerTypeMapper.selectAll();
}
public int updateById(BmCustomerType updated,Integer id) {
return bmCustomerTypeMapper.updateById(updated,id);
}
}

View File

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.base.mapper.BmCustomerTypeMapper">
<resultMap id="BaseResultMap" type="com.bonus.base.domain.BmCustomerType">
<!--@mbg.generated-->
<!--@Table bm_customer_type-->
<id column="ID" jdbcType="INTEGER" property="id" />
<result column="NAME" jdbcType="VARCHAR" property="name" />
<result column="IS_ACTIVE" jdbcType="VARCHAR" property="isActive" />
<result column="COMPANY_ID" jdbcType="INTEGER" property="companyId" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
ID, `NAME`, IS_ACTIVE, COMPANY_ID
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from bm_customer_type
where ID = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from bm_customer_type
where ID = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="ID" keyProperty="id" parameterType="com.bonus.base.domain.BmCustomerType" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_customer_type (`NAME`, IS_ACTIVE, COMPANY_ID
)
values (#{name,jdbcType=VARCHAR}, #{isActive,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" keyColumn="ID" keyProperty="id" parameterType="com.bonus.base.domain.BmCustomerType" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_customer_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">
`NAME`,
</if>
<if test="isActive != null and isActive != ''">
IS_ACTIVE,
</if>
<if test="companyId != null">
COMPANY_ID,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">
#{name,jdbcType=VARCHAR},
</if>
<if test="isActive != null and isActive != ''">
#{isActive,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.base.domain.BmCustomerType">
<!--@mbg.generated-->
update bm_customer_type
<set>
<if test="name != null and name != ''">
`NAME` = #{name,jdbcType=VARCHAR},
</if>
<if test="isActive != null and isActive != ''">
IS_ACTIVE = #{isActive,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
COMPANY_ID = #{companyId,jdbcType=INTEGER},
</if>
</set>
where ID = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bonus.base.domain.BmCustomerType">
<!--@mbg.generated-->
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>
<select id="selectAll" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List"/>
from bm_customer_type
</select>
<update id="updateById">
<!--@mbg.generated-->
update bm_customer_type
<set>
<if test="updated.id != null">
ID = #{updated.id,jdbcType=INTEGER},
</if>
<if test="updated.name != null and updated.name != ''">
NAME = #{updated.name,jdbcType=VARCHAR},
</if>
<if test="updated.isActive != null and updated.isActive != ''">
IS_ACTIVE = #{updated.isActive,jdbcType=VARCHAR},
</if>
<if test="updated.companyId != null">
COMPANY_ID = #{updated.companyId,jdbcType=INTEGER},
</if>
</set>
where ID = #{id,jdbcType=INTEGER}
</update>
<insert id="insertOrUpdate" keyColumn="ID" keyProperty="id" parameterType="com.bonus.base.domain.BmCustomerType" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_customer_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
`NAME`,
IS_ACTIVE,
COMPANY_ID,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{name,jdbcType=VARCHAR},
#{isActive,jdbcType=VARCHAR},
#{companyId,jdbcType=INTEGER},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
ID = #{id,jdbcType=INTEGER},
</if>
`NAME` = #{name,jdbcType=VARCHAR},
IS_ACTIVE = #{isActive,jdbcType=VARCHAR},
COMPANY_ID = #{companyId,jdbcType=INTEGER},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="ID" keyProperty="id" parameterType="com.bonus.base.domain.BmCustomerType" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into bm_customer_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="name != null and name != ''">
`NAME`,
</if>
<if test="isActive != null and isActive != ''">
IS_ACTIVE,
</if>
<if test="companyId != null">
COMPANY_ID,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="name != null and name != ''">
#{name,jdbcType=VARCHAR},
</if>
<if test="isActive != null and isActive != ''">
#{isActive,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
ID = #{id,jdbcType=INTEGER},
</if>
<if test="name != null and name != ''">
`NAME` = #{name,jdbcType=VARCHAR},
</if>
<if test="isActive != null and isActive != ''">
IS_ACTIVE = #{isActive,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
COMPANY_ID = #{companyId,jdbcType=INTEGER},
</if>
</trim>
</insert>
</mapper>