TestResourcePool CURD
This commit is contained in:
parent
fec574d869
commit
89fd3c1f6b
|
@ -0,0 +1,33 @@
|
||||||
|
package io.metersphere.controller;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.TestResourcePool;
|
||||||
|
import io.metersphere.service.TestResourcePoolService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RequestMapping("testresourcepool")
|
||||||
|
@RestController
|
||||||
|
public class TestResourcePoolController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TestResourcePoolService testResourcePoolService;
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
public TestResourcePool addTestResourcePool(@RequestBody TestResourcePool testResourcePool) {
|
||||||
|
return testResourcePoolService.addTestResourcePool(testResourcePool);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/delete/{testResourcePoolId}")
|
||||||
|
public void deleteTestResourcePool(@PathVariable(value = "testResourcePoolId") String testResourcePoolId) {
|
||||||
|
testResourcePoolService.deleteTestResourcePool(testResourcePoolId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
public void updateTestResourcePool(@RequestBody TestResourcePool testResourcePool) {
|
||||||
|
testResourcePoolService.updateTestResourcePool(testResourcePool);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public List<TestResourcePool> getTestResourcePoolList() { return testResourcePoolService.getTestResourcePoolList(); }
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package io.metersphere.service;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.TestResourcePool;
|
||||||
|
import io.metersphere.base.mapper.TestResourcePoolMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class TestResourcePoolService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TestResourcePoolMapper testResourcePoolMapper;
|
||||||
|
|
||||||
|
public TestResourcePool addTestResourcePool(TestResourcePool testResourcePool) {
|
||||||
|
testResourcePool.setId(UUID.randomUUID().toString());
|
||||||
|
testResourcePool.setCreateTime(System.currentTimeMillis());
|
||||||
|
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
||||||
|
testResourcePool.setStatus("1");
|
||||||
|
testResourcePoolMapper.insertSelective(testResourcePool);
|
||||||
|
return testResourcePool;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteTestResourcePool(String testResourcePoolId) {
|
||||||
|
testResourcePoolMapper.deleteByPrimaryKey(testResourcePoolId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateTestResourcePool(TestResourcePool testResourcePool) {
|
||||||
|
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
||||||
|
testResourcePoolMapper.updateByPrimaryKeySelective(testResourcePool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TestResourcePool> getTestResourcePoolList() {
|
||||||
|
return testResourcePoolMapper.selectByExample(null);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue