现场维修
This commit is contained in:
parent
6b33e8955b
commit
52b925e233
|
|
@ -64,6 +64,7 @@ public class WsMaInfoController extends BaseController {
|
||||||
public AjaxResult delete(@PathVariable Integer id) {
|
public AjaxResult delete(@PathVariable Integer id) {
|
||||||
return service.delete(id);
|
return service.delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取机具类型")
|
@ApiOperation(value = "获取机具类型")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@SysLog(title = "获取机具类型", businessType = OperaType.DELETE, logType = 1, module = "获取机具类型")
|
@SysLog(title = "获取机具类型", businessType = OperaType.DELETE, logType = 1, module = "获取机具类型")
|
||||||
|
|
@ -71,4 +72,13 @@ public class WsMaInfoController extends BaseController {
|
||||||
public AjaxResult getMaTypeData() {
|
public AjaxResult getMaTypeData() {
|
||||||
return service.getMaTypeData();
|
return service.getMaTypeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取机具类型")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@SysLog(title = "获取机具类型", businessType = OperaType.DELETE, logType = 1, module = "获取机具类型")
|
||||||
|
@PostMapping("/getMaModeData")
|
||||||
|
public AjaxResult getMaModeData(@RequestParam Integer parentId) {
|
||||||
|
return service.getMaModeData(parentId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
package com.bonus.material.codeCollection.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机具信息实体类,对应数据库表 ws_ma_info。
|
||||||
|
* 用于记录每台机具的基础信息、检修信息、检验情况等。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class WsMaInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键,自增ID
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机具名称,如“电焊机”、“搅拌机”
|
||||||
|
*/
|
||||||
|
private String maName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机具型号,例如“WX-3000”
|
||||||
|
*/
|
||||||
|
private String maModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机具编号,企业内部唯一标识编号
|
||||||
|
*/
|
||||||
|
private String maCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商/生产厂家名称
|
||||||
|
*/
|
||||||
|
private String supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本次检验时间,格式建议为 yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
private String thisCheckTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下次检验时间,格式建议为 yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
private String nextCheckTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检修员姓名,表示最近一次负责检修的人员
|
||||||
|
*/
|
||||||
|
private String repairMan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验员姓名,表示本次设备检验的执行人员
|
||||||
|
*/
|
||||||
|
private String checkMan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系方式(通常为检修员或检验员电话)
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验结论,例如“合格”、“不合格”、“需维修”
|
||||||
|
*/
|
||||||
|
private String result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型标识,默认 "1",可扩展为不同类型标识(如 "1": 自有设备,"2": 租赁设备)
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机具的关联ID,可用于关联其它系统或模型表
|
||||||
|
*/
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有效标志,默认 "1" 表示有效;"0" 表示已作废/逻辑删除
|
||||||
|
*/
|
||||||
|
private String isActive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后操作用户(更新人),记录最后修改记录的用户标识或姓名
|
||||||
|
*/
|
||||||
|
private String optUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后更新时间,建议格式 yyyy-MM-dd HH:mm:ss
|
||||||
|
*/
|
||||||
|
private String optTime;
|
||||||
|
}
|
||||||
|
|
@ -62,4 +62,13 @@ public interface WsMaInfoMapper {
|
||||||
*/
|
*/
|
||||||
@MapKey("id")
|
@MapKey("id")
|
||||||
List<Map<String, Objects>> getMaTypeData();
|
List<Map<String, Objects>> getMaTypeData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机具规格下拉选
|
||||||
|
*
|
||||||
|
* @return 机具规格集合
|
||||||
|
*/
|
||||||
|
@MapKey("id")
|
||||||
|
List<Map<String, Objects>> getMaModeData(Integer parentId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.bonus.material.codeCollection.service;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.material.codeCollection.domain.WsMaInfo;
|
||||||
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WsMaInfoService
|
||||||
|
* 机具信息服务层接口(Service Layer)
|
||||||
|
* 提供机具信息的增删改查、业务封装等功能
|
||||||
|
* 返回 AjaxResult 用于标准响应封装
|
||||||
|
*/
|
||||||
|
public interface WsMaInfoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键 ID 查询单个机具信息
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return AjaxResult,包含状态码、消息、数据(WsMaInfo)
|
||||||
|
*/
|
||||||
|
AjaxResult getById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有机具信息(无分页)
|
||||||
|
*
|
||||||
|
* @return 机具列表(List<WsMaInfo>)
|
||||||
|
*/
|
||||||
|
List<WsMaInfo> getAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增一条机具记录
|
||||||
|
*
|
||||||
|
* @param info 新增的 WsMaInfo 实体
|
||||||
|
* @return AjaxResult,成功或失败信息
|
||||||
|
*/
|
||||||
|
AjaxResult save(WsMaInfo info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新一条已有机具信息记录
|
||||||
|
*
|
||||||
|
* @param info 待更新的 WsMaInfo 实体(必须含 ID)
|
||||||
|
* @return AjaxResult,成功或失败信息
|
||||||
|
*/
|
||||||
|
AjaxResult update(WsMaInfo info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键 ID 删除记录
|
||||||
|
*
|
||||||
|
* @param id 要删除的主键 ID
|
||||||
|
* @return AjaxResult,成功或失败信息
|
||||||
|
*/
|
||||||
|
AjaxResult delete(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机具类型下拉选
|
||||||
|
*
|
||||||
|
* @return 机具类型集合
|
||||||
|
*/
|
||||||
|
AjaxResult getMaTypeData();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机具规格下拉选
|
||||||
|
*
|
||||||
|
* @return 机具规格集合
|
||||||
|
*/
|
||||||
|
AjaxResult getMaModeData(Integer parentId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,160 @@
|
||||||
|
package com.bonus.material.codeCollection.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.material.codeCollection.domain.WsMaInfo;
|
||||||
|
import com.bonus.material.codeCollection.mapper.WsMaInfoMapper;
|
||||||
|
import com.bonus.material.codeCollection.service.WsMaInfoService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code WsMaInfoServiceImpl}
|
||||||
|
* <p>
|
||||||
|
* 机具信息服务实现类,实现了 {@link WsMaInfoService} 接口。
|
||||||
|
* 提供对 {@code ws_ma_info} 表的增删改查业务逻辑,并统一返回 {@link AjaxResult} 格式结果。
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>核心功能:</p>
|
||||||
|
* <ul>
|
||||||
|
* <li>根据ID获取机具信息</li>
|
||||||
|
* <li>获取全部机具信息</li>
|
||||||
|
* <li>新增机具信息</li>
|
||||||
|
* <li>更新机具信息</li>
|
||||||
|
* <li>删除机具信息</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class WsMaInfoServiceImpl implements WsMaInfoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注入 Mapper,执行实际的数据库操作
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private WsMaInfoMapper mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键 ID 获取单条机具信息
|
||||||
|
*
|
||||||
|
* @param id 机具主键ID
|
||||||
|
* @return AjaxResult,成功时返回 WsMaInfo 数据,失败时返回提示信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getById(Integer id) {
|
||||||
|
try {
|
||||||
|
WsMaInfo info = mapper.selectById(id);
|
||||||
|
return ObjectUtils.isNotEmpty(info) ? AjaxResult.success(info) : AjaxResult.error("未找到对应的机具信息,ID: " + id);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return AjaxResult.error("未找到对应的机具信息,ID: " + id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部机具信息列表(无分页)
|
||||||
|
*
|
||||||
|
* @return List<WsMaInfo> 数据集合,由 Controller 封装为 AjaxResult
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WsMaInfo> getAll() {
|
||||||
|
return mapper.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增一条机具信息记录
|
||||||
|
*
|
||||||
|
* @param info 机具实体对象,需包含有效字段(如 maName, maCode 等)
|
||||||
|
* @return AjaxResult,成功或失败信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult save(WsMaInfo info) {
|
||||||
|
try {
|
||||||
|
int result = mapper.insert(info);
|
||||||
|
return result > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return AjaxResult.error("新增失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 ID 更新已有机具信息
|
||||||
|
*
|
||||||
|
* @param info 包含更新字段及主键ID的机具实体
|
||||||
|
* @return AjaxResult,操作成功与否
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult update(WsMaInfo info) {
|
||||||
|
try {
|
||||||
|
if (info.getId() == null) {
|
||||||
|
return AjaxResult.error("ID不能为空");
|
||||||
|
}
|
||||||
|
int result = mapper.update(info);
|
||||||
|
return result > 0
|
||||||
|
? AjaxResult.success("更新成功")
|
||||||
|
: AjaxResult.error("更新失败");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return AjaxResult.error("更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键 ID 删除机具信息记录
|
||||||
|
*
|
||||||
|
* @param id 待删除记录的主键 ID
|
||||||
|
* @return AjaxResult,操作是否成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult delete(Integer id) {
|
||||||
|
try {
|
||||||
|
int result = mapper.deleteById(id);
|
||||||
|
return result > 0
|
||||||
|
? AjaxResult.success("删除成功")
|
||||||
|
: AjaxResult.error("删除失败");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return AjaxResult.error("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机具类型下拉选
|
||||||
|
*
|
||||||
|
* @return 机具类型集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getMaTypeData() {
|
||||||
|
try {
|
||||||
|
List<Map<String, Objects>> maTypeData = mapper.getMaTypeData();
|
||||||
|
return ObjectUtils.isNotEmpty(maTypeData) ? AjaxResult.success(maTypeData) : AjaxResult.error("");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return AjaxResult.error("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机具规格下拉选
|
||||||
|
*
|
||||||
|
* @param parentId
|
||||||
|
* @return 机具规格集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getMaModeData(Integer parentId) {
|
||||||
|
try {
|
||||||
|
List<Map<String, Objects>> maTypeData = mapper.getMaModeData(parentId);
|
||||||
|
return ObjectUtils.isNotEmpty(maTypeData) ? AjaxResult.success(maTypeData) : AjaxResult.error("");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return AjaxResult.error("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?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.codeCollection.mapper.WsMaInfoMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.bonus.material.codeCollection.domain.WsMaInfo">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="ma_name" property="maName"/>
|
||||||
|
<result column="ma_model" property="maModel"/>
|
||||||
|
<result column="ma_code" property="maCode"/>
|
||||||
|
<result column="supplier" property="supplier"/>
|
||||||
|
<result column="this_check_time" property="thisCheckTime"/>
|
||||||
|
<result column="next_check_time" property="nextCheckTime"/>
|
||||||
|
<result column="repair_man" property="repairMan"/>
|
||||||
|
<result column="check_man" property="checkMan"/>
|
||||||
|
<result column="phone" property="phone"/>
|
||||||
|
<result column="result" property="result"/>
|
||||||
|
<result column="type" property="type"/>
|
||||||
|
<result column="model_id" property="modelId"/>
|
||||||
|
<result column="is_active" property="isActive"/>
|
||||||
|
<result column="opt_user" property="optUser"/>
|
||||||
|
<result column="opt_time" property="optTime"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectById" resultMap="BaseResultMap">
|
||||||
|
SELECT * FROM ws_ma_info WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAll" resultMap="BaseResultMap">
|
||||||
|
SELECT * FROM ws_ma_info
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getMaTypeData" resultType="java.util.Map">
|
||||||
|
SELECT type_id AS id,
|
||||||
|
type_name AS `name`
|
||||||
|
FROM ma_type
|
||||||
|
WHERE `level` = '3'
|
||||||
|
AND del_flag = '0'
|
||||||
|
and is_enter = '1'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getMaModeData" resultType="java.util.Map">
|
||||||
|
SELECT type_id AS id,
|
||||||
|
type_name AS `name`
|
||||||
|
FROM ma_type
|
||||||
|
WHERE parent_id =#{parentId}
|
||||||
|
AND del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
INSERT INTO ws_ma_info (
|
||||||
|
ma_name, ma_model, ma_code, supplier, this_check_time, next_check_time,
|
||||||
|
repair_man, check_man, phone, result, type, model_id, is_active, opt_user, opt_time
|
||||||
|
) VALUES (
|
||||||
|
#{maName}, #{maModel}, #{maCode}, #{supplier}, #{thisCheckTime}, #{nextCheckTime},
|
||||||
|
#{repairMan}, #{checkMan}, #{phone}, #{result}, #{type}, #{modelId}, #{isActive}, #{optUser}, #{optTime}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="update" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo">
|
||||||
|
UPDATE ws_ma_info SET
|
||||||
|
ma_name = #{maName},
|
||||||
|
ma_model = #{maModel},
|
||||||
|
ma_code = #{maCode},
|
||||||
|
supplier = #{supplier},
|
||||||
|
this_check_time = #{thisCheckTime},
|
||||||
|
next_check_time = #{nextCheckTime},
|
||||||
|
repair_man = #{repairMan},
|
||||||
|
check_man = #{checkMan},
|
||||||
|
phone = #{phone},
|
||||||
|
result = #{result},
|
||||||
|
type = #{type},
|
||||||
|
model_id = #{modelId},
|
||||||
|
is_active = #{isActive},
|
||||||
|
opt_user = #{optUser},
|
||||||
|
opt_time = #{optTime}
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteById" parameterType="int">
|
||||||
|
DELETE FROM ws_ma_info WHERE id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue