use json::{JsonValue};
use crate::{Action, Model, Response};
use crate::test::test::TestTest;

pub struct TestTestSelect {
    pub model: TestTest,
}

impl Action for TestTestSelect {
    fn title(&mut self) -> &'static str { "查询列表" }
    fn name(&mut self) -> &'static str { "test.test.select" }
    fn token(&mut self) -> bool { true }
    fn params(&mut self) -> JsonValue {
        return self.model.table_select_fields();
    }

    fn index(&mut self, _header: JsonValue, request: JsonValue) -> Response {
        let list = self.model.table_select(request.clone(), vec!["name", "code"], vec![
            vec![]
        ]);
        return self.success(list, "ok");
    }
}