Commit 2354915d by danmo

Merge remote-tracking branch 'origin/back_end_dev_2.0' into back_end_dev_2.0

2 parents 4bbf0657 90400195
...@@ -65,7 +65,7 @@ public class WeCustomerController extends BaseController ...@@ -65,7 +65,7 @@ public class WeCustomerController extends BaseController
iWeSynchRecordService.findUpdateLatestTime(SynchRecordConstants.SYNCH_CUSTOMER) iWeSynchRecordService.findUpdateLatestTime(SynchRecordConstants.SYNCH_CUSTOMER)
);//最近同步时间 );//最近同步时间
dataTable.setNoRepeatCustomerTotal( dataTable.setNoRepeatCustomerTotal(
weCustomerService.noRepeatCountCustomer() weCustomerService.noRepeatCountCustomer(weCustomerList)
);//去重客户数 );//去重客户数
return dataTable; return dataTable;
......
...@@ -37,8 +37,7 @@ public class WeCustomerSeasController extends BaseController { ...@@ -37,8 +37,7 @@ public class WeCustomerSeasController extends BaseController {
@Autowired
private IWeMessagePushService iWeMessagePushService;
/** /**
* 客户公海模版下载 * 客户公海模版下载
...@@ -75,9 +74,29 @@ public class WeCustomerSeasController extends BaseController { ...@@ -75,9 +74,29 @@ public class WeCustomerSeasController extends BaseController {
if(CollectionUtil.isEmpty(deduplicationSeas)){ if(CollectionUtil.isEmpty(deduplicationSeas)){
return AjaxResult.error("导入用户数据不能为空!"); return AjaxResult.error("导入用户数据不能为空!");
} }
//跟根据手机号去重 //根据手机号去重(去除excel中重复的号码)
List<WeCustomerSeas> deduplicationSeasNoRepeat=deduplicationSeas.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> List<WeCustomerSeas> deduplicationSeasNoRepeat=deduplicationSeas.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(WeCustomerSeas :: getPhone))), ArrayList::new)); new TreeSet<>(Comparator.comparing(WeCustomerSeas :: getPhone))), ArrayList::new));
//根据手机号去除数据库与excel中重复号码
List<WeCustomerSeas> dbExist = iWeCustomerSeasService.list(new LambdaQueryWrapper<WeCustomerSeas>()
.in(WeCustomerSeas::getPhone, deduplicationSeasNoRepeat.stream()
.map(WeCustomerSeas::getPhone).collect(Collectors.toList())));
if(CollectionUtil.isNotEmpty(dbExist)){
List<WeCustomerSeas> noRepetWeCustomerSeas
= deduplicationSeasNoRepeat.stream().filter(item ->
!dbExist.stream().map(e->e.getPhone()).collect(Collectors.toList())
.contains(item.getPhone())).collect(Collectors.toList());
deduplicationSeasNoRepeat.clear();
deduplicationSeasNoRepeat.addAll(
noRepetWeCustomerSeas
);
}
if(CollectionUtil.isNotEmpty(deduplicationSeasNoRepeat)){
Long tabaleExcelId= SnowFlakeUtil.nextId(); Long tabaleExcelId= SnowFlakeUtil.nextId();
List<String> userIds = ListUtil.toList(weCustomerSea.getAddUserId().split(",")); List<String> userIds = ListUtil.toList(weCustomerSea.getAddUserId().split(","));
...@@ -94,7 +113,23 @@ public class WeCustomerSeasController extends BaseController { ...@@ -94,7 +113,23 @@ public class WeCustomerSeasController extends BaseController {
k.setTableExcelId(tabaleExcelId); k.setTableExcelId(tabaleExcelId);
} }
}); });
iWeCustomerSeasService.saveBatch(deduplicationSeasNoRepeat); if(iWeCustomerSeasService.saveBatch(deduplicationSeasNoRepeat)){
//发送提醒
deduplicationSeasNoRepeat.stream().collect(Collectors.groupingBy(WeCustomerSeas::getAddUserId)).forEach((k,v)->{
iWeCustomerSeasService.remidUser(ListUtil.toList(k),v.size());
});
}
}
}else{ }else{
return AjaxResult.error("导入用户数据不能为空!"); return AjaxResult.error("导入用户数据不能为空!");
} }
...@@ -114,10 +149,11 @@ public class WeCustomerSeasController extends BaseController { ...@@ -114,10 +149,11 @@ public class WeCustomerSeasController extends BaseController {
startPage(); startPage();
List<WeCustomerSeas> weCustomerSeas = iWeCustomerSeasService.list( List<WeCustomerSeas> weCustomerSeas = iWeCustomerSeasService.list(
new LambdaQueryWrapper<WeCustomerSeas>() new LambdaQueryWrapper<WeCustomerSeas>()
.eq(StringUtils.isNotEmpty(weCustomerSea.getPhone()),WeCustomerSeas::getPhone,weCustomerSea.getPhone()) .like(StringUtils.isNotEmpty(weCustomerSea.getPhone()),WeCustomerSeas::getPhone,weCustomerSea.getPhone())
.like(StringUtils.isNotEmpty(weCustomerSea.getCustomerName()),WeCustomerSeas::getCustomerName,weCustomerSea.getCustomerName()) .like(StringUtils.isNotEmpty(weCustomerSea.getCustomerName()),WeCustomerSeas::getCustomerName,weCustomerSea.getCustomerName())
.like(StringUtils.isNotEmpty(weCustomerSea.getAddUserName()),WeCustomerSeas::getAddUserName,weCustomerSea.getAddUserName()) .like(StringUtils.isNotEmpty(weCustomerSea.getAddUserName()),WeCustomerSeas::getAddUserName,weCustomerSea.getAddUserName())
.eq(weCustomerSea.getAddState() !=null ,WeCustomerSeas::getAddState,weCustomerSea.getAddState()) .eq(weCustomerSea.getAddState() !=null ,WeCustomerSeas::getAddState,weCustomerSea.getAddState())
.orderByDesc(WeCustomerSeas::getCreateTime)
); );
return getDataTable(weCustomerSeas); return getDataTable(weCustomerSeas);
...@@ -152,9 +188,8 @@ public class WeCustomerSeasController extends BaseController { ...@@ -152,9 +188,8 @@ public class WeCustomerSeasController extends BaseController {
if(CollectionUtil.isNotEmpty(weCustomerSeas)){ if(CollectionUtil.isNotEmpty(weCustomerSeas)){
weCustomerSeas.stream().collect(Collectors.groupingBy(WeCustomerSeas::getAddUserId)).forEach((k,v)->{ weCustomerSeas.stream().collect(Collectors.groupingBy(WeCustomerSeas::getAddUserId)).forEach((k,v)->{
iWeCustomerSeasService.remidUser(ListUtil.toList(k),v.size());
iWeMessagePushService.pushMessageSelfH5(ListUtil.toList(k),
"管理员给你分配了"+v.size()+"个客户还未添加,快去复制电话号码添加客户吧,", CommunityTaskType.SEAS.getType());
}); });
......
...@@ -21,7 +21,7 @@ public class WeCustomerList { ...@@ -21,7 +21,7 @@ public class WeCustomerList {
//客户名称 //客户名称
private String customerName; private String customerName;
//客户类型 //客户类型 1:微信用户,2:企业用户
private Integer customerType; private Integer customerType;
//查询标签id(企业标签id) //查询标签id(企业标签id)
......
...@@ -74,7 +74,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer> ...@@ -74,7 +74,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* 去重复统计 * 去重复统计
* @return * @return
*/ */
long noRepeatCountCustomer(); long noRepeatCountCustomer(@Param("weCustomerList") WeCustomerList weCustomerList);
} }
...@@ -14,4 +14,7 @@ public interface IWeCustomerSeasService extends IService<WeCustomerSeas> { ...@@ -14,4 +14,7 @@ public interface IWeCustomerSeasService extends IService<WeCustomerSeas> {
List<CustomerSeasRecordVo> findSeasRecord(Integer groupByType); List<CustomerSeasRecordVo> findSeasRecord(Integer groupByType);
void remidUser(List<String> addUserIds,Integer customerNum);
} }
...@@ -128,7 +128,7 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -128,7 +128,7 @@ public interface IWeCustomerService extends IService<WeCustomer>
* 去重统计 * 去重统计
* @return * @return
*/ */
long noRepeatCountCustomer(); long noRepeatCountCustomer(WeCustomerList weCustomerList);
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.WeCustomerSeas; import com.linkwechat.wecom.domain.WeCustomerSeas;
import com.linkwechat.wecom.domain.vo.CustomerSeasCountVo; import com.linkwechat.wecom.domain.vo.CustomerSeasCountVo;
import com.linkwechat.wecom.domain.vo.CustomerSeasRecordVo; import com.linkwechat.wecom.domain.vo.CustomerSeasRecordVo;
import com.linkwechat.wecom.mapper.WeCustomerSeasMapper; import com.linkwechat.wecom.mapper.WeCustomerSeasMapper;
import com.linkwechat.wecom.service.IWeCustomerSeasService; import com.linkwechat.wecom.service.IWeCustomerSeasService;
import com.linkwechat.wecom.service.IWeMessagePushService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
@Service @Service
public class WeCustomerSeasServiceImpl extends ServiceImpl<WeCustomerSeasMapper, WeCustomerSeas> implements IWeCustomerSeasService { public class WeCustomerSeasServiceImpl extends ServiceImpl<WeCustomerSeasMapper, WeCustomerSeas> implements IWeCustomerSeasService {
@Autowired
private IWeMessagePushService iWeMessagePushService;
@Override @Override
public CustomerSeasCountVo countCustomerSeas() { public CustomerSeasCountVo countCustomerSeas() {
...@@ -31,4 +33,12 @@ public class WeCustomerSeasServiceImpl extends ServiceImpl<WeCustomerSeasMapper, ...@@ -31,4 +33,12 @@ public class WeCustomerSeasServiceImpl extends ServiceImpl<WeCustomerSeasMapper,
return this.baseMapper.findSeasRecord(groupByType); return this.baseMapper.findSeasRecord(groupByType);
} }
@Override
@Async
public void remidUser(List<String> addUserIds, Integer customerNum) {
iWeMessagePushService.pushMessageSelfH5(addUserIds,
"管理员给你分配了"+customerNum+"个客户还未添加,快去复制电话号码添加客户吧,", CommunityTaskType.SEAS.getType());
}
} }
...@@ -134,6 +134,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -134,6 +134,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
WeCustomer weCustomer = new WeCustomer(); WeCustomer weCustomer = new WeCustomer();
BeanUtils.copyPropertiesignoreOther(userDetail.getExternal_contact(), weCustomer); BeanUtils.copyPropertiesignoreOther(userDetail.getExternal_contact(), weCustomer);
weCustomer.setCustomerType(userDetail.getExternal_contact().getType()); weCustomer.setCustomerType(userDetail.getExternal_contact().getType());
weCustomer.setCustomerName(userDetail.getExternal_contact().getName());
Optional.ofNullable(userDetail.getFollow_info()).ifPresent(followInfo -> { Optional.ofNullable(userDetail.getFollow_info()).ifPresent(followInfo -> {
weCustomer.setFirstUserId(followInfo.getUserid()); weCustomer.setFirstUserId(followInfo.getUserid());
...@@ -792,9 +793,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -792,9 +793,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
* @return * @return
*/ */
@Override @Override
public long noRepeatCountCustomer() { public long noRepeatCountCustomer(WeCustomerList weCustomerList) {
return this.baseMapper.noRepeatCountCustomer(); return this.baseMapper.noRepeatCountCustomer(weCustomerList);
} }
......
...@@ -125,7 +125,7 @@ public class WeMessagePushServiceImpl implements IWeMessagePushService { ...@@ -125,7 +125,7 @@ public class WeMessagePushServiceImpl implements IWeMessagePushService {
if(StringUtils.isEmpty( validWeCorpAccount.getSeasRedirectUrl())){ if(StringUtils.isEmpty( validWeCorpAccount.getSeasRedirectUrl())){
throw new WeComException("客户公海H5跳转链接不可为空"); throw new WeComException("客户公海H5跳转链接不可为空");
} }
URLEncoder.encode(String.format("%s?corpId=%s&agentId=%s", REDIRECT_URI=URLEncoder.encode(String.format("%s?corpId=%s&agentId=%s",
validWeCorpAccount.getSeasRedirectUrl() validWeCorpAccount.getSeasRedirectUrl()
, corpId, agentId)); , corpId, agentId));
}else{//群sop与老客标签建群 }else{//群sop与老客标签建群
......
...@@ -69,11 +69,13 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr ...@@ -69,11 +69,13 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
List<WeTag> weTags = weTagGroup.getWeTags(); List<WeTag> weTags = weTagGroup.getWeTags();
if (CollectionUtil.isEmpty(weTags)) { if(this.save(weTagGroup)){
this.save(weTagGroup); if(CollectionUtil.isNotEmpty(weTags)){
} else { weTags.stream().forEach(k->{
k.setGroupId(weTagGroup.getGroupId());
});
//个人标签同步,企业微信 //客户标签
if(weTagGroup.getGroupTagType().equals(new Integer(1))){ if(weTagGroup.getGroupTagType().equals(new Integer(1))){
weTagGroup.setAddWeTags( weTagGroup.setAddWeTags(
weTags weTags
...@@ -83,10 +85,21 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr ...@@ -83,10 +85,21 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
this.batchSaveOrUpdateTagGroupAndTag(ListUtil.toList(weCropGropTagDtlDto.getTag_group()), false); this.batchSaveOrUpdateTagGroupAndTag(ListUtil.toList(weCropGropTagDtlDto.getTag_group()), false);
} }
}else{ }else{
iWeTagService.saveBatch(weTags); iWeTagService.saveBatch(weTags);
} }
}
} }
// if (CollectionUtil.isEmpty(weTags)) {
// this.save(weTagGroup);
// } else {
//
//
//
// }
......
...@@ -32,6 +32,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -32,6 +32,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND wc.gender=#{weCustomerList.gender} AND wc.gender=#{weCustomerList.gender}
</if> </if>
<if test="weCustomerList.trackState !=null">
AND wc.track_state=#{weCustomerList.trackState}
</if>
<if test="weCustomerList.addMethod !=null">
AND wc.add_method=#{weCustomerList.addMethod}
</if>
<if test="weCustomerList.customerType !=null">
AND wc.customer_type=#{weCustomerList.customerType}
</if>
<if test="weCustomerList.externalUserid !=null"> <if test="weCustomerList.externalUserid !=null">
AND wc.external_userid=#{weCustomerList.externalUserid} AND wc.external_userid=#{weCustomerList.externalUserid}
</if> </if>
...@@ -69,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -69,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</if> </if>
<if test="weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null"> <if test="weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null">
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.beginTime.endTime} AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.endTime}
</if> </if>
</where> </where>
GROUP BY wc.external_userid,wc.first_user_id GROUP BY wc.external_userid,wc.first_user_id
...@@ -169,12 +181,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -169,12 +181,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
external_userid, external_userid,
NAME, NAME,
avatar, avatar,
type, customer_type,
gender, gender,
unionid, unionid,
birthday, birthday,
corp_name, corp_name,
corp_full_name,
position, position,
is_open_chat, is_open_chat,
create_time, create_time,
...@@ -188,20 +199,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -188,20 +199,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
add_method add_method
) values ) values
<foreach collection="weCustomers" item="item" index="index" separator=","> <foreach collection="weCustomers" item="item" index="index" separator=",">
(#{item.externalUserid},#{item.name},#{item.avatar},#{item.type},#{item.gender}, #{item.unionid},#{item.birthday}, (#{item.externalUserid},#{item.customerName},#{item.avatar},#{item.customerType},#{item.gender}, #{item.unionid},#{item.birthday},
#{item.corpName},#{item.corpFullName},#{item.position},#{item.isOpenChat}, #{item.createTime}, #{item.corpName},#{item.position},#{item.isOpenChat}, #{item.createTime},
#{item.createBy},#{item.firstUserId},#{item.firstAddTime},#{item.qq},#{item.email},#{item.address},#{item.phone},#{item.addMethod} #{item.createBy},#{item.firstUserId},#{item.firstAddTime},#{item.qq},#{item.email},#{item.address},#{item.phone},#{item.addMethod}
) )
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
NAME=IF(we_customer.NAME != null, VALUES(NAME), we_customer.NAME), NAME=IF(we_customer.NAME != null,we_customer.NAME, VALUES(NAME)),
avatar=IF(we_customer.avatar != null, VALUES(avatar), we_customer.avatar), avatar=IF(we_customer.avatar != null, VALUES(avatar), we_customer.avatar),
type=IF(we_customer.type != null, VALUES(type), we_customer.type), customer_type=IF(we_customer.customer_type != null, VALUES(customer_type), we_customer.customer_type),
gender=IF(we_customer.gender != null, VALUES(gender), we_customer.gender), gender=IF(we_customer.gender != null, VALUES(gender), we_customer.gender),
unionid=IF(we_customer.unionid != null, VALUES(unionid), we_customer.unionid), unionid=IF(we_customer.unionid != null, VALUES(unionid), we_customer.unionid),
birthday=IF(we_customer.birthday != null,VALUES(birthday), we_customer.birthday), birthday=IF(we_customer.birthday != null,VALUES(birthday), we_customer.birthday),
corp_name=IF(we_customer.corp_name != null, VALUES(corp_name), we_customer.corp_name), corp_name=IF(we_customer.corp_name != null, VALUES(corp_name), we_customer.corp_name),
corp_full_name=IF(we_customer.corp_full_name != null, VALUES(corp_full_name), we_customer.corp_full_name),
position=IF(we_customer.position != null, VALUES(position), we_customer.position), position=IF(we_customer.position != null, VALUES(position), we_customer.position),
is_open_chat=IF(we_customer.is_open_chat != null, VALUES(is_open_chat), we_customer.is_open_chat), is_open_chat=IF(we_customer.is_open_chat != null, VALUES(is_open_chat), we_customer.is_open_chat),
first_user_id=IF(we_customer.first_user_id != null, VALUES(first_user_id), we_customer.first_user_id), first_user_id=IF(we_customer.first_user_id != null, VALUES(first_user_id), we_customer.first_user_id),
...@@ -215,7 +225,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -215,7 +225,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="noRepeatCountCustomer" resultType="long"> <select id="noRepeatCountCustomer" resultType="long">
SELECT COUNT(DISTINCT external_userid) FROM we_customer where del_flag=0 SELECT
COUNT(DISTINCT wc.external_userid)
FROM
we_customer wc
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.del_flag=0 AND wfctr.external_userid=wc.external_userid AND wfctr.user_id=wc.first_user_id
LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
<where>
<if test="weCustomerList.gender !=null">
AND wc.gender=#{weCustomerList.gender}
</if>
<if test="weCustomerList.trackState !=null">
AND wc.track_state=#{weCustomerList.trackState}
</if>
<if test="weCustomerList.addMethod !=null">
AND wc.add_method=#{weCustomerList.addMethod}
</if>
<if test="weCustomerList.customerType !=null">
AND wc.customer_type=#{weCustomerList.customerType}
</if>
<if test="weCustomerList.externalUserid !=null">
AND wc.external_userid=#{weCustomerList.externalUserid}
</if>
<if test="weCustomerList.firstUserId !=null">
AND wc.first_user_id=#{weCustomerList.firstUserId}
</if>
<if test="weCustomerList.departmentIds != null and weCustomerList.departmentIds !=''">
<if test="weCustomerList.departmentIds.indexOf(',') != -1">
OR wu.department in
<foreach item="item" index="index" collection="weCustomerList.departmentIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="weCustomerList.delFlag != null">
AND wc.del_flag = #{weCustomerList.delFlag}
</if>
<if test="weCustomerList.name != null and weCustomerList.name !=''">
AND wc.`name` like concat('%',#{weCustomerList.name,jdbcType=VARCHAR},'%')
</if>
<if test="weCustomerList.userIds !=null and weCustomerList.userIds !=''">
AND wc.first_user_id in
<foreach collection="weCustomerList.userIds.split(',')" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="weCustomerList.tagIds !=null and weCustomerList.tagIds !=''">
AND wt.tag_id in
<foreach collection="weCustomerList.tagIds.split(',')" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null">
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.endTime}
</if>
</where>
</select> </select>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<where> <where>
<if test="delFlag !=null"> wg.del_flag=#{delFlag}</if> <if test="delFlag !=null"> wg.del_flag=#{delFlag}</if>
<if test="groupName != null and groupName != ''"> and wg.group_name like concat('%', #{groupName}, '%')</if> <if test="groupName != null and groupName != ''"> and wg.group_name like concat('%', #{groupName}, '%')</if>
<if test="groupLeader != null and groupLeader != ''"> and wu.user_name like concat('%', #{groupLeader}, '%')</if> <if test="groupLeader != null and groupLeader != ''"> and wu.user_name like concat('%', #{groupLeaderName}, '%')</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 --> <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wg.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d') AND date_format(wg.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if> </if>
......
...@@ -4,40 +4,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -4,40 +4,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeTagGroupMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WeTagGroupMapper">
<sql id="selectWeTagGroupVo">
select gourp_name, create_time from we_tag_group
</sql>
<resultMap type="WeTagGroup" id="WeTagGroupResult"> <resultMap type="WeTagGroup" id="WeTagGroupResult">
<result property="gourpName" column="gourp_name" /> <result property="gourpName" column="gourp_name" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="groupId" column="group_id" /> <result property="groupId" column="group_id" />
<collection property="weTags" column="weTags.id" ofType="com.linkwechat.wecom.domain.WeTag"> <collection property="weTags"
select="findWeTag"
column="{groupId=group_id}">
</collection>
</resultMap>
<resultMap id="WeTagBaseMapper" type="com.linkwechat.wecom.domain.WeTag">
<id property="tagId" column="tag_id"/> <id property="tagId" column="tag_id"/>
<result property="groupId" column="tag_group_id" /> <result property="groupId" column="group_id" />
<result property="name" column="name" /> <result property="name" column="name" />
</collection>
</resultMap> </resultMap>
<sql id="selectWeTagGroupVo">
select gourp_name, create_time from we_tag_group
</sql>
<select id="selectWeTagGroupList" parameterType="WeTagGroup" resultMap="WeTagGroupResult"> <select id="selectWeTagGroupList" parameterType="WeTagGroup" resultMap="WeTagGroupResult">
SELECT SELECT
wtg.*, wtg.*
wt.tag_id ,
wt.group_id,
wt.name,
wtg.create_by,
wtg.group_id as tag_group_id
FROM FROM
we_tag_group wtg we_tag_group wtg
LEFT JOIN we_tag wt ON wtg.group_id = wt.group_id
where where
wtg.del_flag=0 and wt.del_flag=0 wtg.del_flag=0
<if test="gourpName != null and gourpName != ''"> and gourp_name like concat('%', #{gourpName}, '%')</if>
<if test="groupTagType != null">and wtg.group_tag_type=#{groupTagType}</if> <if test="groupTagType != null">and wtg.group_tag_type=#{groupTagType}</if>
ORDER BY wtg.create_time DESC ORDER BY wtg.create_time DESC
</select> </select>
<select id="findWeTag" resultMap="WeTagBaseMapper">
SELECT
wt.tag_id ,
wt.group_id,
wt.name
FROM
we_tag wt
where
wt.group_id = #{groupId} and wt.del_flag=0
</select>
<select id="getWeTagGroupByIds" resultMap="WeTagGroupResult"> <select id="getWeTagGroupByIds" resultMap="WeTagGroupResult">
SELECT SELECT
wtg.*, wtg.*,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!