chenxz 7 years ago
parent
commit
ee3d1abd23

+ 1 - 1
mooctest-user-server/src/main/java/cn/iselab/mooctest/user/mapper/MedalMapper.java

@@ -26,6 +26,6 @@ public interface MedalMapper {
     @Update("update medal set name=#{name},description=#{description},is_deleted=#{isDeleted} where id=#{id}")
     void update(Medal medal);
 
-    @Select("select * from medal where name like concat('%',#{keyword},'%')")
+    @Select("select * from medal where name like concat('%',#{keyword},'%') and is_deleted=0")
     List<Medal> findAll(String keyword);
 }

+ 9 - 4
mooctest-user-server/src/main/java/cn/iselab/mooctest/user/web/ctrl/IntegralController.java

@@ -11,12 +11,10 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.domain.Sort;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.validation.constraints.NotNull;
 import java.util.List;
 import java.util.Map;
 
@@ -53,4 +51,11 @@ public class IntegralController extends BaseController{
                                        HttpServletRequest request){
         return medalLogic.getMedals(keyword,userId);
     }
+
+    @RequestMapping(value = UrlConstants.API_MEDAL,method = RequestMethod.DELETE)
+    public boolean getIntegrals(@RequestParam(value = "medalId")Long medalId,
+                                       HttpServletRequest request){
+        medalLogic.deleteMedal(medalId);
+        return true;
+    }
 }

+ 3 - 3
mooctest-user-server/src/main/resources/application.yaml

@@ -36,9 +36,9 @@ spring:
     profiles: dev
     datasource:
         driverClassName: com.mysql.jdbc.Driver
-        url: jdbc:mysql://127.0.0.1:3306/mooctest_user?useUnicode=yes&characterEncoding=UTF-8
-        username: root
-        password: cxz6518
+        url: jdbc:mysql://101.37.175.111:3306/mooctest_user?useUnicode=yes&characterEncoding=UTF-8
+        username: mooctest
+        password: secr3t!
 
     dubbo:
         application.name: user-service-provider