Commit 121bf963 by wangyang

海南侦查指令管理联络员不显示下级联络员bug修改

parent 1e6dce08
...@@ -975,6 +975,20 @@ public class ZczlController { ...@@ -975,6 +975,20 @@ public class ZczlController {
tbYwZczlLly.setBegin(begin); tbYwZczlLly.setBegin(begin);
tbYwZczlLly.setEnd(end); tbYwZczlLly.setEnd(end);
String unitcode = tbYwZczlLly.getUnitcode();
if(StringUtils.isNotBlank(unitcode)){
if (unitcode.endsWith("0000000000")){
tbYwZczlLly.setUnitcode(unitcode.substring(0,2));
}else if(unitcode.endsWith("00000000")){
tbYwZczlLly.setUnitcode(unitcode.substring(0,4));
}else if(unitcode.endsWith("000000")){
tbYwZczlLly.setUnitcode(unitcode.substring(0,6));
}else if(unitcode.endsWith("0000")){
tbYwZczlLly.setUnitcode(unitcode.substring(0,8));
}else if(unitcode.endsWith("00")){
tbYwZczlLly.setUnitcode(unitcode.substring(0,10));
}
}
List<TbYwZczlLly> tbYwZczlLlyList = zczlService.toQueryAllUser(tbYwZczlLly,user); List<TbYwZczlLly> tbYwZczlLlyList = zczlService.toQueryAllUser(tbYwZczlLly,user);
Integer totalCount = 0; Integer totalCount = 0;
totalCount = zczlService.toQueryAllUserForTotal(tbYwZczlLly); totalCount = zczlService.toQueryAllUserForTotal(tbYwZczlLly);
......
...@@ -522,80 +522,6 @@ public class ZczlService implements IZczlService { ...@@ -522,80 +522,6 @@ public class ZczlService implements IZczlService {
*/ */
@Override @Override
public List<TbYwZczlLly> toQueryAllUser(TbYwZczlLly tbYwZczlLly,User user) { public List<TbYwZczlLly> toQueryAllUser(TbYwZczlLly tbYwZczlLly,User user) {
//进入默认查询本单位用户以及下级单位用户
String myUnitcode = user.getUnitcode();
String searchUnitcode = tbYwZczlLly.getUnitcode();
if(searchUnitcode==null||"".equals(searchUnitcode)){
String inString = null;
//通过单位代码拿到其下级的单位
List<String> list = new ArrayList<>();
list.add(myUnitcode);//添加本单位
List<String> xycxList = new ArrayList<>();//需要查询的单位
xycxList.add(myUnitcode);
boolean bool = true;//是否还存在子节点
//通过单位代码拿到其子节点
while(bool){
xycxList = zczlDao.getChilds(xycxList);
if(xycxList==null||xycxList.size()==0){
bool = false;//没有子节点
}else{
for(int i=0;i<xycxList.size();i++){
list.add(xycxList.get(i));
}
}
}
//oracle的in关键字中的元素不能超过1000
boolean oneIn = true;//是否只用一个in
if(list!=null&&list.size()>1000){
oneIn = false;
}
if(oneIn){
//遍历list,拼接单位的字符串
for(int i=0;i<list.size();i++){
//只有一个单位
if(i==0&&i==list.size()-1){
inString = "('"+list.get(i)+"')";
}else if(i==0){
inString = "('"+list.get(i)+"'";
}else if(i!=list.size()-1){
inString = inString+",'"+list.get(i)+"'";
}else{
inString = inString+",'"+list.get(i)+"')";
}
}
}else{
//遍历list,拼接单位的字符串
for(int i=0;i<list.size();i++){
if(i<500){
if(i==0){
inString = "('"+list.get(i)+"'";
}else if(i<499){
inString = inString+",'"+list.get(i)+"'";
}else{
inString = inString+",'"+list.get(i)+"')";
}
}else{
if(i == list.size() -1 && i % 500 == 0){
inString = inString + "or UNITCODE in ('"+list.get(i)+"'";
}else if(i % 500 == 0){
inString = inString + "or UNITCODE in ('"+list.get(i)+"'";
}else if((i+1) % 500 != 0 && i!=list.size()-1){
inString = inString+",'"+list.get(i)+"'";
}else{
inString = inString+",'"+list.get(i)+"')";
}
}
}
}
searchUnitcode = inString;
}else{
searchUnitcode = "('"+searchUnitcode+"')";
}
tbYwZczlLly.setUnitcode(searchUnitcode);
return zczlDao.toQueryAllUser(tbYwZczlLly); return zczlDao.toQueryAllUser(tbYwZczlLly);
} }
......
...@@ -743,9 +743,11 @@ ...@@ -743,9 +743,11 @@
(select name from sys_dictitem where groupid='CODE_XZUNIT' and code=UNITCODE) as unitname, (select name from sys_dictitem where groupid='CODE_XZUNIT' and code=UNITCODE) as unitname,
TELEPHONE telephone TELEPHONE telephone
from SYS_USER where scbz='0' from SYS_USER where scbz='0'
<if test="unitcode!=null and unitcode!=''"> and (UNITCODE in ${unitcode} )</if> <if test="unitcode!=null and unitcode!=''"> and UNITCODE like #{unitcode, jdbcType=VARCHAR}||'%'</if>
<if test="truename!=null and truename!=''"> and TRUE_NAME like '%'||#{truename, jdbcType=VARCHAR}||'%'</if> <if test="truename!=null and truename!=''"> and TRUE_NAME like '%'||#{truename, jdbcType=VARCHAR}||'%'</if>
<if test="policemanid!=null and policemanid!=''"> and POLICEMANID = #{policemanid, jdbcType=VARCHAR}</if> <if test="policemanid!=null and policemanid!=''"> and POLICEMANID = #{policemanid, jdbcType=VARCHAR}</if>
and UNITCODE IN
(select CODE from sys_dictitem where groupid='CODE_XZUNIT')
) t ) t
WHERE ROWNUM <![CDATA[<=]]> #{end} WHERE ROWNUM <![CDATA[<=]]> #{end}
) WHERE RN > #{begin} ) WHERE RN > #{begin}
...@@ -753,9 +755,11 @@ ...@@ -753,9 +755,11 @@
<select id="toQueryAllUserForTotal" parameterType="com.founder.model.TbYwZczlLly" resultType="java.lang.Integer"> <select id="toQueryAllUserForTotal" parameterType="com.founder.model.TbYwZczlLly" resultType="java.lang.Integer">
select count(*) from SYS_USER where scbz='0' select count(*) from SYS_USER where scbz='0'
<if test="unitcode!=null and unitcode!=''"> and UNITCODE in ${unitcode}</if> <if test="unitcode!=null and unitcode!=''"> and UNITCODE like #{unitcode, jdbcType=VARCHAR}||'%'</if>
<if test="truename!=null and truename!=''"> and TRUE_NAME like '%'||#{truename, jdbcType=VARCHAR}||'%'</if> <if test="truename!=null and truename!=''"> and TRUE_NAME like '%'||#{truename, jdbcType=VARCHAR}||'%'</if>
<if test="policemanid!=null and policemanid!=''"> and POLICEMANID = #{policemanid, jdbcType=VARCHAR}</if> <if test="policemanid!=null and policemanid!=''"> and POLICEMANID = #{policemanid, jdbcType=VARCHAR}</if>
and UNITCODE IN
(select CODE from sys_dictitem where groupid='CODE_XZUNIT')
</select> </select>
<!-- 根据userid拿到用户信息 --> <!-- 根据userid拿到用户信息 -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment