可以上级查询,也可以下级查询。
1.select d.dept_name_full from dept d where d.dept_name_full like CONCAT('A-B-C','%')
mybatis : select d.dept_name_full from dept d where d.dept_name_full like CONCAT(#{deptName},'%')
查询出来是
A-B-C
A-B-C-D
A-B-C-E
........
2.
select d.dept_name_full from dept d where "A-B-C" like CONCAT(d.dept_name_full,'%')
mybatis: select d.dept_name_full from dept d where #{deptName} like CONCAT(d.dept_name_full,'%')
查询出来结果:
A
A-B
A-B-C