t.del_flag = 0
and t.dict_name like concat('%', #{keyWord}, '%')
OR
t.id in (
select t.p_id from sys_distinct t where t.del_flag = 0
and (
t.dict_name like concat('%', #{keyWord}, '%')
)
)
select count(1) from sys_distinct t
select
t.id,
t.dict_code as dictCode,
t.dict_name as dictName,
t.dict_value as dictValue,
t.p_id as parentId,
t.dict_sort as sort
from sys_distinct t
order by t.dict_sort
select dict2.id,
dict2.dict_code as dictCode,
dict2.dict_name as dictName,
dict2.dict_value as dictValue
from
sys_distinct dict
left join sys_distinct dict2 on dict.id=dict2.p_id
where dict.dict_code=#{type} and dict2.del_flag = 0
order by dict2.dict_sort asc
select
t.id,
t.dict_code as dictCode,
t.dict_name as dictName,
t.dict_value as dictValue,
t.p_id as parentId,
t.dict_sort as sort
from sys_distinct t
where t.p_id = 0 and t.del_flag = 0
order by t.dict_sort
select t.id,
t.dict_code as dictCode,
t.dict_name as dictName,
t.dict_value as dictValue,
t.p_id as parentId,
t.dict_sort as sort
from sys_distinct t
where t.p_id = #{parentId} and t.dict_code = #{dictCode}
select t.id,
t.dict_code as dictCode,
t.dict_name as dictName,
t.dict_value as dictValue,
t.p_id as parentId,
t.dict_sort as sort
from sys_distinct t
where t.p_id = #{parentId} and t.dict_name = #{dictName}
select t.id,
t.dict_code as dictCode,
t.dict_name as dictName,
t.dict_value as dictValue,
t.p_id as parentId,
t.dict_sort as sort
from sys_distinct t
where t.p_id = #{parentId} and t.dict_value = #{dictValue}
select t.id,
t.dict_code as dictCode,
t.dict_name as dictName,
t.dict_value as dictValue,
t.p_id as parentId,
t.dict_sort as sort
from sys_distinct t
where t.id = #{id}
update sys_distinct t
set t.dict_code = #{dictCode},
t.dict_name = #{dictName},
t.dict_value = #{dictValue},
t.dict_sort = #{sort}
where t.id = #{id}
update sys_distinct t
set t.del_flag = 1
where t.id = #{id}