仓库人员配置
This commit is contained in:
parent
a673610a94
commit
7299021bcb
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.bonus.material.controller;
|
||||||
|
import com.bonus.common.core.domain.ResultBean;
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
import com.bonus.material.service.impl.MaUserSetService;
|
||||||
|
import com.bonus.material.domain.MaUserSet;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物资和人员配置(ma_user_set)表控制层
|
||||||
|
*
|
||||||
|
* @author 阮世耀
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ma_user_set")
|
||||||
|
public class MaUserSetController extends BaseController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务对象
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private MaUserSetService maUserSetService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询数据
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public TableDataInfo getList(MaUserSet maUserSet) {
|
||||||
|
startPage();
|
||||||
|
List<MaUserSet> list = this.maUserSetService.selectAll(maUserSet);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 单条数据
|
||||||
|
*/
|
||||||
|
@GetMapping("{id}")
|
||||||
|
public ResultBean<MaUserSet> queryById(@PathVariable("id") Integer id) {
|
||||||
|
return ResultBean.success(this.maUserSetService.selectByPrimaryKey(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param maUserSet 实体
|
||||||
|
* @return 新增结果
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public ResultBean< Boolean> add(@RequestBody MaUserSet maUserSet) {
|
||||||
|
this.maUserSetService.insertSelective(maUserSet);
|
||||||
|
return ResultBean.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑数据
|
||||||
|
*
|
||||||
|
* @param maUserSet 实体
|
||||||
|
* @return 编辑结果
|
||||||
|
*/
|
||||||
|
@PutMapping(value = "/update")
|
||||||
|
public ResultBean< Boolean> edit(@RequestBody MaUserSet maUserSet) {
|
||||||
|
this.maUserSetService.updateByPrimaryKeySelective(maUserSet);
|
||||||
|
return ResultBean.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 删除是否成功
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/delete/{id}")
|
||||||
|
public ResultBean< Boolean> deleteById(@PathVariable("id") Integer id) {
|
||||||
|
this.maUserSetService.deleteByPrimaryKey(id);
|
||||||
|
return ResultBean.success(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.bonus.material.domain;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物资和人员配置
|
||||||
|
* @author 阮世耀
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "物资和人员配置")
|
||||||
|
@Data
|
||||||
|
public class MaUserSet implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机具类型id")
|
||||||
|
private Integer typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机具类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户名称")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1库管2修试
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "1库管2修试")
|
||||||
|
private String userType;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.bonus.material.mapper;
|
||||||
|
|
||||||
|
import com.bonus.material.domain.MaUserSet;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : 阮世耀
|
||||||
|
* @version : 1.0
|
||||||
|
* @PackagePath: com.bonus.material
|
||||||
|
* @CreateTime: 2024-08-13 14:21
|
||||||
|
* @Description: 描述
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MaUserSetMapper {
|
||||||
|
/**
|
||||||
|
* 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(MaUserSet record);
|
||||||
|
|
||||||
|
int insertOrUpdate(MaUserSet record);
|
||||||
|
|
||||||
|
int insertOrUpdateSelective(MaUserSet record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* insert record to table selective
|
||||||
|
*
|
||||||
|
* @param record the record
|
||||||
|
* @return insert count
|
||||||
|
*/
|
||||||
|
int insertSelective(MaUserSet record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* select by primary key
|
||||||
|
*
|
||||||
|
* @param id primary key
|
||||||
|
* @return object by primary key
|
||||||
|
*/
|
||||||
|
MaUserSet selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update record selective
|
||||||
|
*
|
||||||
|
* @param record the updated record
|
||||||
|
* @return update count
|
||||||
|
*/
|
||||||
|
int updateByPrimaryKeySelective(MaUserSet record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update record
|
||||||
|
*
|
||||||
|
* @param record the updated record
|
||||||
|
* @return update count
|
||||||
|
*/
|
||||||
|
int updateByPrimaryKey(MaUserSet record);
|
||||||
|
|
||||||
|
List<MaUserSet> selectByTypeId(@Param("typeId") Integer typeId);
|
||||||
|
|
||||||
|
List<MaUserSet> selectByUserId(@Param("userId") Integer userId);
|
||||||
|
|
||||||
|
List<MaUserSet> selectAll(MaUserSet record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.bonus.material.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.material.mapper.MaUserSetMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import com.bonus.material.domain.MaUserSet;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : 阮世耀
|
||||||
|
* @version : 1.0
|
||||||
|
* @PackagePath: com.bonus.material
|
||||||
|
* @CreateTime: 2024-08-13 14:18
|
||||||
|
* @Description: 描述
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MaUserSetService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MaUserSetMapper maUserSetMapper;
|
||||||
|
|
||||||
|
|
||||||
|
public int insert(MaUserSet record) {
|
||||||
|
return maUserSetMapper.insert(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int insertOrUpdate(MaUserSet record) {
|
||||||
|
return maUserSetMapper.insertOrUpdate(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int insertOrUpdateSelective(MaUserSet record) {
|
||||||
|
return maUserSetMapper.insertOrUpdateSelective(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int insertSelective(MaUserSet record) {
|
||||||
|
return maUserSetMapper.insertSelective(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int deleteByPrimaryKey(Integer id) {
|
||||||
|
return maUserSetMapper.deleteByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MaUserSet selectByPrimaryKey(Integer id) {
|
||||||
|
return maUserSetMapper.selectByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updateByPrimaryKeySelective(MaUserSet record) {
|
||||||
|
return maUserSetMapper.updateByPrimaryKeySelective(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updateByPrimaryKey(MaUserSet record) {
|
||||||
|
return maUserSetMapper.updateByPrimaryKey(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MaUserSet> selectByTypeId(Integer typeId) {
|
||||||
|
return maUserSetMapper.selectByTypeId(typeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MaUserSet> selectByUserId(Integer userId) {
|
||||||
|
return maUserSetMapper.selectByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MaUserSet> selectAll(MaUserSet maUserSet) {
|
||||||
|
return maUserSetMapper.selectAll(maUserSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,214 @@
|
||||||
|
<?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.material.mapper.MaUserSetMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.bonus.material.domain.MaUserSet">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table ma_user_set-->
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||||
|
<result column="type_id" jdbcType="INTEGER" property="typeId"/>
|
||||||
|
<result column="user_id" jdbcType="INTEGER" property="userId"/>
|
||||||
|
<result column="user_type" jdbcType="VARCHAR" property="userType"/>
|
||||||
|
<result column="user_name" jdbcType="VARCHAR" property="userName"/>
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="typeName"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
ma_user_set.id,ma_user_set.type_id,ma_user_set.user_id,ma_user_set.user_type
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
, su.user_name
|
||||||
|
, mt.name
|
||||||
|
from ma_user_set
|
||||||
|
left join sys_user su on ma_user_set.user_id = su.user_id
|
||||||
|
left join ma_type mt on ma_user_set.type_id = mt.id
|
||||||
|
where ma_user_set.id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
delete
|
||||||
|
from ma_user_set
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.material.domain.MaUserSet"
|
||||||
|
useGeneratedKeys="true">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
insert into ma_user_set (type_id, user_id, user_type)
|
||||||
|
values (#{typeId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{userType,jdbcType=VARCHAR})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.material.domain.MaUserSet"
|
||||||
|
useGeneratedKeys="true">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
insert into ma_user_set
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="typeId != null">
|
||||||
|
type_id,
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
|
<if test="userType != null and userType != ''">
|
||||||
|
user_type,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="typeId != null">
|
||||||
|
#{typeId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
#{userId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="userType != null and userType != ''">
|
||||||
|
#{userType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.material.domain.MaUserSet">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
update ma_user_set
|
||||||
|
<set>
|
||||||
|
<if test="typeId != null">
|
||||||
|
type_id = #{typeId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id = #{userId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="userType != null and userType != ''">
|
||||||
|
user_type = #{userType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.bonus.material.domain.MaUserSet">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
update ma_user_set
|
||||||
|
set type_id = #{typeId,jdbcType=INTEGER},
|
||||||
|
user_id = #{userId,jdbcType=INTEGER},
|
||||||
|
user_type = #{userType,jdbcType=VARCHAR}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectByTypeId" resultMap="BaseResultMap">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from ma_user_set
|
||||||
|
where type_id = #{typeId,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from ma_user_set
|
||||||
|
where user_id = #{userId,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAll" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
, su.user_name
|
||||||
|
, mt.name
|
||||||
|
from ma_user_set
|
||||||
|
left join sys_user su on ma_user_set.user_id = su.user_id
|
||||||
|
left join ma_type mt on ma_user_set.type_id = mt.id
|
||||||
|
<where>
|
||||||
|
<if test="typeId != null">
|
||||||
|
and ma_user_set.type_id = #{typeId,jdbcType=INTEGER}
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
and ma_user_set.user_id = #{userId,jdbcType=INTEGER}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.bonus.material.domain.MaUserSet"
|
||||||
|
useGeneratedKeys="true">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
insert into ma_user_set
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
type_id,
|
||||||
|
user_id,
|
||||||
|
user_type,
|
||||||
|
</trim>
|
||||||
|
values
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
#{typeId,jdbcType=INTEGER},
|
||||||
|
#{userId,jdbcType=INTEGER},
|
||||||
|
#{userType,jdbcType=VARCHAR},
|
||||||
|
</trim>
|
||||||
|
on duplicate key update
|
||||||
|
<trim suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id = #{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
type_id = #{typeId,jdbcType=INTEGER},
|
||||||
|
user_id = #{userId,jdbcType=INTEGER},
|
||||||
|
user_type = #{userType,jdbcType=VARCHAR},
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
|
||||||
|
parameterType="com.bonus.material.domain.MaUserSet" useGeneratedKeys="true">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
insert into ma_user_set
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null">
|
||||||
|
type_id,
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
|
<if test="userType != null and userType != ''">
|
||||||
|
user_type,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
values
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null">
|
||||||
|
#{typeId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
#{userId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="userType != null and userType != ''">
|
||||||
|
#{userType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
on duplicate key update
|
||||||
|
<trim suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id = #{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null">
|
||||||
|
type_id = #{typeId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id = #{userId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="userType != null and userType != ''">
|
||||||
|
user_type = #{userType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue