jeecg notes of t: dictSelect or t: dgCol custom dictionary

 1, demand

Let me talk about the scene needs it, we know jeecg available in the drop-down, which includes two usage scenarios;

One is directly t: dictSelect used, then there are t: dgCol a list toolbar tag header;

In short, it is like this

Demand, and the data we want to have a sort of drop-down, such as the original unsorted

Then look at the data in the data dictionary in the table below:

Then, we want to do a reverse sort by the type of coding, the final effect is as follows:

2, the process of resolving

Firstly find information learned, there is a dictionary in the drop-down properties, you can achieve the effect of a custom dictionary, format: table name, code, text;

But want to use a custom dictionary requires a combination of dictCondition (custom text dictionary tables - dictionary query) property;

In DataGridTag class 559 line to find, use a dictionary to find the query dictCondition

Photo Gallery has been very clear, that is a sql of assembly, we just need to be able to write sql to get away, as shown below

SELECT a.typecode,a.typename FROM t_s_type a 

,t_s_typegroup b WHERE a.typegroupid = b.id  

AND b.typegroupcode = 'mwo_work_order_status' ORDER BY typecode DESC 

Because the interface to use to encode and display text, so only typecode, typename as a display item.

Let us look at the custom dictionary format [table name, code, text]

<t:dgCol title="啦啦啦"  field="xxx"  queryMode="single" query="true" 
dictionary="t_s_type,a.typecode,a.typename"
dictCondition="a ,t_s_typegroup b WHERE a.typegroupid = b.id  
AND b.typegroupcode = 'mwo_work_order_status' ORDER BY typecode DESC ">
</t:dgCol>

dictionary = "t_s_type, a.typecode, a.typename" >>> table, coding, display text

dictCondition="a ,t_s_typegroup b WHERE a.typegroupid = b.id  AND b.typegroupcode = 'mwo_work_order_status' ORDER BY typecode DESC "

Final stitching together sql as that part of the top.

 

Give a reference:

Copy the code
<t:dictSelect field="mwoApplyDelayProcess" type="radio"
    dictTable="t_s_type a ,t_s_typegroup b"
    dictField="a.typecode,a.typename,a.typecode"
    dictCondition="WHERE a.typegroupid = b.id  AND  b.typegroupcode = 'mwo_apply_delay_process' AND  a.`typecode` IN (2,3)"
    dictText="typename"
    defaultVal = "$ {myyWorkOrderPage.mwoApplyDelayProcess}" hasLabel = "false" title = "status for extension" datatype = "*">
</t:dictSelect>
Copy the code

 

3, final

This implementation is more. . That's what. . Do not like do not spray, please add.

Blog address: http: //www.cnblogs.com/niceyoo

Guess you like

Origin www.cnblogs.com/Jeely/p/12613847.html