00018 client_details list
parent
a690842423
commit
49eed31587
|
@ -1,6 +1,7 @@
|
|||
package cc.wdcy.domain.oauth;
|
||||
|
||||
import cc.wdcy.domain.shared.Repository;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,4 +13,6 @@ public interface OauthRepository extends Repository {
|
|||
OauthClientDetails findOauthClientDetails(String clientId);
|
||||
|
||||
List<OauthClientDetails> findAllOauthClientDetails();
|
||||
|
||||
void updateOauthClientDetailsArchive(@Param("clientId") String clientId, @Param("archive") boolean archive);
|
||||
}
|
|
@ -14,4 +14,6 @@ public interface OauthService {
|
|||
OauthClientDetails loadOauthClientDetails(String clientId);
|
||||
|
||||
List<OauthClientDetailsDto> loadAllOauthClientDetailsDtos();
|
||||
|
||||
void archiveOauthClientDetails(String clientId);
|
||||
}
|
|
@ -28,4 +28,9 @@ public class OauthServiceImpl implements OauthService {
|
|||
List<OauthClientDetails> clientDetailses = oauthRepository.findAllOauthClientDetails();
|
||||
return OauthClientDetailsDto.toDtos(clientDetailses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void archiveOauthClientDetails(String clientId) {
|
||||
oauthRepository.updateOauthClientDetailsArchive(clientId, true);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import cc.wdcy.service.OauthService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -30,4 +31,14 @@ public class ClientDetailsController {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Logic delete
|
||||
* */
|
||||
@RequestMapping("archive_client/{clientId}")
|
||||
public String archiveClient(@PathVariable("clientId") String clientId) {
|
||||
oauthService.archiveOauthClientDetails(clientId);
|
||||
return "redirect:../client_details";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -33,5 +33,10 @@
|
|||
select * from oauth_client_details
|
||||
</select>
|
||||
|
||||
<update id="updateOauthClientDetailsArchive">
|
||||
update oauth_client_details set archived = #{archive}
|
||||
where client_id = #{clientId}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
|
@ -34,4 +34,9 @@ public class OauthRepositoryMyBatisTest extends AbstractRepositoryTest {
|
|||
assertTrue(allOauthClientDetails.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateOauthClientDetailsArchive() {
|
||||
oauthRepositoryMyBatis.updateOauthClientDetailsArchive("ddooelddd", true);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue