Commit 7fd3ace1 by 徐高华

通讯录列表查询

parent bebcc45a
...@@ -283,8 +283,10 @@ ...@@ -283,8 +283,10 @@
a.*, a.*,
b.department_id departmentIds b.department_id departmentIds
from tab_haoban_staff a from tab_haoban_staff a
left join tab_haoban_staff_department_related b on a.staff_id = b.staff_id <if test="departmentIds != null and departmentIds.size() > 0">
where a.status_flag = 1 and b.status_flag = 1 and a.wx_enterprise_id = #{wxEnterpriseId} left join tab_haoban_staff_department_related b on a.staff_id = b.staff_id and b.status_flag = 1
</if>
where a.status_flag = 1 and a.wx_enterprise_id = #{wxEnterpriseId}
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
and (a.staff_name like CONCAT('%',#{keyword},'%') or a.phone_number like CONCAT('%',#{keyword},'%')) and (a.staff_name like CONCAT('%',#{keyword},'%') or a.phone_number like CONCAT('%',#{keyword},'%'))
</if> </if>
...@@ -309,7 +311,9 @@ ...@@ -309,7 +311,9 @@
#{id,jdbcType=VARCHAR} #{id,jdbcType=VARCHAR}
</foreach> </foreach>
</if> </if>
group by a.staff_id <if test="departmentIds != null and departmentIds.size() > 0">
group by a.staff_id
</if>
order by a.create_time desc order by a.create_time desc
</select> </select>
<select id="listByIds" resultMap="BaseResultMap"> <select id="listByIds" resultMap="BaseResultMap">
......
package com.gic.haoban.manage.web.qo;
import com.gic.haoban.base.api.common.AppJSONField;
import java.io.Serializable;
/**
* Created 2018/10/22.
*
* @author hua
*/
public class TestQo implements Serializable {
private String id;
@AppJSONField(format = "ignore")
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
package com.gic.haoban.manage.web.utils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
public class IOUtils {
/**
* 6.编写一个程序,将D:\\java目录下的所有.java文件复制到D:\\jad目录下,
* 并将原来文件的扩展名从.java改为.jad。
*/
// public static class FileCopy {
// public static void main(String[] args) {
//
// File oriFile = new File("D:\\java");//原文件目录
// //file.exists():判断文件目录是否存在
// //file.isDirectory():判断文件目录是否是一个目录
// if(!(oriFile.exists() && oriFile.isDirectory())){
// System.out.println("文件目录不存在!");
// }
//
// File[] files = oriFile.listFiles(
// new FilenameFilter(){ //文件名称过滤器
// public boolean accept(File file, String name) {
// return name.endsWith(".java");
// }
// }
// );
// System.out.println(files.length);//原文件个数
//
// File objFile = new File("D:\\jad");//目标文件目录
// //objFile.exists():判断目标文件目录是否存在
// //objFile.mkdir():创建目标文件目录
// if(!objFile.exists()){
// objFile.mkdir();
// }
//
// //copyByte(files,objFile);
// copyChar(files,objFile);
// System.out.println("写入完成!");
//
// }
//使用字节流进行文件复制(字节缓冲流可以不使用,使用其目的主要是为了提高性能)
private static void copyByte(File[] files,File objFile){
InputStream inputStream = null;
OutputStream outputStream = null;
BufferedInputStream bufferedInputStream = null;
BufferedOutputStream bufferedOutputStream = null;
for(File f : files){
//替换文件后缀
String objFileName = f.getName().replaceAll("\\.ACC$", ".mp3");
try {
inputStream = new FileInputStream(f);
outputStream = new FileOutputStream(new File(objFile,objFileName));
bufferedInputStream = new BufferedInputStream(inputStream);
bufferedOutputStream = new BufferedOutputStream(outputStream);
int c = 0;
while((c = bufferedInputStream.read()) != -1){
bufferedOutputStream.write(c);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bufferedOutputStream.close();
bufferedInputStream.close();
outputStream.close();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//使用字符流进行文件复制(字符缓冲流可以不使用,使用其目的主要是为了提高性能)
public static void copyChar(File file,File objFile){
Reader reader = null;
Writer writer = null;
BufferedReader bufferedReader = null;
BufferedWriter bufferedWriter = null;
//替换文件后缀
String objFileName = file.getName().replaceAll("\\.AAC$", ".mp3");
try {
reader = new FileReader(file);
writer = new FileWriter(new File(objFile,objFileName));
bufferedReader = new BufferedReader(reader);
bufferedWriter = new BufferedWriter(writer);
int c = 0;
while ((c=bufferedReader.read()) != -1) {
bufferedWriter.write(c);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bufferedWriter.close();
bufferedReader.close();
writer.close();
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
package com.gic.haoban.manage.web.utils;
import java.util.ArrayList;
import java.util.List;
/**
* list集合工具类
*/
public class ListUtils {
/**
*
* @param pageSize 当前页面大小
* @param pageIndex 当前页码
* @param list 需要分页的集合
* @return
*/
public static List Pager(int pageSize,int pageIndex,List list){
//使用list 中的sublist方法分页
List resultList = new ArrayList<>();
// 每页显示多少条记录
int currentPage; //当前第几页数据
int totalRecord = list.size(); // 一共多少条记录
int totalPage = totalRecord % pageSize; // 一共多少页
if (totalPage > 0) {
totalPage = totalRecord / pageSize + 1;
} else {
totalPage = totalRecord / pageSize;
}
System.out.println("总页数:" + totalPage);
// 当前第几页数据
currentPage = totalPage < pageIndex ? totalPage : pageIndex;
// 起始索引
int fromIndex = pageSize * (currentPage - 1);
// 结束索引
int toIndex = pageSize * currentPage > totalRecord ? totalRecord : pageSize * currentPage;
try{
resultList = list.subList(fromIndex, toIndex);
}catch(IndexOutOfBoundsException e){
e.printStackTrace();
}
return resultList;
}
}
package com.gic.haoban.manage.web.utils;
import org.apache.commons.lang3.StringUtils;
/**
* @author yao
* NationCodePhoneFormater
*/
public class NationCodePhoneFormater {
/**
* 大陆手机号码
*/
public static final String CHINA = "86";
public static String format(String nationCode, String phone) {
if (CHINA.equals(nationCode)) {
return phone;
}
if (StringUtils.isBlank(phone)){
return "";
}
return StringUtils.isBlank(nationCode)? phone: ("+" + nationCode + "-" + phone);
}
}
package com.gic.haoban.manage.web.utils;
/**
* @author
*/
public class RouterConstant {
/**
* 分配_服务名
*/
public final static String INIT_WX_DEPARTMENT_SERVICENAME = "com.gic.haoban.manage.api.service.DepartmentApiService";
/**
*
*/
public final static String INIT_WX_DEPARTMENT_METHODNAME = "initwxDepartmentMQ";
/**
* 路由类型(通用)
*/
public final static String ROUTERTYPE = "commonRouter";
public final static String INIT_WX_DEPARTMENT_APP_CODE = "INIT_WX_DEPARTMENT";
/**
* 默认的数据状态
*/
public final static int DEFAULT_STATUS = 1;
}
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