Commit 6688dd84 by danmo

客户条件查询功能完善;

客户同步异步采用多线程方式,调用批量获取客户详情接口优化同步速度;
客户列表导出暂时可以导出客户基本信息
1 parent f2bf716f
...@@ -8,10 +8,13 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -8,10 +8,13 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.Threads;
import com.linkwechat.common.utils.poi.ExcelUtil; import com.linkwechat.common.utils.poi.ExcelUtil;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -62,27 +65,27 @@ public class WeCustomerController extends BaseController ...@@ -62,27 +65,27 @@ public class WeCustomerController extends BaseController
return AjaxResult.success(weCustomerService.getCustomersByUserId(userId)); return AjaxResult.success(weCustomerService.getCustomersByUserId(userId));
} }
// /** /**
// * 导出企业微信客户列表 * 导出企业微信客户列表
// */ */
// @PreAuthorize("@ss.hasPermi('wecom:customer:export')") @PreAuthorize("@ss.hasPermi('wecom:customer:export')")
// @Log(title = "企业微信客户", businessType = BusinessType.EXPORT) @Log(title = "企业微信客户", businessType = BusinessType.EXPORT)
// @GetMapping("/export") @GetMapping("/export")
// public AjaxResult export(WeCustomer weCustomer) public AjaxResult export(WeCustomer weCustomer)
// { {
// List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer); List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
// ExcelUtil<WeCustomer> util = new ExcelUtil<WeCustomer>(WeCustomer.class); ExcelUtil<WeCustomer> util = new ExcelUtil<WeCustomer>(WeCustomer.class);
// return util.exportExcel(list, "customer"); return util.exportExcel(list, "customer");
// } }
/** /**
* 获取企业微信客户详细信息 * 获取企业微信客户详细信息
*/ */
@PreAuthorize("@ss.hasPermi('customerManage:customer:view')") @PreAuthorize("@ss.hasPermi('customerManage:customer:view')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{externalUserId}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("externalUserId") String externalUserId)
{ {
return AjaxResult.success(weCustomerService.selectWeCustomerById(id)); return AjaxResult.success(weCustomerService.selectWeCustomerById(externalUserId));
} }
...@@ -108,9 +111,18 @@ public class WeCustomerController extends BaseController ...@@ -108,9 +111,18 @@ public class WeCustomerController extends BaseController
@Log(title = "企业微信客户同步接口", businessType = BusinessType.DELETE) @Log(title = "企业微信客户同步接口", businessType = BusinessType.DELETE)
@GetMapping("/synchWeCustomer") @GetMapping("/synchWeCustomer")
public AjaxResult synchWeCustomer(){ public AjaxResult synchWeCustomer(){
SecurityContext securityContext = SecurityContextHolder.getContext();
weCustomerService.synchWeCustomer(); try {
Threads.SINGLE_THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
SecurityContextHolder.setContext(securityContext);
weCustomerService.synchWeCustomer();
}
});
} catch (Exception e) {
e.printStackTrace();
}
return AjaxResult.success(WeConstans.SYNCH_TIP); return AjaxResult.success(WeConstans.SYNCH_TIP);
} }
......
...@@ -44,7 +44,7 @@ spring: ...@@ -44,7 +44,7 @@ spring:
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
profiles: profiles:
active: druid active: druid
# 文件上传 # 文件上传
servlet: servlet:
...@@ -65,7 +65,7 @@ spring: ...@@ -65,7 +65,7 @@ spring:
# 端口,默认为6379 # 端口,默认为6379
port: 6379 port: 6379
# 密码 # 密码
password: password:
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:
...@@ -105,11 +105,11 @@ mybatis-plus: ...@@ -105,11 +105,11 @@ mybatis-plus:
# configLocation: classpath:mybatis/mybatis-config.xml # configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件 # PageHelper分页插件
pagehelper: pagehelper:
helperDialect: mysql helperDialect: mysql
reasonable: true reasonable: true
supportMethodsArguments: true supportMethodsArguments: true
params: count=countSql params: count=countSql
# Swagger配置 # Swagger配置
swagger: swagger:
...@@ -119,7 +119,7 @@ swagger: ...@@ -119,7 +119,7 @@ swagger:
pathMapping: pathMapping:
# 防止XSS攻击 # 防止XSS攻击
xss: xss:
# 过滤开关 # 过滤开关
enabled: true enabled: true
# 排除链接(多个用逗号分隔) # 排除链接(多个用逗号分隔)
...@@ -148,6 +148,7 @@ wecome: ...@@ -148,6 +148,7 @@ wecome:
- /externalcontact/edit_corp_tag - /externalcontact/edit_corp_tag
- /externalcontact/list - /externalcontact/list
- /externalcontact/get - /externalcontact/get
- /externalcontact/batch/get_by_user
- /externalcontact/groupchat/list - /externalcontact/groupchat/list
- /externalcontact/groupchat/get - /externalcontact/groupchat/get
- /externalcontact/mark_tag - /externalcontact/mark_tag
......
...@@ -170,5 +170,6 @@ public class WeConstans { ...@@ -170,5 +170,6 @@ public class WeConstans {
public static final String COMMA = ","; public static final String COMMA = ",";
public static final String USER_ID = "userid";
public static final String CURSOR = "cursor";
} }
package com.linkwechat.common.utils; package com.linkwechat.common.utils;
import java.util.concurrent.CancellationException; import java.util.concurrent.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -17,6 +15,17 @@ public class Threads ...@@ -17,6 +15,17 @@ public class Threads
{ {
private static final Logger logger = LoggerFactory.getLogger(Threads.class); private static final Logger logger = LoggerFactory.getLogger(Threads.class);
private static final int CORE_POOL_SIZE = Runtime.getRuntime().availableProcessors();
private static final ThreadFactory NAMED_THREAD_FACTORY = new ThreadFactoryBuilder().setNameFormat("common-pool-%d").build();
/**
* 创建线程池
*/
public static final ThreadPoolExecutor SINGLE_THREAD_POOL = new ThreadPoolExecutor(CORE_POOL_SIZE, CORE_POOL_SIZE+1, 10l, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(1024),NAMED_THREAD_FACTORY);
/** /**
* sleep等待,单位为毫秒 * sleep等待,单位为毫秒
*/ */
......
package com.linkwechat.framework.manager; package com.linkwechat.framework.manager;
import com.linkwechat.common.utils.Threads;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -30,6 +31,8 @@ public class ShutdownManager ...@@ -30,6 +31,8 @@ public class ShutdownManager
{ {
logger.info("====关闭后台任务任务线程池===="); logger.info("====关闭后台任务任务线程池====");
AsyncManager.me().shutdown(); AsyncManager.me().shutdown();
logger.info("====关闭后台线程池====");
Threads.shutdownAndAwaitTermination(Threads.SINGLE_THREAD_POOL);
} }
catch (Exception e) catch (Exception e)
{ {
......
...@@ -17,6 +17,7 @@ const service = config.services.wecom + '/customer' ...@@ -17,6 +17,7 @@ const service = config.services.wecom + '/customer'
export function getList(params) { export function getList(params) {
return request({ return request({
url: service + '/list', url: service + '/list',
method: 'get',
params params
}) })
} }
...@@ -84,4 +85,13 @@ export function updateBirthday(data) { ...@@ -84,4 +85,13 @@ export function updateBirthday(data) {
method: 'PUT', method: 'PUT',
data data
}) })
}
// 导出用户
export function exportCustomer(query) {
return request({
url: service + '/export',
method: 'get',
params: query
})
} }
\ No newline at end of file \ No newline at end of file
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: "", // "客户名称", name: "", // "客户名称",
userId: "", // "添加人id", userIds: "", // "添加人id",
tagIds: "", // "标签id,多个标签,id使用逗号隔开", tagIds: "", // "标签id,多个标签,id使用逗号隔开",
beginTime: "", // "开始时间", beginTime: "", // "开始时间",
endTime: "", // "结束时间" endTime: "", // "结束时间"
...@@ -96,6 +96,9 @@ export default { ...@@ -96,6 +96,9 @@ export default {
if (this.dateRange[0]) { if (this.dateRange[0]) {
this.query.beginTime = this.dateRange[0]; this.query.beginTime = this.dateRange[0];
this.query.endTime = this.dateRange[1]; this.query.endTime = this.dateRange[1];
}else {
this.query.beginTime = "";
this.query.endTime = "";
} }
page && (this.query.pageNum = page); page && (this.query.pageNum = page);
this.loading = true; this.loading = true;
...@@ -173,11 +176,30 @@ export default { ...@@ -173,11 +176,30 @@ export default {
api.sync().then(() => { api.sync().then(() => {
loading.close(); loading.close();
this.msgSuccess("后台开始同步数据,请稍后关注进度"); this.msgSuccess("后台开始同步数据,请稍后关注进度");
}); }).catch(fail => {
loading.close();
console.log(fail)
});;
},
/** 导出按钮操作 */
exportCustomer() {
const queryParams = this.query;
this.$confirm("是否确认导出所有客户数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return api.exportCustomer(queryParams);
})
.then((response) => {
this.download(response.msg);
})
.catch(function () {});
}, },
selectedUser(list) { selectedUser(list) {
this.queryUser = list; this.queryUser = list;
this.query.userId = list.map((d) => d.id) + ""; this.query.userIds = list.map((d) => d.userId) + "";
}, },
submitSelectTag(formName) { submitSelectTag(formName) {
if (this.tagDialogType.type === "query") { if (this.tagDialogType.type === "query") {
...@@ -267,7 +289,7 @@ export default { ...@@ -267,7 +289,7 @@ export default {
<el-button <el-button
v-hasPermi="['customerManage:customer:export']" v-hasPermi="['customerManage:customer:export']"
type="cyan" type="cyan"
@click="isMoreFilter = !isMoreFilter" @click="exportCustomer"
>导出列表</el-button> >导出列表</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
......
...@@ -10,6 +10,8 @@ import com.linkwechat.wecom.domain.dto.customer.ExternalUserDetail; ...@@ -10,6 +10,8 @@ import com.linkwechat.wecom.domain.dto.customer.ExternalUserDetail;
import com.linkwechat.wecom.domain.dto.customer.ExternalUserList; import com.linkwechat.wecom.domain.dto.customer.ExternalUserList;
import com.linkwechat.wecom.domain.dto.customer.FollowUserList; import com.linkwechat.wecom.domain.dto.customer.FollowUserList;
import java.util.Map;
/** /**
* @description: 获取配置客户联系人功能的成员 * @description: 获取配置客户联系人功能的成员
* @author: HaoN * @author: HaoN
...@@ -42,6 +44,14 @@ public interface WeCustomerClient { ...@@ -42,6 +44,14 @@ public interface WeCustomerClient {
@Request(url = "/externalcontact/get") @Request(url = "/externalcontact/get")
ExternalUserDetail get(@Query("external_userid") String externalUserid); ExternalUserDetail get(@Query("external_userid") String externalUserid);
/**
* 根据企业成员id批量获取客户详情
* @param query
* @return
*/
@Request(url = "/externalcontact/batch/get_by_user", type = "POST")
ExternalUserList getByUser(@DataObject Map<String,Object> query);
/** /**
* 修改客户备注信息 * 修改客户备注信息
......
...@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableField; ...@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.annotation.Excel;
import com.linkwechat.common.annotation.Excels;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -29,7 +31,7 @@ import javax.validation.constraints.NotBlank; ...@@ -29,7 +31,7 @@ import javax.validation.constraints.NotBlank;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName("we_customer") @TableName("we_customer")
public class WeCustomer public class WeCustomer extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -40,15 +42,18 @@ public class WeCustomer ...@@ -40,15 +42,18 @@ public class WeCustomer
private String externalUserid; private String externalUserid;
/** 外部联系人名称 */ /** 外部联系人名称 */
@Excel(name = "客户")
private String name; private String name;
/** 外部联系人头像 */ /** 外部联系人头像 */
private String avatar; private String avatar;
/** 外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户 */ /** 外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户 */
@Excel(name = "客户类型", readConverterExp = "1=微信,2=企业微信")
private Integer type; private Integer type;
/** 外部联系人性别 0-未知 1-男性 2-女性 */ /** 外部联系人性别 0-未知 1-男性 2-女性 */
@Excel(name = "性别", readConverterExp = "0=未知,1=男性,2=女性")
private Integer gender; private Integer gender;
/** 外部联系人在微信开放平台的唯一身份标识,通过此字段企业可将外部联系人与公众号/小程序用户关联起来。 */ /** 外部联系人在微信开放平台的唯一身份标识,通过此字段企业可将外部联系人与公众号/小程序用户关联起来。 */
...@@ -60,6 +65,7 @@ public class WeCustomer ...@@ -60,6 +65,7 @@ public class WeCustomer
/** 客户企业简称 */ /** 客户企业简称 */
@Excel(name = "公司名称")
private String corpName; private String corpName;
/** 客户企业全称 */ /** 客户企业全称 */
...@@ -72,8 +78,12 @@ public class WeCustomer ...@@ -72,8 +78,12 @@ public class WeCustomer
@TableField(exist = false) @TableField(exist = false)
private List<WeFlowerCustomerRel> weFlowerCustomerRels; private List<WeFlowerCustomerRel> weFlowerCustomerRels;
/** 添加人id */
@TableField(exist = false)
private String userIds;
/** 标签 */
@TableField(exist = false)
private String tagIds;
} }
...@@ -21,6 +21,7 @@ public class ExternalUserDetail extends WeResultDto { ...@@ -21,6 +21,7 @@ public class ExternalUserDetail extends WeResultDto {
/** 客户联系人 */ /** 客户联系人 */
private List<FollowUser> follow_user; private List<FollowUser> follow_user;
private List<FollowInfo> follow_info;
@Data @Data
...@@ -68,4 +69,24 @@ public class ExternalUserDetail extends WeResultDto { ...@@ -68,4 +69,24 @@ public class ExternalUserDetail extends WeResultDto {
private List<ExternalUserTag> tags; private List<ExternalUserTag> tags;
} }
@Data
public class FollowInfo{
/**该成员对此外部联系人的备注*/
private String remark;
/**该成员对此外部联系人的描述*/
private String description;
/**该成员添加此外部联系人的时间*/
private long createtime;
/**该成员对此客户备注的企业名称*/
private String remark_company;
/**该成员对此客户备注的手机号码*/
private String[] remark_mobiles;
/**该成员添加此客户的来源*/
private Integer add_way;
/**发起添加的userid,如果成员主动添加,为成员的userid;如果是客户主动添加,则为客户的外部联系人userid;如果是内部成员共享/管理员分配,则为对应的成员/管理员userid*/
private String oper_userid;
/**标签**/
private String[] tag_id;
}
} }
...@@ -3,6 +3,8 @@ package com.linkwechat.wecom.domain.dto.customer; ...@@ -3,6 +3,8 @@ package com.linkwechat.wecom.domain.dto.customer;
import com.linkwechat.wecom.domain.dto.WeResultDto; import com.linkwechat.wecom.domain.dto.WeResultDto;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @description: 客户列表 * @description: 客户列表
* @author: HaoN * @author: HaoN
...@@ -11,4 +13,6 @@ import lombok.Data; ...@@ -11,4 +13,6 @@ import lombok.Data;
@Data @Data
public class ExternalUserList extends WeResultDto { public class ExternalUserList extends WeResultDto {
private String[] external_userid; private String[] external_userid;
private List<ExternalUserDetail> external_contact_list;
private String next_cursor;
} }
...@@ -18,10 +18,10 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer> ...@@ -18,10 +18,10 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
/** /**
* 查询企业微信客户 * 查询企业微信客户
* *
* @param id 企业微信客户ID * @param externalUserId 企业微信客户ID
* @return 企业微信客户 * @return 企业微信客户
*/ */
public WeCustomer selectWeCustomerById(Long id); public WeCustomer selectWeCustomerById(String externalUserId);
/** /**
* 查询企业微信客户列表 * 查询企业微信客户列表
...@@ -50,18 +50,18 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer> ...@@ -50,18 +50,18 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
/** /**
* 删除企业微信客户 * 删除企业微信客户
* *
* @param id 企业微信客户ID * @param externalUserId 企业微信客户ID
* @return 结果 * @return 结果
*/ */
public int deleteWeCustomerById(Long id); public int deleteWeCustomerById(String externalUserId);
/** /**
* 批量删除企业微信客户 * 批量删除企业微信客户
* *
* @param ids 需要删除的数据ID * @param externalUserIds 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int deleteWeCustomerByIds(Long[] ids); public int deleteWeCustomerByIds(String[] externalUserIds);
/** /**
......
...@@ -19,10 +19,19 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -19,10 +19,19 @@ public interface IWeCustomerService extends IService<WeCustomer>
/** /**
* 查询企业微信客户 * 查询企业微信客户
* *
* @param id 企业微信客户ID * @param externalUserId 企业微信客户ID
* @return 企业微信客户 * @return 企业微信客户
*/ */
public WeCustomer selectWeCustomerById(Long id); public WeCustomer selectWeCustomerById(String externalUserId);
/**
* 新增/修改企业微信客户
*
* @param weCustomer 企业微信客户
* @return 修改结果
*/
@Override
public boolean saveOrUpdate(WeCustomer weCustomer);
/** /**
* 查询企业微信客户列表 * 查询企业微信客户列表
......
...@@ -96,6 +96,7 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService { ...@@ -96,6 +96,7 @@ public class WeAccessTokenServiceImpl implements IWeAccessTokenService {
if(StringUtils.isNotEmpty(token)){ if(StringUtils.isNotEmpty(token)){
redisCache.setCacheObject(accessTokenKey,token,expires_in.intValue(), TimeUnit.SECONDS); redisCache.setCacheObject(accessTokenKey,token,expires_in.intValue(), TimeUnit.SECONDS);
weAccessToken = token;
} }
} }
......
...@@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectWeCustomerVo"> <sql id="selectWeCustomerVo">
select id, external_userid, name, avatar, type, gender, unionid, birthday, corp_name, corp_full_name, position from we_customer select external_userid, name, avatar, type, gender, unionid, birthday, corp_name, corp_full_name, position from we_customer
</sql> </sql>
<select id="selectWeCustomerList" parameterType="WeCustomer" resultMap="WeCustomerResult"> <select id="selectWeCustomerList" parameterType="WeCustomer" resultMap="WeCustomerResult">
...@@ -73,17 +73,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -73,17 +73,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
<where>
<if test="name != null and name !=''">
AND wc.name like concat('%', #{name}, '%')
</if>
<if test="userIds != null and userIds !=''">
<if test="userIds.indexOf(',') != -1">
and wfcr.user_id in
<foreach item="item" index="index" collection="userIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="userIds.indexOf(',') == -1">
and wfcr.user_id=#{userIds}
</if>
</if>
<if test="tagIds != null and tagIds !=''">
<if test="tagIds.indexOf(',') != -1">
and wt.tag_id in
<foreach item="item" index="index" collection="tagIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="tagIds.indexOf(',') == -1">
and wt.tag_id=#{tagIds}
</if>
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
</where>
</select> </select>
<select id="selectWeCustomerById" parameterType="Long" resultMap="WeCustomerResult"> <select id="selectWeCustomerById" parameterType="String" resultMap="WeCustomerResult">
<include refid="selectWeCustomerVo"/> <include refid="selectWeCustomerVo"/>
where id = #{id} where external_userid = #{externalUserId}
</select> </select>
<insert id="insertWeCustomer" parameterType="WeCustomer"> <insert id="insertWeCustomer" parameterType="WeCustomer">
insert into we_customer insert into we_customer
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="externalUserid != null">external_userid,</if> <if test="externalUserid != null">external_userid,</if>
<if test="name != null">name,</if> <if test="name != null">name,</if>
<if test="avatar != null">avatar,</if> <if test="avatar != null">avatar,</if>
...@@ -96,7 +129,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -96,7 +129,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="position != null">position,</if> <if test="position != null">position,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="externalUserid != null">#{externalUserid},</if> <if test="externalUserid != null">#{externalUserid},</if>
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
<if test="avatar != null">#{avatar},</if> <if test="avatar != null">#{avatar},</if>
...@@ -124,17 +156,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -124,17 +156,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="corpFullName != null">corp_full_name = #{corpFullName},</if> <if test="corpFullName != null">corp_full_name = #{corpFullName},</if>
<if test="position != null">position = #{position},</if> <if test="position != null">position = #{position},</if>
</trim> </trim>
where id = #{id} where external_userid = #{externalUserid}
</update> </update>
<delete id="deleteWeCustomerById" parameterType="Long"> <delete id="deleteWeCustomerById" parameterType="String">
delete from we_customer where id = #{id} delete from we_customer where external_userid = #{externalUserId}
</delete> </delete>
<delete id="deleteWeCustomerByIds" parameterType="String"> <delete id="deleteWeCustomerByIds">
delete from we_customer where id in delete from we_customer where external_userid in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="item" collection="array" open="(" separator="," close=")">
#{id} #{item}
</foreach> </foreach>
</delete> </delete>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!