|  |  | 
 |  |  |         if (cstmrService.selectByUuid(hostId, cstmr.getUuid()) != null) { | 
 |  |  |             throw new CoolException("客户已存在"); | 
 |  |  |         } | 
 |  |  |         Cstmr cstmr1 = cstmrService.selectByName(hostId, cstmr.getName()); | 
 |  |  |         if (cstmr1!=null){ | 
 |  |  |             throw new CoolException("该客户信息已存在,业务员是:"+cstmr1.getDirector$()); | 
 |  |  |         } | 
 |  |  |         cstmr.setHostId(hostId); | 
 |  |  |         cstmr.setUuid(cstmrService.getUuid(hostId));  // 客户代号 | 
 |  |  |         cstmr.setDeptId(getDeptId());               // 所属部门 | 
 
 |  |  | 
 |  |  |                 , role.judgeLeader() ? String.valueOf(user.getDeptId()) : null | 
 |  |  |                 , user.getId() | 
 |  |  |                 , condition | 
 |  |  |                 , null); | 
 |  |  |                 , 0); | 
 |  |  |         List<KeyValueVo> vos = new ArrayList<>(); | 
 |  |  |         page.getRecords().forEach(item -> vos.add(new KeyValueVo(item.getName(), item.getId()))); | 
 |  |  |         return R.ok().add(vos); | 
 
 |  |  | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.core.common.Cools; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.HashMap; | 
 |  |  | 
 |  |  |                     .build() | 
 |  |  |                     .doPost(); | 
 |  |  |             JSONObject jsonObject = JSON.parseObject(response); | 
 |  |  |             if (Cools.isEmpty(jsonObject)){ | 
 |  |  |                 throw new CoolException("无返回结果"); | 
 |  |  |             } | 
 |  |  |             if (Integer.parseInt(jsonObject.get("error_code").toString()) == 0) { | 
 |  |  |                 JSONObject result = JSON.parseObject(jsonObject.get("result").toString()); | 
 |  |  |                 List<JSONObject> data = JSON.parseArray(result.get("data").toString(), JSONObject.class); | 
 |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             if (e.getMessage().equals("无返回结果")){ | 
 |  |  |                 throw new CoolException("无返回结果"); | 
 |  |  |             } | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |         return list; | 
 
 |  |  | 
 |  |  |         WHERE 1=1 | 
 |  |  |         <choose> | 
 |  |  |             <when test="deptId != null and deptId != ''"> | 
 |  |  |                 AND (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId}) | 
 |  |  |                 AND (   (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId}) | 
 |  |  |                 or | 
 |  |  |                 ( | 
 |  |  |                     user_id = #{userId} | 
 |  |  | 
 |  |  |                         where 1=1 | 
 |  |  |                         and user_id = #{userId} | 
 |  |  |                     ) | 
 |  |  |                 ) | 
 |  |  |                 )) | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and | 
 
 |  |  | 
 |  |  |         WHERE 1=1 | 
 |  |  |         <choose> | 
 |  |  |             <when test="deptId != null and deptId != ''"> | 
 |  |  |                 AND (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId}) | 
 |  |  |                 AND ( (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId}) | 
 |  |  |                 or | 
 |  |  |                 ( | 
 |  |  |                     user_id = #{userId} | 
 |  |  | 
 |  |  |                         where 1=1 | 
 |  |  |                         and user_id = #{userId} | 
 |  |  |                     ) | 
 |  |  |                 ) | 
 |  |  |                 )) | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and |