Showing
1 changed file
with
39 additions
and
17 deletions
... | ... | @@ -16,23 +16,39 @@ |
16 | 16 | </resultMap> |
17 | 17 | |
18 | 18 | <select id="getPage" resultMap="DTOMap"> |
19 | - SELECT id,name,dict_item_id,dict_item_name,status,tenant_id,create_time,creator,update_time,updater | |
20 | - FROM tk_device_profile_category | |
19 | + SELECT | |
20 | + tkdpc.id, | |
21 | + tkdpc.name, | |
22 | + tkdpc.dict_item_id, | |
23 | + sys_dict_item.item_text as dict_item_name, | |
24 | + tkdpc.status, | |
25 | + tkdpc.tenant_id, | |
26 | + tkdpc.create_time, | |
27 | + tkdpc.creator, | |
28 | + tkdpc.update_time, | |
29 | + tkdpc.updater | |
30 | + FROM tk_device_profile_category tkdpc | |
31 | + LEFT JOIN sys_dict_item ON (sys_dict_item.item_value=tkdpc.dict_item_id) | |
21 | 32 | WHERE 1=1 |
22 | - <if test="isSysAdmin == false "> | |
23 | - AND tenant_id = '13814000-1dd2-11b2-8080-808080808080' AND status = 1 | |
24 | - OR tenant_id = #{tenantId} | |
33 | + <if test="isSysAdmin == false"> | |
34 | + AND tkdpc.tenant_id = #{tenantId} | |
35 | + <if test="status !=null"> | |
36 | + AND tkdpc.status = #{status} | |
37 | + </if> | |
38 | + </if> | |
39 | + <if test="status != 0 and isSysAdmin == false"> | |
40 | + OR (tkdpc.tenant_id = '13814000-1dd2-11b2-8080-808080808080' AND tkdpc.status = 1) | |
25 | 41 | </if> |
26 | 42 | <if test="status !=null"> |
27 | - AND status = #{status} | |
43 | + AND tkdpc.status = #{status} | |
28 | 44 | </if> |
29 | 45 | <if test="dictItemId !=null and dictItemId !=''"> |
30 | - AND dict_item_id = #{dictItemId} | |
46 | + AND tkdpc.dict_item_id = #{dictItemId} | |
31 | 47 | </if> |
32 | 48 | <if test="name !=null and name !=''"> |
33 | - AND name = #{name} | |
49 | + AND tkdpc.name like concat('%',#{name},'%') | |
34 | 50 | </if> |
35 | - ORDER BY create_time desc | |
51 | + ORDER BY tkdpc.create_time desc | |
36 | 52 | <if test="page != null"> |
37 | 53 | LIMIT #{pageSize} |
38 | 54 | OFFSET (#{page} - 1) * #{pageSize}; |
... | ... | @@ -41,20 +57,26 @@ |
41 | 57 | |
42 | 58 | <select id="getPageSize" resultType="java.lang.Long"> |
43 | 59 | SELECT COUNT(1) |
44 | - FROM tk_device_profile_category | |
60 | + FROM tk_device_profile_category tkdpc | |
61 | + LEFT JOIN sys_dict_item ON (sys_dict_item.item_value=tkdpc.dict_item_id) | |
45 | 62 | WHERE 1=1 |
46 | - <if test="isSysAdmin == false "> | |
47 | - AND tenant_id = '13814000-1dd2-11b2-8080-808080808080' AND status = 1 | |
48 | - OR tenant_id = #{tenantId} | |
63 | + <if test="isSysAdmin == false"> | |
64 | + AND tkdpc.tenant_id = #{tenantId} | |
65 | + <if test="status !=null"> | |
66 | + AND tkdpc.status = #{status} | |
67 | + </if> | |
68 | + </if> | |
69 | + <if test="status != 0 and isSysAdmin == false"> | |
70 | + OR (tkdpc.tenant_id = '13814000-1dd2-11b2-8080-808080808080' AND tkdpc.status = 1) | |
49 | 71 | </if> |
50 | - <if test="status !=null and status !=''"> | |
51 | - AND status = #{status} | |
72 | + <if test="status !=null"> | |
73 | + AND tkdpc.status = #{status} | |
52 | 74 | </if> |
53 | 75 | <if test="dictItemId !=null and dictItemId !=''"> |
54 | - AND dict_item_id = #{dictItemId} | |
76 | + AND tkdpc.dict_item_id = #{dictItemId} | |
55 | 77 | </if> |
56 | 78 | <if test="name !=null and name !=''"> |
57 | - AND name = #{name} | |
79 | + AND tkdpc.name like concat('%',#{name},'%') | |
58 | 80 | </if> |
59 | 81 | </select> |
60 | 82 | ... | ... |