SELECT
sd.id,dept_code,
REPLACE (dept_name, '市场部-', ' ')//去除部门名称前缀’市场部-”’
FROM
sys_dept sd
LEFT JOIN branch_company bc ON bc.`code` = sd.`dept_code`
WHERE
sd.dept_code LIKE CONCAT(#{deptLikeValue1}, '%')
AND bc.`name` IS NULL//若已经选择则不用再次选择
@Override @SystemServiceLog(description = "城市公司字典") public String getBranchCompanyByDept(PageData pageData) { ResultData resultData = null; try { List<SysDictionary> list= sysDictionaryMapper.getSysDictionaryByTypeName("company_dept"); String deptLikeValue ="-1"; if(!AlohaStringUtil.isNull(list)){ deptLikeValue = list.get(0).getValue(); } if(Integer.parseInt(deptLikeValue)!=-1){ System.out.println(deptLikeValue); pageData.put("deptLikeValue1",deptLikeValue); List<PageData> depts = lfCompanyMapper.getBranchCompanyByDept(pageData); resultData = new ResultData("查询成功","10000",depts); }else{ resultData = new ResultData("字典没有维护","-1"); } }catch (Exception e){ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); logger.error("LfCompanyServiceImpl ------------------>getBranchConpanyByDept()异常信息;查询城市公司失败"); e.printStackTrace(); resultData = new ResultData(SystemConst.SERVER_EXCEPTION_MSG,SystemConst.ERROR); } return resultData.toString(); }