Commit 2316dd24 by xinlaa

Merge branch 'master' of https://gitee.com/LinkWeChat/link-wechat into master

2 parents f94049c8 1e2ae135
Showing 25 changed files with 763 additions and 22 deletions
...@@ -6,6 +6,7 @@ import org.mybatis.spring.annotation.MapperScan; ...@@ -6,6 +6,7 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableAsync;
/** /**
* 启动程序 * 启动程序
...@@ -15,6 +16,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; ...@@ -15,6 +16,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class }) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class })
@MapperScan("com.linkwechat.*.mapper") @MapperScan("com.linkwechat.*.mapper")
@ForestScan(basePackages = "com.linkwechat.wecom.client") @ForestScan(basePackages = "com.linkwechat.wecom.client")
@EnableAsync
public class LinkWeChatApplication public class LinkWeChatApplication
{ {
public static void main(String[] args) public static void main(String[] args)
......
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.service.IWeChatCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
@RequestMapping(value = "/wecom/chat/collection")
@RestController
public class WeChatCollectionController extends BaseController {
@Autowired
private IWeChatCollectionService weChatCollectionService;
/**
* 添加收藏
*/
@PreAuthorize("@ss.hasPermi('chat:collection:add')")
@Log(title = "添加收藏", businessType = BusinessType.INSERT)
@PutMapping
public AjaxResult addCollection(@RequestParam(value = "materialId") Long materialId,@RequestParam(value = "userId") Long userId) {
return toAjax(weChatCollectionService.addCollection(materialId, userId));
}
/**
* 取消收藏
*/
@PreAuthorize("@ss.hasPermi('chat:collection:delete')")
@Log(title = "取消收藏", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult cancleCollection(@RequestParam(value = "materialId") Long materialId,@RequestParam(value = "userId") Long userId) {
return toAjax(weChatCollectionService.cancleCollection(materialId, userId));
}
}
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.service.IWeChatItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 聊天工具侧边栏
* @author kewen
*/
@RequestMapping(value = "/wecom/chat/item")
@RestController
public class WeChatItemController extends BaseController {
@Autowired
private IWeChatItemService weChatItemService;
/**
* 侧边栏抓取素材
*/
@PreAuthorize("@ss.hasPermi('chat:item:add')")
@Log(title = "侧边栏抓取素材", businessType = BusinessType.INSERT)
@PutMapping
public AjaxResult add(@RequestBody WeChatItemDto chatItemDto) {
return toAjax(weChatItemService.checkItems(chatItemDto));
}
}
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeChatSide;
import com.linkwechat.wecom.service.IWeChatSideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 聊天工具侧边栏
* @author kewen
*/
@RequestMapping(value = "/wecom/chat/side")
@RestController
public class WeChatSideController extends BaseController {
@Autowired
public IWeChatSideService weChatSideService;
/**
* 群发侧边栏列表
*/
@PreAuthorize("@ss.hasPermi('chat:side:list')")
@GetMapping("/list")
public TableDataInfo list() {
startPage();
List<WeChatSide> weChatSides = weChatSideService.chatSides();
return getDataTable(weChatSides);
}
/**
* 更新侧边栏信息
*/
@PreAuthorize("@ss.hasPermi('chat:side:edit')")
@Log(title = "更新侧边栏信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WeChatSide weChatSide) {
return toAjax(weChatSideService.updateWeChatSide(weChatSide));
}
}
...@@ -22,7 +22,7 @@ import java.util.List; ...@@ -22,7 +22,7 @@ import java.util.List;
/** /**
* 企业微信客户Controller * 企业微信客户Controller
* *
* @author ruoyi * @author ruoyi
* @date 2020-09-13 * @date 2020-09-13
*/ */
...@@ -106,16 +106,12 @@ public class WeCustomerController extends BaseController ...@@ -106,16 +106,12 @@ public class WeCustomerController extends BaseController
@PreAuthorize("@ss.hasPermi('customerManage:customer:sync')") @PreAuthorize("@ss.hasPermi('customerManage:customer:sync')")
@Log(title = "企业微信客户同步接口", businessType = BusinessType.DELETE) @Log(title = "企业微信客户同步接口", businessType = BusinessType.DELETE)
@GetMapping("/synchWeCustomer") @GetMapping("/synchWeCustomer")
public AjaxResult synchWeCustomer(){ public AjaxResult synchWeCustomer() {
SecurityContext securityContext = SecurityContextHolder.getContext();
try { try {
Threads.SINGLE_THREAD_POOL.execute(new Runnable() { SecurityContext context = SecurityContextHolder.getContext();
@Override SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
public void run() { SecurityContextHolder.setContext(context);
SecurityContextHolder.setContext(securityContext); weCustomerService.synchWeCustomer();
weCustomerService.synchWeCustomer();
}
});
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -56,6 +56,11 @@ spring: ...@@ -56,6 +56,11 @@ spring:
max-file-size: 10MB max-file-size: 10MB
# 设置总上传的文件大小 # 设置总上传的文件大小
max-request-size: 20MB max-request-size: 20MB
task:
execution:
pool:
keep-alive: 10s
thread-name-prefix: common-pool-
# 服务模块 # 服务模块
devtools: devtools:
restart: restart:
......
...@@ -21,8 +21,14 @@ public class Threads ...@@ -21,8 +21,14 @@ public class Threads
/** /**
* 创建线程池 * 创建线程池
*/ */
public static final ThreadPoolExecutor SINGLE_THREAD_POOL = new ThreadPoolExecutor(CORE_POOL_SIZE, CORE_POOL_SIZE+1, 10l, TimeUnit.SECONDS, 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); new SynchronousQueue<>(), NAMED_THREAD_FACTORY, (r, executor) -> {
try {
executor.getQueue().put(r);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
......
package com.linkwechat.wecom.domain;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
@Data
public class WeChatCollection extends BaseEntity {
/**
* id
*/
private Long collectionId;
/**
* 素材id
*/
private Long materialId;
/**
* 用户id
*/
private Long userId;
}
package com.linkwechat.wecom.domain;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 聊天工具侧边栏
* @author kewen
*/
@Data
public class WeChatItem extends BaseEntity {
/**
* id
*/
private Long itemId;
/**
* 侧边栏id
*/
private Long sideId;
/**
* 素材id
*/
private Long materialId;
}
package com.linkwechat.wecom.domain;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 聊天工具侧边栏
* @author kewen
*/
@Data
public class WeChatSide extends BaseEntity {
/**
* 主键id
*/
private Long sideId;
/**
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
*/
private Long mediaType;
/**
* 聊天工具栏名称
*/
private String sideName;
/**
* 已抓取素材数量
*/
private Integer total;
/**
* 是否启用 0 启用 1 未启用
*/
private Integer using;
/**
* 0 未删除 1 已删除
*/
private int delFlag;
}
package com.linkwechat.wecom.domain.dto;
import lombok.Data;
import java.util.List;
/**
* 侧边栏素材
*
* @author kewen
*/
@Data
public class WeChatItemDto {
/**
* 素材id列表
*/
private List<Long> materialIds;
/**
* 侧边栏id
*/
private Long sideId;
/**
* 素材类型 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
*/
private String mediaType;
/**
* 是否全选 0 全选 1 非全选
*/
private String checkAll;
}
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatCollection;
import org.apache.ibatis.annotations.Param;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
/**
* 添加收藏
*
* @param chatCollection 收藏的素材信息
* @return 结果
*/
public int addCollection(WeChatCollection chatCollection);
/**
* 取消收藏
*
* @param materialId 素材id
* @param userId 用户id
* @return 结果
*/
public int dropCollection(@Param("materialId") Long materialId,@Param("userId") Long userId);
/**
* 通过素材id和用户id查询当前素材的收藏条数
*
* @param materialId 素材id
* @param userId 用户id
* @return 当前素材收藏的条数
*/
public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId,@Param("userId") Long userId);
}
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatItem;
import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 聊天工具侧边栏
* @author kewen
*/
public interface WeChatItemMapper extends BaseMapper<WeChatItem> {
/**
* 批量添加侧边栏素材
* @param items 侧边栏素材列表
* @return 结果
*/
public int addItem(@Param("items") List<WeChatItem> items);
/**
* 删除侧边栏素材
* @param sideId 侧边栏id
* @return 结果
*/
public int dropItem(@Param("sideId") Long sideId);
}
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatSide;
import java.util.List;
/**
* 聊天工具侧边栏
* @author kewen
*/
public interface WeChatSideMapper extends BaseMapper<WeChatSide> {
/**
* 查询侧边栏列表
*
* @return {@link WeChatSide}s
*/
public List<WeChatSide> selectWeChatSides();
/**
* 更新侧边栏信息
*
* @param weChatSide 侧边栏信息
* @return 结果
*/
public int updateWeChatSideById(WeChatSide weChatSide);
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeChatCollection;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
public interface IWeChatCollectionService extends IService<WeChatCollection> {
/**
* 添加收藏
*
* @param materialId 素材id
* @param userId 用户id
* @return 结果
*/
public int addCollection( Long materialId, Long userId);
/**
* 取消收藏
*
* @param materialId 素材id
* @param userId 用户id
* @return 结果
*/
public int cancleCollection( Long materialId, Long userId);
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeChatItem;
import com.linkwechat.wecom.domain.dto.WeChatItemDto;
/**
* 聊天工具侧边栏
* @author kewen
*/
public interface IWeChatItemService extends IService<WeChatItem> {
/**
* 侧边栏抓取素材
*
* @param chatItemDto 侧边栏素材
* @return 结果
*/
public int checkItems(WeChatItemDto chatItemDto);
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeChatSide;
import java.util.List;
/**
* 聊天工具侧边栏
* @author kewen
*/
public interface IWeChatSideService extends IService<WeChatSide> {
/**
* 群发侧边栏列表
*
* @return {@link WeChatSide}s
*/
public List<WeChatSide> chatSides();
/**
* 更新侧边栏信息
*
* @param weChatSide 侧边栏信息
* @return 结果
*/
public int updateWeChatSide(WeChatSide weChatSide);
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.domain.WeChatCollection;
import com.linkwechat.wecom.mapper.WeChatCollectionMapper;
import com.linkwechat.wecom.service.IWeChatCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
@Service
public class WeChatCollectionServiceImpl extends ServiceImpl<WeChatCollectionMapper, WeChatCollection> implements IWeChatCollectionService {
@Autowired
private WeChatCollectionMapper weChatCollectionMapper;
@Override
public int addCollection(Long materialId, Long userId) {
WeChatCollection chatCollection=new WeChatCollection();
chatCollection.setCollectionId(SnowFlakeUtil.nextId());
chatCollection.setMaterialId(materialId);
chatCollection.setUserId(userId);
return weChatCollectionMapper.addCollection(chatCollection);
}
@Override
public int cancleCollection(Long materialId, Long userId) {
return weChatCollectionMapper.dropCollection(materialId,userId);
}
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.domain.WeChatItem;
import com.linkwechat.wecom.domain.WeChatSide;
import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.mapper.WeChatItemMapper;
import com.linkwechat.wecom.mapper.WeChatSideMapper;
import com.linkwechat.wecom.service.IWeChatItemService;
import com.linkwechat.wecom.service.IWeMaterialService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
*
* 聊天工具侧边栏
* @author kewen
*/
@Service
public class WeChatItemServiceImpl extends ServiceImpl<WeChatItemMapper, WeChatItem> implements IWeChatItemService {
@Autowired
private WeChatItemMapper weChatItemMapper;
@Autowired
private IWeMaterialService weMaterialService;
@Autowired
private WeChatSideMapper weChatSideMapper;
@Override
public int checkItems(WeChatItemDto chatItemDto) {
List<Long> materialIds=new ArrayList<>();
if(chatItemDto.getCheckAll().equals("0")){
List<WeMaterial> weMaterials = weMaterialService.findWeMaterials(null, null, chatItemDto.getMediaType());
if(CollectionUtils.isNotEmpty(weMaterials)){
materialIds= weMaterials.stream().map(WeMaterial::getId).collect(Collectors.toList());
}
}else {
materialIds= chatItemDto.getMaterialIds();
}
List<Long> finalMaterialIds = materialIds;
Optional.ofNullable(materialIds).ifPresent(
s->{
List<WeChatItem> items=new ArrayList<>();
finalMaterialIds.forEach(materialId->{
WeChatItem item=new WeChatItem();
item.setItemId(SnowFlakeUtil.nextId());
item.setMaterialId(materialId);
item.setSideId(chatItemDto.getSideId());
items.add(item);
});
weChatItemMapper.dropItem(chatItemDto.getSideId());
weChatItemMapper.addItem(items);
checkItemsTotal(chatItemDto, finalMaterialIds);
}
);
return 1;
}
/**
* 更新该次选择的素材数
*
* @param chatItemDto 侧边栏信息
* @param finalMaterialIds 素材id列表
*/
private void checkItemsTotal(WeChatItemDto chatItemDto, List<Long> finalMaterialIds) {
WeChatSide side=new WeChatSide();
side.setSideId(chatItemDto.getSideId());
side.setTotal(finalMaterialIds.size());
weChatSideMapper.updateWeChatSideById(side);
}
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeChatSide;
import com.linkwechat.wecom.mapper.WeChatSideMapper;
import com.linkwechat.wecom.service.IWeChatSideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 聊天工具侧边栏
* @author kewen
*/
@Service
public class WeChatSideServiceImpl extends ServiceImpl<WeChatSideMapper, WeChatSide> implements IWeChatSideService {
@Autowired
private WeChatSideMapper weChatSideMapper;
@Override
public List<WeChatSide> chatSides() {
return weChatSideMapper.selectWeChatSides();
}
@Override
public int updateWeChatSide(WeChatSide weChatSide) {
return weChatSideMapper.updateWeChatSideById(weChatSide);
}
}
...@@ -26,6 +26,7 @@ import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; ...@@ -26,6 +26,7 @@ import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.mapper.WeCustomerMapper; import com.linkwechat.wecom.mapper.WeCustomerMapper;
import com.linkwechat.wecom.service.*; import com.linkwechat.wecom.service.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -121,24 +122,18 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -121,24 +122,18 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
* @return * @return
*/ */
@Override @Override
@Async
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void synchWeCustomer() { public void synchWeCustomer() {
FollowUserList followUserList = weCustomerClient.getFollowUserList(); FollowUserList followUserList = weCustomerClient.getFollowUserList();
if (WeConstans.WE_SUCCESS_CODE.equals(followUserList.getErrcode()) if (WeConstans.WE_SUCCESS_CODE.equals(followUserList.getErrcode())
&& ArrayUtil.isNotEmpty(followUserList.getFollow_user())) { && ArrayUtil.isNotEmpty(followUserList.getFollow_user())) {
SecurityContext securityContext = SecurityContextHolder.getContext(); SecurityContext securityContext = SecurityContextHolder.getContext();
Arrays.asList(followUserList.getFollow_user()) Arrays.asList(followUserList.getFollow_user())
.stream().forEach(k -> { .parallelStream().forEach(k -> {
try { try {
Threads.SINGLE_THREAD_POOL.execute(new Runnable() { SecurityContextHolder.setContext(securityContext);
@Override weFlowerCustomerHandle(k);
public void run() {
SecurityContextHolder.setContext(securityContext);
weFlowerCustomerHandle(k);
}
});
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeChatCollectionMapper">
<insert id="addCollection">
INSERT INTO
we_chat_collection(collection_id,material_id,user_id,create_by,create_time,update_by,update_time)
VALUES(#{collectionId},#{materialId},#{userId},#{createBy},#{createTime},#{updateBy},#{updateTime})
</insert>
<delete id="dropCollection">
DELETE FROM
we_chat_collection
<where>
material_id=#{materialId} AND user_id=#{userId}
</where>
</delete>
<select id="countCollectionByMaterialIdAndUserId" resultType="java.lang.Integer">
SELECT COUNT(1) FROM we_chat_collection
<where>
material_id=#{materialId} AND user_id=#{userId}
</where>
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeChatItemMapper">
<insert id="addItem">
INSERT INTO
we_chat_item(item_id,side_id,material_id,create_by,create_time,update_by,update_time)
VALUES
<if test="items!=null and items.size()>0">
<foreach collection="items" open="(" separator="," item="item" close=")">
#{item.itemId},#{item.sideId},#{item.materialId},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime}
</foreach>
</if>
</insert>
<delete id="dropItem">
DELETE FROM
we_chat_item
<where>
side_id=#{sideId}
</where>
</delete>
</mapper>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeChatSideMapper">
<update id="updateWeChatSideById">
UPDATE
we_chat_side
<set>
<if test="sideName!=null and sideName!=''">
side_name=#{sideName},
</if>
<if test="total!=null">
total=#{total},
</if>
<if test="using!=null">
`using`=#{using}
</if>
</set>
<where>
side_id=#{sideId}
</where>
</update>
<select id="selectWeChatSides" resultType="com.linkwechat.wecom.domain.WeChatSide">
SELECT
side_id,
media_type,
side_name,
total,
`using`
FROM
we_chat_side
<where>
`using`=0
</where>
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
...@@ -57,6 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -57,6 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="contactSecret != null ">contact_secret,</if> <if test="contactSecret != null ">contact_secret,</if>
<if test="chatSecret != null ">chat_secret,</if> <if test="chatSecret != null ">chat_secret,</if>
<if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch,</if> <if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch,</if>
<if test="providerSecret != null ">provider_secret,</if>
<if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyName != null">#{companyName},</if> <if test="companyName != null">#{companyName},</if>
...@@ -71,6 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -71,6 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="contactSecret != null ">#{contactSecret},</if> <if test="contactSecret != null ">#{contactSecret},</if>
<if test="chatSecret != null ">#{chatSecret},</if> <if test="chatSecret != null ">#{chatSecret},</if>
<if test="customerChurnNoticeSwitch != null ">#{customerChurnNoticeSwitch},</if> <if test="customerChurnNoticeSwitch != null ">#{customerChurnNoticeSwitch},</if>
<if test="providerSecret != null ">#{providerSecret},</if>
<if test="wxQrLoginRedirectUri != null ">#{wxQrLoginRedirectUri},</if>
</trim> </trim>
</insert> </insert>
...@@ -89,6 +93,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -89,6 +93,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="contactSecret != null ">contact_secret = #{contactSecret},</if> <if test="contactSecret != null ">contact_secret = #{contactSecret},</if>
<if test="chatSecret != null ">chat_secret = #{chatSecret},</if> <if test="chatSecret != null ">chat_secret = #{chatSecret},</if>
<if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch = #{customerChurnNoticeSwitch},</if> <if test="customerChurnNoticeSwitch != null ">customer_churn_notice_switch = #{customerChurnNoticeSwitch},</if>
<if test="providerSecret != null ">provider_secret = #{providerSecret},</if>
<if test="wxQrLoginRedirectUri != null ">wx_qr_login_redirect_uri = #{wxQrLoginRedirectUri},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!