✨ Introducing new features. 微信账户标签管理
This commit is contained in:
1 parent
1afff76e4d
commit
c27acd9a8f
11 files changed
+245
-6
No files matched your search
+1
-1
@@ -36,7 +36,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxaccount")
|
||||
@RequestMapping("/wx-account")
|
||||
public class WxAccountController {
|
||||
|
||||
private final WxAccountService wxAccountService;
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxaccountfans")
|
||||
@RequestMapping("/wx-account-fans")
|
||||
public class WxAccountFansController {
|
||||
|
||||
private final WxAccountFansService wxAccountFansService;
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.pig4cloud.pigx.mp.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccountTag;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAutoReply;
|
||||
import com.pig4cloud.pigx.mp.service.WxAccountTagService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信账户标签
|
||||
*
|
||||
* @author lishangbu
|
||||
* @date 2021/12/31
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wx-account-tag")
|
||||
public class WxAccountTagController {
|
||||
|
||||
private final WxAccountTagService wxAccountTagService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param wxAccountTag 账户标签查询条件
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<WxAccountTag>> getWxAccountTagPage(Page page, WxAccountTag wxAccountTag) {
|
||||
return R.ok(wxAccountTagService.page(page, Wrappers.query(wxAccountTag)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @param wxAccountTag 账户标签查询条件
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<WxAccountTag>> listWxAccountTags(WxAccountTag wxAccountTag) {
|
||||
return R.ok(wxAccountTagService.list(Wrappers.query(wxAccountTag)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存账户标签
|
||||
* @param wxAccountTag 待保存的账户标签
|
||||
* @return 包含保存成功后的账户标签的API调用结果
|
||||
*/
|
||||
@PostMapping
|
||||
public R<WxAccountTag> saveAccountTag(@RequestBody @Valid WxAccountTag wxAccountTag) {
|
||||
return R.ok(wxAccountTagService.saveAccountTag(wxAccountTag));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改账户标签
|
||||
* @param wxAccountTag 待修改的账户标签
|
||||
* @return 包含修改成功后的账户标签的API调用结果
|
||||
*/
|
||||
@PutMapping
|
||||
public R<WxAccountTag> updateAccountTag(@RequestBody @Valid WxAccountTag wxAccountTag) {
|
||||
return R.ok(wxAccountTagService.updateAccountTag(wxAccountTag));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
public R<Boolean> removeAccountTagById(@PathVariable Long id) {
|
||||
return R.ok(wxAccountTagService.removeAccountTagById(id));
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxautoreply")
|
||||
@RequestMapping("/wx-auto-reply")
|
||||
public class WxAutoReplyController {
|
||||
|
||||
private final WxAutoReplyService wxAutoReplyService;
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxfansmsg")
|
||||
@RequestMapping("/wx-fans-msg")
|
||||
public class WxFansMsgController {
|
||||
|
||||
private final WxMsgService wxMsgService;
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxmaterial")
|
||||
@RequestMapping("/wx-material")
|
||||
public class WxMaterialController {
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/wxmenu")
|
||||
@RequestMapping("/wx-menu")
|
||||
public class WxMenuController {
|
||||
|
||||
private final WxMenuService wxMenuService;
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.pig4cloud.pigx.mp.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.pig4cloud.pigx.common.data.mybatis.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 微信公众号账号标签
|
||||
*
|
||||
* @author lishangbu
|
||||
* @date 2021/12/31
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxAccountTag extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
@NotBlank(message = "标签不能为空")
|
||||
private String tag;
|
||||
|
||||
}
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
package com.pig4cloud.pigx.mp.mapper;
|
||||
|
||||
import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccount;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccountTag;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 公众号账户
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2019-03-26 22:07:53
|
||||
*/
|
||||
@Mapper
|
||||
public interface WxAccountTagMapper extends PigxBaseMapper<WxAccountTag> {
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.pig4cloud.pigx.mp.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccountTag;
|
||||
|
||||
/**
|
||||
* 微信账户标签服务
|
||||
*
|
||||
* @author lishangbu
|
||||
* @date 2021/12/31
|
||||
*/
|
||||
public interface WxAccountTagService extends IService<WxAccountTag> {
|
||||
|
||||
/**
|
||||
* 保存账户标签
|
||||
* @param accountTag 账户标签
|
||||
* @return 保存成功后的账户标签
|
||||
*/
|
||||
WxAccountTag saveAccountTag(WxAccountTag accountTag);
|
||||
|
||||
/**
|
||||
* 更新账户标签
|
||||
* @param accountTag 待更新的账户标签
|
||||
* @return 修改成功后的账户标签
|
||||
*/
|
||||
WxAccountTag updateAccountTag(WxAccountTag accountTag);
|
||||
|
||||
/**
|
||||
* 删除账户标签
|
||||
* @param id 待删除的账户标签主键
|
||||
* @return 删除成功返回true,删除失败返回false
|
||||
*/
|
||||
Boolean removeAccountTagById(Long id);
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.pig4cloud.pigx.mp.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.mp.entity.WxAccountTag;
|
||||
import com.pig4cloud.pigx.mp.mapper.WxAccountTagMapper;
|
||||
import com.pig4cloud.pigx.mp.service.WxAccountTagService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* 微信账户标签服务实现类
|
||||
*
|
||||
* @author lishangbu
|
||||
* @date 2021/12/31
|
||||
*/
|
||||
@Service
|
||||
public class WxAccountTagServiceImpl extends ServiceImpl<WxAccountTagMapper, WxAccountTag>
|
||||
implements WxAccountTagService {
|
||||
|
||||
/**
|
||||
* 保存账户标签
|
||||
* @param accountTag 账户标签
|
||||
* @return 保存成功true保存失败false
|
||||
*/
|
||||
@Override
|
||||
public WxAccountTag saveAccountTag(WxAccountTag accountTag) {
|
||||
WxAccountTag wxAccountTag = baseMapper
|
||||
.selectOne(Wrappers.<WxAccountTag>lambdaQuery().eq(WxAccountTag::getTag, accountTag.getTag()));
|
||||
Assert.isNull(wxAccountTag, StrUtil.format("名称为[{}]的标签已经存在", accountTag.getTag()));
|
||||
baseMapper.insert(accountTag);
|
||||
return accountTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新账户标签
|
||||
* @param accountTag 待更新的账户标签
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WxAccountTag updateAccountTag(WxAccountTag accountTag) {
|
||||
WxAccountTag wxAccountTag = baseMapper.selectOne(Wrappers.<WxAccountTag>lambdaQuery()
|
||||
.eq(WxAccountTag::getTag, accountTag.getTag()).ne(WxAccountTag::getId, accountTag.getId()));
|
||||
Assert.isNull(wxAccountTag, StrUtil.format("名称为[{}]的标签已经存在", accountTag.getTag()));
|
||||
baseMapper.updateById(accountTag);
|
||||
return accountTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean removeAccountTagById(Long id) {
|
||||
WxAccountTag wxAccountTag = baseMapper.selectById(id);
|
||||
Assert.notNull(wxAccountTag, "要删除的标签不存在");
|
||||
return removeById(wxAccountTag.getId());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user