diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java new file mode 100644 index 00000000..76530c62 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java @@ -0,0 +1,74 @@ +package com.bonus.material.codeCollection.controller; + +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.log.annotation.SysLog; +import com.bonus.common.log.enums.OperaType; +import com.bonus.material.codeCollection.domain.WsMaInfo; +import com.bonus.material.codeCollection.service.WsMaInfoService; +import com.bonus.material.common.annotation.PreventRepeatSubmit; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 机具信息控制器 + * 提供机具信息的 RESTful API 接口,实现增删改查功能 + */ +@RestController +@RequestMapping("/wsMaInfo") +public class WsMaInfoController extends BaseController { + + @Resource + private WsMaInfoService service; + + @ApiOperation(value = "根据ID获取机具信息") + @PreventRepeatSubmit + @SysLog(title = "机具信息查询", businessType = OperaType.QUERY, logType = 1, module = "机具管理->查询") + @GetMapping("/{id}") + public AjaxResult getById(@PathVariable Integer id) { + return service.getById(id); + } + + @ApiOperation(value = "查询所有机具信息列表") + @PreventRepeatSubmit + @SysLog(title = "机具信息列表查询", businessType = OperaType.QUERY, logType = 1, module = "机具管理->查询") + @GetMapping("/list") + public AjaxResult getAll() { + List list = service.getAll(); + return AjaxResult.success(list); + } + + @ApiOperation(value = "新增机具信息") + @PreventRepeatSubmit + @SysLog(title = "机具信息新增", businessType = OperaType.INSERT, logType = 1, module = "机具管理->新增") + @PostMapping("/addWsMaInfo") + public AjaxResult save(@RequestBody WsMaInfo info) { + return service.save(info); + } + + @ApiOperation(value = "更新机具信息") + @PreventRepeatSubmit + @SysLog(title = "机具信息更新", businessType = OperaType.UPDATE, logType = 1, module = "机具管理->更新") + @PostMapping("/updateWsMaInfo") + public AjaxResult update(@RequestBody WsMaInfo info) { + return service.update(info); + } + + @ApiOperation(value = "删除机具信息") + @PreventRepeatSubmit + @SysLog(title = "机具信息删除", businessType = OperaType.DELETE, logType = 1, module = "机具管理->删除") + @PostMapping("/{id}") + public AjaxResult delete(@PathVariable Integer id) { + return service.delete(id); + } + @ApiOperation(value = "获取机具类型") + @PreventRepeatSubmit + @SysLog(title = "获取机具类型", businessType = OperaType.DELETE, logType = 1, module = "获取机具类型") + @PostMapping("/getMaTypeData") + public AjaxResult getMaTypeData() { + return service.getMaTypeData(); + } +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java new file mode 100644 index 00000000..2d664578 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java @@ -0,0 +1,65 @@ +package com.bonus.material.codeCollection.mapper; + +import com.bonus.material.codeCollection.domain.WsMaInfo; +import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * WsMaInfoMapper + * 机具信息表(ws_ma_info)对应的 MyBatis 映射接口 + * 提供基础的增删改查(CRUD)数据库操作方法 + */ +@Mapper +public interface WsMaInfoMapper { + + /** + * 根据主键 ID 查询单条机具信息 + * + * @param id 主键ID + * @return 对应的 WsMaInfo 实体对象 + */ + WsMaInfo selectById(Integer id); + + /** + * 查询所有机具信息 + * + * @return 机具信息列表 + */ + List selectAll(); + + /** + * 插入一条新的机具记录 + * + * @param info 机具实体对象(不含ID,ID自动生成) + * @return 插入成功的记录数(通常为1) + */ + int insert(WsMaInfo info); + + /** + * 根据实体对象更新机具信息(根据 ID 进行更新) + * + * @param info 机具实体对象(必须含有 ID) + * @return 更新成功的记录数 + */ + int update(WsMaInfo info); + + /** + * 根据主键 ID 删除一条机具信息 + * + * @param id 主键ID + * @return 删除成功的记录数(通常为1) + */ + int deleteById(Integer id); + + /** + * 获取机具类型下拉选 + * + * @return 机具类型集合 + */ + @MapKey("id") + List> getMaTypeData(); +}