370774330@qq.com 5 лет назад
Родитель
Сommit
c85f6a0d0a

+ 0 - 15
web/src/main/java/seecoder/devcloud/web/dao/pipeline/DeploymentMapper.java

@@ -1,15 +0,0 @@
-package seecoder.devcloud.web.dao.pipeline;
-
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * @author PuHong Weng
- * @date 2021/3/20
- * @description:
- */
-@Mapper
-public interface DeploymentMapper {
-
-
-
-}

+ 1 - 1
web/src/main/java/seecoder/devcloud/web/dao/pipeline/PipelineMapper.java

@@ -15,7 +15,7 @@ import java.util.List;
 public interface PipelineMapper {
 
     @InsertProvider(type = GeneralInsertUpdateSqlProvider.class, method = "insert")
-    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+    @Options(useGeneratedKeys = true, keyProperty = "param1.id", keyColumn = "id")
     boolean insert(PipelinePO pipelinePO, String... ignoredCols);
 
     @Select("select * from pipeline where id = #{id}")

+ 11 - 0
web/src/main/resources/sql/user.sql

@@ -0,0 +1,11 @@
+create table if not exists devcloud.user
+(
+    id          int         not null
+        primary key,
+    username    varchar(31) null,
+    phone       varchar(11) null,
+    email       varchar(63) null,
+    role        varchar(11) null,
+    with_gitlab tinyint(1)  null
+);
+

+ 61 - 0
web/src/test/java/seecoder/devcloud/web/dao/pipeline/PipelineMapperTest.java

@@ -0,0 +1,61 @@
+package seecoder.devcloud.web.dao.pipeline;
+
+import org.junit.jupiter.api.Test;
+import org.junit.runner.RunWith;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import seecoder.devcloud.web.model.po.pipeline.PipelinePO;
+
+/**
+ * @author PuHong Weng
+ * @date 2021/3/24
+ * @description:
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@MapperScan(basePackages = {"seecoder.devcloud.web.dao"})
+class PipelineMapperTest {
+    private final PipelineMapper pipelineMapper;
+
+    @Autowired
+    PipelineMapperTest(PipelineMapper pipelineMapper) {
+        this.pipelineMapper = pipelineMapper;
+    }
+
+
+
+
+    @Test
+    void insert() {
+        PipelinePO po = PipelinePO.builder()
+                .configJson("tettst")
+                .name("tttsd")
+                .projectId(2)
+                .templateName("SPRINGBOOT-JAVA8")
+                .build();
+        pipelineMapper.insert(po, "id");
+    }
+
+    @Test
+    void selectById() {
+
+        System.out.println(pipelineMapper.selectById(4));
+    }
+
+    @Test
+    void selectByProjectId() {
+        System.out.println(pipelineMapper.selectByProjectId(2));
+    }
+
+    @Test
+    void delete() {
+        pipelineMapper.delete(5);
+    }
+
+    @Test
+    void updateConfigJson() {
+        pipelineMapper.updateConfigJson(4,"gogogo");
+    }
+}