diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/controller/MaUserSetController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/controller/MaUserSetController.java new file mode 100644 index 0000000..f9a2e8a --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/controller/MaUserSetController.java @@ -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 list = this.maUserSetService.selectAll(maUserSet); + return getDataTable(list); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResultBean 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); + } +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/domain/MaUserSet.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/domain/MaUserSet.java new file mode 100644 index 0000000..4867b2f --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/domain/MaUserSet.java @@ -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; +} \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/mapper/MaUserSetMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/mapper/MaUserSetMapper.java new file mode 100644 index 0000000..c16d835 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/mapper/MaUserSetMapper.java @@ -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 selectByTypeId(@Param("typeId") Integer typeId); + + List selectByUserId(@Param("userId") Integer userId); + + List selectAll(MaUserSet record); +} \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/impl/MaUserSetService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/impl/MaUserSetService.java new file mode 100644 index 0000000..6a0015c --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/impl/MaUserSetService.java @@ -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 selectByTypeId(Integer typeId) { + return maUserSetMapper.selectByTypeId(typeId); + } + + public List selectByUserId(Integer userId) { + return maUserSetMapper.selectByUserId(userId); + } + + public List selectAll(MaUserSet maUserSet) { + return maUserSetMapper.selectAll(maUserSet); + } +} + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/MaUserSetMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/MaUserSetMapper.xml new file mode 100644 index 0000000..5686426 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/resources/mapper/MaUserSetMapper.xml @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + ma_user_set.id,ma_user_set.type_id,ma_user_set.user_id,ma_user_set.user_type + + + + + + + delete + from ma_user_set + where id = #{id,jdbcType=INTEGER} + + + + + insert into ma_user_set (type_id, user_id, user_type) + values (#{typeId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{userType,jdbcType=VARCHAR}) + + + + + insert into ma_user_set + + + type_id, + + + user_id, + + + user_type, + + + + + #{typeId,jdbcType=INTEGER}, + + + #{userId,jdbcType=INTEGER}, + + + #{userType,jdbcType=VARCHAR}, + + + + + + + update ma_user_set + + + type_id = #{typeId,jdbcType=INTEGER}, + + + user_id = #{userId,jdbcType=INTEGER}, + + + user_type = #{userType,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + + + 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} + + + + + + + + + + + insert into ma_user_set + + + id, + + type_id, + user_id, + user_type, + + values + + + #{id,jdbcType=INTEGER}, + + #{typeId,jdbcType=INTEGER}, + #{userId,jdbcType=INTEGER}, + #{userType,jdbcType=VARCHAR}, + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + type_id = #{typeId,jdbcType=INTEGER}, + user_id = #{userId,jdbcType=INTEGER}, + user_type = #{userType,jdbcType=VARCHAR}, + + + + + insert into ma_user_set + + + id, + + + type_id, + + + user_id, + + + user_type, + + + values + + + #{id,jdbcType=INTEGER}, + + + #{typeId,jdbcType=INTEGER}, + + + #{userId,jdbcType=INTEGER}, + + + #{userType,jdbcType=VARCHAR}, + + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + + type_id = #{typeId,jdbcType=INTEGER}, + + + user_id = #{userId,jdbcType=INTEGER}, + + + user_type = #{userType,jdbcType=VARCHAR}, + + + + \ No newline at end of file