提交 ccabdb97 authored 作者: 李炎's avatar 李炎

微调

上级 5a9b9281
package com.system.controller; package com.system.controller;
import com.system.dao.LicInfoMapper;
import com.system.serivce.ILicInfoService; import com.system.serivce.ILicInfoService;
import com.system.transfer.lic.*; import com.system.transfer.lic.*;
import com.system.transfer.response.RestResponse; import com.system.transfer.response.RestResponse;
import com.system.utils.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,7 +22,8 @@ public class LicInfoController { ...@@ -20,7 +22,8 @@ public class LicInfoController {
@Autowired @Autowired
private ILicInfoService locInfoService; private ILicInfoService locInfoService;
@Autowired
private LicInfoMapper licInfoMapper;
@ApiOperation("Lic信息列表") @ApiOperation("Lic信息列表")
@GetMapping("/lic/info/list") @GetMapping("/lic/info/list")
...@@ -32,6 +35,10 @@ public class LicInfoController { ...@@ -32,6 +35,10 @@ public class LicInfoController {
@ApiOperation("Lic信息创建") @ApiOperation("Lic信息创建")
@PostMapping("/lic/info/create") @PostMapping("/lic/info/create")
public RestResponse licInfoCreate(@RequestBody LicInfoCreateInVo inVo) { public RestResponse licInfoCreate(@RequestBody LicInfoCreateInVo inVo) {
LicInfoListOutVoRecords mac = licInfoMapper.getLicInfoByMacAddress(inVo.getMacAddress());
if (!StringUtil.isNull(mac)) {
return RestResponse.fail("MAC地址已存在");
}
locInfoService.licInfoCreate(inVo); locInfoService.licInfoCreate(inVo);
return RestResponse.success(); return RestResponse.success();
} }
...@@ -39,6 +46,12 @@ public class LicInfoController { ...@@ -39,6 +46,12 @@ public class LicInfoController {
@ApiOperation("Lic信息更新") @ApiOperation("Lic信息更新")
@PutMapping("/lic/info/update") @PutMapping("/lic/info/update")
public RestResponse licInfoUpdate(@RequestBody LicInfoUpdateInVo inVo) { public RestResponse licInfoUpdate(@RequestBody LicInfoUpdateInVo inVo) {
LicInfoListOutVoRecords mac = licInfoMapper.getLicInfoByMacAddress(inVo.getMacAddress());
if (!StringUtil.isNull(mac)) {
if (!mac.getId().equals(inVo.getId())) {
return RestResponse.fail("MAC地址已存在");
}
}
locInfoService.licInfoUpdate(inVo); locInfoService.licInfoUpdate(inVo);
return RestResponse.success(); return RestResponse.success();
} }
......
...@@ -48,5 +48,11 @@ public interface LicInfoMapper { ...@@ -48,5 +48,11 @@ public interface LicInfoMapper {
* @return Lic信息 * @return Lic信息
*/ */
LicInfoListOutVoRecords getLicInfoByMacAddress(String macAddress); LicInfoListOutVoRecords getLicInfoByMacAddress(String macAddress);
/**
* 根据id查询Lic信息
*
* @param macAddress MAC地址
* @return Lic信息
*/
LicInfoListOutVoRecords getLicInfoById(Integer id);
} }
...@@ -70,5 +70,14 @@ ...@@ -70,5 +70,14 @@
</select> </select>
<select id="getLicInfoById" parameterType="java.lang.Integer"
resultType="com.system.transfer.lic.LicInfoListOutVoRecords">
SELECT
id, lq_lic_name, mac_address, effective_time, file_effective_time, verification_interval, module_verification, create_time
FROM tb_lic_info WHERE id = #{id}
</select>
</mapper> </mapper>
...@@ -59,7 +59,7 @@ public class LicInfoServiceImpl implements ILicInfoService { ...@@ -59,7 +59,7 @@ public class LicInfoServiceImpl implements ILicInfoService {
@Override @Override
public RestResponse licInfoFileCreate(LicInfoFileCreateInVo inVo, HttpServletResponse response) { public RestResponse licInfoFileCreate(LicInfoFileCreateInVo inVo, HttpServletResponse response) {
LicInfoListOutVoRecords records = licInfoMapper.getLicInfoByMacAddress(inVo.getMacAddress()); LicInfoListOutVoRecords records = licInfoMapper.getLicInfoById(inVo.getId());
if (StringUtil.isNull(records)) { if (StringUtil.isNull(records)) {
return RestResponse.fail("MAC地址不存在"); return RestResponse.fail("MAC地址不存在");
} }
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
*/ */
@Data @Data
public class LicInfoFileCreateInVo { public class LicInfoFileCreateInVo {
private Integer id;
/** /**
* MAC地址 * MAC地址
*/ */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论