You are viewing a plain text version of this content. The canonical link for it is here.
Posted to submarine-dev@hadoop.apache.org by "Xun Liu (Jira)" <ji...@apache.org> on 2019/08/30 03:26:00 UTC

[jira] [Resolved] (SUBMARINE-156) [DB] Automatically translate dictionary code in query results

     [ https://issues.apache.org/jira/browse/SUBMARINE-156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Xun Liu resolved SUBMARINE-156.
-------------------------------
    Resolution: Fixed

h3. What is this PR for?

The dictionary code is automatically translated into dictionary content according to the table name and dictionary code in the dictionary annotation defined by the object class, and added to the returned data record. Reduce the workload of development.
h3. Instructions for use

Some tables in the submarine database only store the code of the dict, and the submarine-web needs to be translated into the name of the dict when displayed.

Use {{@Dict(Code = 'DICT-CODE-XXX')}}, e.g., on the query result object.

 
{code:java}
Public class SysUser extends BaseEntity {
   Private String name;
   Private String username;
   Private String password;
   Private String avatar;

   @Dict(Code = "SEX")
   Private String sex;
}
{code}
 

When querying data through the RestApi interface, zeppelin-server will automatically translate the value of the sex into the {{sys_dict_item}} table to translate the code to the corresponding name, such as {{MALE}} or {{FEMALE}}, and then automatically add the {{dict_item_name}} to the returned data set.

The front-end {{submarine-web}} can use the {{sex@dict}} directly to get the {{dict_item_name}} from the dataset.
h3. What type of PR is it?

Feature
h3. What is the Jira issue?

https://issues.apache.org/jira/browse/SUBMARINE-156
h3. How should this be tested?

[CI Pass|https://travis-ci.org/liuxunorg/submarine/builds/578619673]
h3. Screenshots (if appropriate)
h3. Questions:
 * Does the licenses files need update? No
 * Is there breaking changes for older versions? No
 * Does this needs documentation? No

> [DB] Automatically translate dictionary code in query results
> -------------------------------------------------------------
>
>                 Key: SUBMARINE-156
>                 URL: https://issues.apache.org/jira/browse/SUBMARINE-156
>             Project: Hadoop Submarine
>          Issue Type: Sub-task
>            Reporter: Xun Liu
>            Assignee: Xun Liu
>            Priority: Major
>              Labels: submarine-external-repo
>
> The dictionary code is automatically translated into dictionary content according to the table name and dictionary code in the dictionary annotation defined by the object class, and added to the returned data record. Reduce the workload of development.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)