This commit is contained in:
parent
7e7649f046
commit
de498f3e58
|
|
@ -126,4 +126,25 @@ public class WsMaInfoController extends BaseController {
|
||||||
public AjaxResult addWsMaInfoData(@RequestBody WsMaInfo info) {
|
public AjaxResult addWsMaInfoData(@RequestBody WsMaInfo info) {
|
||||||
return service.addWsMaInfoData(info);
|
return service.addWsMaInfoData(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除小工具编码信息")
|
||||||
|
@SysLog(title = "删除小工具编码信息", businessType = OperaType.DELETE, logType = 1, module = "小工具编码信息管理->删除")
|
||||||
|
@PostMapping("/delGadget")
|
||||||
|
public AjaxResult delGadget(@RequestBody WsMaInfo info) {
|
||||||
|
return service.delGadget(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "根据ID获取小工具信息")
|
||||||
|
@SysLog(title = "机具信息查询", businessType = OperaType.QUERY, logType = 1, module = "小工具编码信息管理->查询")
|
||||||
|
@GetMapping("/getGadgetInfo/{id}")
|
||||||
|
public AjaxResult getGadgetInfo(@PathVariable Integer id) {
|
||||||
|
return service.getGadgetInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "更新小工具信息")
|
||||||
|
@SysLog(title = "更新小工具信息", businessType = OperaType.UPDATE, logType = 1, module = "小工具编码信息管理->更新")
|
||||||
|
@PostMapping("/updateGadgetInfo")
|
||||||
|
public AjaxResult updateGadgetInfo(@RequestBody WsMaInfo info) {
|
||||||
|
return service.updateGadgetInfo(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,4 +128,7 @@ public class WsMaInfo {
|
||||||
|
|
||||||
@ApiModelProperty(value = "结束时间")
|
@ApiModelProperty(value = "结束时间")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
private Long deviceTypeId;
|
||||||
|
private Long deviceModelId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,4 +114,32 @@ public interface WsMaInfoMapper {
|
||||||
* @return 机具信息集合
|
* @return 机具信息集合
|
||||||
*/
|
*/
|
||||||
int selectCountByCode(WsMaInfo info);
|
int selectCountByCode(WsMaInfo info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除小工具编码信息
|
||||||
|
* @param info 删除条件
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
int delGadget(WsMaInfo info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取小工具信息
|
||||||
|
* @param id ID
|
||||||
|
* @return 机具信息
|
||||||
|
*/
|
||||||
|
WsMaInfo getGadgetInfo(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据机型、规格、编码查询机具信息
|
||||||
|
* @param info 查询条件
|
||||||
|
* @return 机具信息
|
||||||
|
*/
|
||||||
|
WsMaInfo getInfoByTypeAndModelAndCode(WsMaInfo info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新小工具信息
|
||||||
|
* @param info 更新条件
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
int updateGadgetInfo(WsMaInfo info);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,4 +99,25 @@ public interface WsMaInfoService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult addWsMaInfoData(WsMaInfo info);
|
AjaxResult addWsMaInfoData(WsMaInfo info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除小工具编码信息
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult delGadget(WsMaInfo info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取小工具信息
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getGadgetInfo(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新小工具信息
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult updateGadgetInfo(WsMaInfo info);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -238,4 +238,47 @@ public class WsMaInfoServiceImpl implements WsMaInfoService {
|
||||||
return AjaxResult.error("添加小工具编码信息列表失败");
|
return AjaxResult.error("添加小工具编码信息列表失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult delGadget(WsMaInfo info) {
|
||||||
|
try {
|
||||||
|
int i = mapper.delGadget(info);
|
||||||
|
return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("删除小工具编码信息列表:", e.getMessage());
|
||||||
|
return AjaxResult.error("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getGadgetInfo(Integer id) {
|
||||||
|
try {
|
||||||
|
WsMaInfo info = mapper.getGadgetInfo(id);
|
||||||
|
return AjaxResult.success(info);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("查询小工具编码信息列表:", e.getMessage());
|
||||||
|
return AjaxResult.error("查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult updateGadgetInfo(WsMaInfo info) {
|
||||||
|
try {
|
||||||
|
if (info.getId() == null) {
|
||||||
|
return AjaxResult.error("ID不能为空");
|
||||||
|
}
|
||||||
|
//查询是否存在,如果存在id不同则不能更新
|
||||||
|
//用传入的类型、型号、编号查询记录
|
||||||
|
WsMaInfo wsMaInfo = mapper.getInfoByTypeAndModelAndCode(info);
|
||||||
|
if (wsMaInfo != null && !wsMaInfo.getId().equals(info.getId())) {
|
||||||
|
return AjaxResult.error("该类型下此编码已存在");
|
||||||
|
}
|
||||||
|
info.setOptUser(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||||
|
int i = mapper.updateGadgetInfo(info);
|
||||||
|
return i > 0 ? AjaxResult.success("更新成功") : AjaxResult.error("更新失败");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("更新小工具编码信息列表:", e.getMessage());
|
||||||
|
return AjaxResult.error("更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,34 @@
|
||||||
]]>
|
]]>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getGadgetInfo" resultType="com.bonus.material.codeCollection.domain.WsMaInfo">
|
||||||
|
SELECT wmi.id,
|
||||||
|
wmi.ma_name AS maName,
|
||||||
|
wmi.ma_model AS maModel,
|
||||||
|
wmi.ma_code AS maCode,
|
||||||
|
wmi.this_check_time AS thisCheckTime,
|
||||||
|
wmi.next_check_time AS nextCheckTime,
|
||||||
|
wmi.repair_man AS repairMan,
|
||||||
|
wmi.check_man AS checkMan,
|
||||||
|
mt.deviceTypeId,
|
||||||
|
mt.deviceModelId,
|
||||||
|
wmi.phone,
|
||||||
|
wmi.result
|
||||||
|
FROM ws_ma_info wmi
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
mt.type_id as deviceModelId,
|
||||||
|
mt2.type_id as deviceTypeId,
|
||||||
|
mt.type_name as modelName,
|
||||||
|
mt2.type_name as typeName
|
||||||
|
FROM
|
||||||
|
ma_type mt
|
||||||
|
LEFT JOIN ma_type mt2 on mt.parent_id=mt2.type_id
|
||||||
|
WHERE
|
||||||
|
mt.`level`='4'
|
||||||
|
) mt on wmi.ma_name=mt.typeName and wmi.ma_model=mt.modelName
|
||||||
|
WHERE wmi.id = #{id}
|
||||||
|
</select>
|
||||||
<select id="selectCountByCode" resultType="java.lang.Integer">
|
<select id="selectCountByCode" resultType="java.lang.Integer">
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM ws_ma_info
|
FROM ws_ma_info
|
||||||
|
|
@ -159,8 +187,22 @@
|
||||||
and ma_model = #{maModel}
|
and ma_model = #{maModel}
|
||||||
and is_active = '1'
|
and is_active = '1'
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getInfoByTypeAndModelAndCode" resultType="com.bonus.material.codeCollection.domain.WsMaInfo">
|
||||||
|
SELECT id,
|
||||||
|
ma_name AS maName,
|
||||||
|
ma_model AS maModel,
|
||||||
|
ma_code AS maCode,
|
||||||
|
this_check_time AS thisCheckTime,
|
||||||
|
next_check_time AS nextCheckTime,
|
||||||
|
repair_man AS repairMan,
|
||||||
|
check_man AS checkMan,
|
||||||
|
phone,
|
||||||
|
result
|
||||||
|
FROM ws_ma_info
|
||||||
|
WHERE ma_name = #{maName}
|
||||||
|
and ma_model = #{maModel}
|
||||||
|
and ma_code = #{maCode}
|
||||||
|
</select>
|
||||||
<insert id="insert" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo" useGeneratedKeys="true"
|
<insert id="insert" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo" useGeneratedKeys="true"
|
||||||
keyProperty="id">
|
keyProperty="id">
|
||||||
INSERT INTO ws_ma_info (ma_name, ma_model, ma_code, supplier, this_check_time, next_check_time,
|
INSERT INTO ws_ma_info (ma_name, ma_model, ma_code, supplier, this_check_time, next_check_time,
|
||||||
|
|
@ -212,12 +254,33 @@
|
||||||
update_time = NOW()
|
update_time = NOW()
|
||||||
WHERE ma_code = #{maCode}
|
WHERE ma_code = #{maCode}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateGadgetInfo">
|
||||||
|
UPDATE ws_ma_info
|
||||||
|
SET ma_name = #{maName},
|
||||||
|
ma_model = #{maModel},
|
||||||
|
ma_code = #{maCode},
|
||||||
|
this_check_time = #{thisCheckTime},
|
||||||
|
next_check_time = #{nextCheckTime},
|
||||||
|
repair_man = #{repairMan},
|
||||||
|
check_man = #{checkMan},
|
||||||
|
phone = #{phone},
|
||||||
|
result = #{result},
|
||||||
|
model_id = #{modelId},
|
||||||
|
opt_user = #{optUser},
|
||||||
|
opt_time = NOW()
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteById" parameterType="int">
|
<delete id="deleteById" parameterType="int">
|
||||||
DELETE
|
DELETE
|
||||||
FROM ws_ma_info
|
FROM ws_ma_info
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="delGadget">
|
||||||
|
DELETE
|
||||||
|
FROM ws_ma_info
|
||||||
|
WHERE id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue