00018 client_details list

0.3
lishengzhao 2015-05-25 12:04:57 +08:00
parent a690842423
commit 49eed31587
6 changed files with 31 additions and 0 deletions

View File

@ -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);
}

View File

@ -14,4 +14,6 @@ public interface OauthService {
OauthClientDetails loadOauthClientDetails(String clientId);
List<OauthClientDetailsDto> loadAllOauthClientDetailsDtos();
void archiveOauthClientDetails(String clientId);
}

View File

@ -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);
}
}

View File

@ -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";
}
}

View File

@ -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>

View File

@ -34,4 +34,9 @@ public class OauthRepositoryMyBatisTest extends AbstractRepositoryTest {
assertTrue(allOauthClientDetails.isEmpty());
}
@Test
public void updateOauthClientDetailsArchive() {
oauthRepositoryMyBatis.updateOauthClientDetailsArchive("ddooelddd", true);
}
}