提交 856923ac authored 作者: 孙洁清's avatar 孙洁清

关键技术接口根据name查询功能

上级 b08c4440
package com.zjty.inspect.controller;
import com.zjty.inspect.entity.Technology;
import com.zjty.inspect.entity.TechnologyQo;
import com.zjty.inspect.service.TechnologyService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -49,4 +50,16 @@ public class TechnologyController {
technologyService.addAdvice(technologyQo);
return ResponseEntity.ok(200);
}
@PostMapping("/add")
public ResponseEntity addTechnologies(@RequestBody Technology technology){
technologyService.add(technology);
return ResponseEntity.ok(200);
}
@PostMapping(value = "/{id}")
public ResponseEntity update(@RequestBody Technology technology,@PathVariable String id){
technology.setId(id);
technologyService.update(technology);
return ResponseEntity.ok(200);
}
}
......@@ -29,6 +29,10 @@ public class Rule {
@Id
@Column(length = 48)
private String id;
/**
* 关键技术名称
*/
private String technologyName;
/**
* 目标关键字
*/
......
......@@ -27,4 +27,6 @@ public class RuleQo {
* 适配技术id
*/
private String technologyId;
private String technologyName;
}
......@@ -45,10 +45,9 @@ public class Technology {
private Integer support = 1;
/**
* 1:前端技术
* 2:后端技术
* 技术类型
*/
private Integer backOrFront = 2;
private String backOrFront;
/**
* 数据创建时间
*/
......
......@@ -14,6 +14,7 @@ public interface TechnologyService {
* 新增关键技术点
*/
public void addAdvice(TechnologyQo technologyQo);
public void add(Technology technology);
/**
* 查询所有技术
......@@ -23,4 +24,6 @@ public interface TechnologyService {
public List<String> findAllTechnologyNames();
public List<Technology> findAllTechnology(String name);
void update(Technology technology);
}
......@@ -39,6 +39,7 @@ public class RuleServiceImpl implements RuleService {
// TODO: 2020-02-27 适配技术与扫描关键字关联
Rule rule = new Rule();
rule.setTarget(ruleQo.getTarget());
rule.setTechnologyName(ruleQo.getTechnologyName());
rule.setSuffix(ruleQo.getSuffix());
rule.setTechnologyId(ruleQo.getTechnologyId());
rule.setId(UUIDUtil.getUUID());
......@@ -50,6 +51,7 @@ public class RuleServiceImpl implements RuleService {
Rule rule = new Rule();
rule.setTarget(ruleQo.getTarget());
rule.setSuffix(ruleQo.getSuffix());
rule.setTechnologyName(ruleQo.getTechnologyName());
rule.setTechnologyId(ruleQo.getTechnologyId());
rule.setId(ruleQo.getId());
ruleDao.save(rule);
......
......@@ -48,6 +48,20 @@ public class TechnologyServiceImpl implements TechnologyService {
technologyDao.save(technology);
}
@Override
public void add(Technology technology) {
if (technology.getId() == null) {
technology.setId(UUIDUtil.getUUID());
Technology te = technologyDao.findAllByTechnologyNameEquals(technology.getTechnologyName());
if(te!=null){
return;
}
} else {
technology.setId(technology.getId());
}
technologyDao.save(technology);
}
@Override
public List<Technology> findAllTechnology() {
return technologyDao.findAll();
......@@ -66,4 +80,9 @@ public class TechnologyServiceImpl implements TechnologyService {
}
return technologyDao.findAllByTechnologyNameLike("%"+name+"%");
}
@Override
public void update(Technology technology) {
technologyDao.save(technology);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论