yq 2 rokov pred
rodič
commit
b62d92a93f

+ 36 - 4
service-dm/service-dm-biz/src/main/java/com/usky/dm/controller/web/TestController.java

@@ -6,12 +6,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.usky.common.core.bean.ApiResult;
 import com.usky.common.core.bean.CommonPage;
+import com.usky.common.tenant.core.aop.TenantIgnore;
 import com.usky.dm.domain.Test;
 import com.usky.dm.service.TestService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -48,10 +47,12 @@ public class TestController {
      * list
      * @return
      */
+    @TenantIgnore
     @GetMapping("/list")
     public ApiResult<List<Test>> list(){
         LambdaQueryWrapper<Test> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.eq(Test::getNameValue,1);
+        queryWrapper
+                .eq(Test::getNameValue,1);
         return ApiResult.success(testService.list(queryWrapper));
     }
 
@@ -64,5 +65,36 @@ public class TestController {
         return ApiResult.success(testService.listMapper());
     }
 
+
+
+    @GetMapping("/delete")
+    public ApiResult<Void> delete(){
+        LambdaQueryWrapper<Test> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(Test::getNameValue,"2");
+        testService.remove(queryWrapper);
+        return ApiResult.success();
+    }
+
+
+
+    @PostMapping()
+    public void add(){
+        Test test = new Test();
+        test.setNameValue("1");
+        test.setId(8L);
+
+        testService.save(test);
+    }
+
+
+    @PutMapping()
+    public void update(){
+        Test test = new Test();
+        test.setNameValue("1");
+        test.setId(5L);
+        testService.updateById(test);
+    }
+
+
 }
 

+ 3 - 0
service-dm/service-dm-biz/src/main/java/com/usky/dm/domain/Test.java

@@ -1,5 +1,7 @@
 package com.usky.dm.domain;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -19,6 +21,7 @@ public class Test implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
     private String nameValue;

+ 2 - 2
service-dm/service-dm-biz/src/main/resources/mapper/dm/TestMapper.xml

@@ -9,13 +9,13 @@
         <result column="tenant_id" property="tenantId" />
     </resultMap>
     <select id="all" resultType="com.usky.dm.domain.Test">
-        select *
+        select name_value
         from test
         <where>
             <if test="name != null">
                 and name_value = #{name}
             </if>
-
+        group by name_value
         </where>
     </select>