mp:重构 mp user 的表结构,以及相关的 service
parent
a7e4ff0d76
commit
cdb7348b08
@ -1,99 +0,0 @@
|
||||
package cn.iocoder.yudao.module.mp.controller.admin.accountfans;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.*;
|
||||
import cn.iocoder.yudao.module.mp.convert.accountfans.WxAccountFansConvert;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;
|
||||
import cn.iocoder.yudao.module.mp.service.accountfans.WxAccountFansService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "管理后台 - 微信公众号粉丝")
|
||||
@RestController
|
||||
@RequestMapping("/wechatMp/wx-account-fans")
|
||||
@Validated
|
||||
public class WxAccountFansController {
|
||||
|
||||
@Resource
|
||||
private WxAccountFansService wxAccountFansService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建微信公众号粉丝")
|
||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:create')")
|
||||
public CommonResult<Long> createWxAccountFans(@Valid @RequestBody WxAccountFansCreateReqVO createReqVO) {
|
||||
return success(wxAccountFansService.createWxAccountFans(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新微信公众号粉丝")
|
||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:update')")
|
||||
public CommonResult<Boolean> updateWxAccountFans(@Valid @RequestBody WxAccountFansUpdateReqVO updateReqVO) {
|
||||
wxAccountFansService.updateWxAccountFans(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除微信公众号粉丝")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:delete')")
|
||||
public CommonResult<Boolean> deleteWxAccountFans(@RequestParam("id") Long id) {
|
||||
wxAccountFansService.deleteWxAccountFans(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得微信公众号粉丝")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:query')")
|
||||
public CommonResult<WxAccountFansRespVO> getWxAccountFans(@RequestParam("id") Long id) {
|
||||
WxAccountFansDO wxAccountFans = wxAccountFansService.getWxAccountFans(id);
|
||||
return success(WxAccountFansConvert.INSTANCE.convert(wxAccountFans));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得微信公众号粉丝列表")
|
||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:query')")
|
||||
public CommonResult<List<WxAccountFansRespVO>> getWxAccountFansList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<WxAccountFansDO> list = wxAccountFansService.getWxAccountFansList(ids);
|
||||
return success(WxAccountFansConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得微信公众号粉丝分页")
|
||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:query')")
|
||||
public CommonResult<PageResult<WxAccountFansRespVO>> getWxAccountFansPage(@Valid WxAccountFansPageReqVO pageVO) {
|
||||
PageResult<WxAccountFansDO> pageResult = wxAccountFansService.getWxAccountFansPage(pageVO);
|
||||
return success(WxAccountFansConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ApiOperation("导出微信公众号粉丝 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportWxAccountFansExcel(@Valid WxAccountFansExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<WxAccountFansDO> list = wxAccountFansService.getWxAccountFansList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<WxAccountFansExcelVO> datas = WxAccountFansConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "微信公众号粉丝.xls", "数据", WxAccountFansExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
@ApiModel("管理后台 - 微信公众号粉丝创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class WxAccountFansCreateReqVO extends WxAccountFansBaseVO {
|
||||
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@ApiModel("管理后台 - 微信公众号粉丝更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class WxAccountFansUpdateReqVO extends WxAccountFansBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true)
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.mp.controller.admin.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.user.vo.*;
|
||||
import cn.iocoder.yudao.module.mp.convert.user.MpUserConvert;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
|
||||
import cn.iocoder.yudao.module.mp.service.user.MpUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "管理后台 - 微信公众号粉丝")
|
||||
@RestController
|
||||
@RequestMapping("/mp/user")
|
||||
@Validated
|
||||
public class MpUserController {
|
||||
|
||||
@Resource
|
||||
private MpUserService mpUserService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得微信公众号粉丝分页")
|
||||
@PreAuthorize("@ss.hasPermission('mp:user:query')")
|
||||
public CommonResult<PageResult<MpUserRespVO>> getUserPage(@Valid MpUserPageReqVO pageVO) {
|
||||
PageResult<MpUserDO> pageResult = mpUserService.getUserPage(pageVO);
|
||||
return success(MpUserConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.mp.controller.admin.user.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@ApiModel("管理后台 - 微信公众号粉丝分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MpUserPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "用户标识")
|
||||
private String openid;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "微信公众号 ID")
|
||||
private Long accountId;
|
||||
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
package cn.iocoder.yudao.module.mp.convert.accountfans;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansCreateReqVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansExcelVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansRespVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信公众号粉丝 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface WxAccountFansConvert {
|
||||
|
||||
WxAccountFansConvert INSTANCE = Mappers.getMapper(WxAccountFansConvert.class);
|
||||
|
||||
WxAccountFansDO convert(WxAccountFansCreateReqVO bean);
|
||||
|
||||
WxAccountFansDO convert(WxAccountFansUpdateReqVO bean);
|
||||
|
||||
WxAccountFansRespVO convert(WxAccountFansDO bean);
|
||||
|
||||
List<WxAccountFansRespVO> convertList(List<WxAccountFansDO> list);
|
||||
|
||||
PageResult<WxAccountFansRespVO> convertPage(PageResult<WxAccountFansDO> page);
|
||||
|
||||
List<WxAccountFansExcelVO> convertList02(List<WxAccountFansDO> list);
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.mp.convert.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.user.vo.MpUserRespVO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MpUserConvert {
|
||||
|
||||
MpUserConvert INSTANCE = Mappers.getMapper(MpUserConvert.class);
|
||||
|
||||
MpUserRespVO convert(MpUserDO bean);
|
||||
|
||||
List<MpUserRespVO> convertList(List<MpUserDO> list);
|
||||
|
||||
PageResult<MpUserRespVO> convertPage(PageResult<MpUserDO> page);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.mp.dal.mysql.accountfans;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.user.vo.MpUserPageReqVO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MpUserMapper extends BaseMapperX<MpUserDO> {
|
||||
|
||||
default PageResult<MpUserDO> selectPage(MpUserPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MpUserDO>()
|
||||
.likeIfPresent(MpUserDO::getOpenid, reqVO.getOpenid())
|
||||
.likeIfPresent(MpUserDO::getNickname, reqVO.getNickname())
|
||||
.eqIfPresent(MpUserDO::getAccountId, reqVO.getAccountId())
|
||||
.orderByDesc(MpUserDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,59 +0,0 @@
|
||||
package cn.iocoder.yudao.module.mp.dal.mysql.accountfans;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansExportReqVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansPageReqVO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信公众号粉丝 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface WxAccountFansMapper extends BaseMapperX<WxAccountFansDO> {
|
||||
|
||||
default PageResult<WxAccountFansDO> selectPage(WxAccountFansPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<WxAccountFansDO>()
|
||||
.eqIfPresent(WxAccountFansDO::getOpenid, reqVO.getOpenid())
|
||||
.eqIfPresent(WxAccountFansDO::getSubscribeStatus, reqVO.getSubscribeStatus())
|
||||
.betweenIfPresent(WxAccountFansDO::getSubscribeTime, reqVO.getBeginSubscribeTime(), reqVO.getEndSubscribeTime())
|
||||
.likeIfPresent(WxAccountFansDO::getNickname, reqVO.getNickname())
|
||||
.eqIfPresent(WxAccountFansDO::getGender, reqVO.getGender())
|
||||
.eqIfPresent(WxAccountFansDO::getLanguage, reqVO.getLanguage())
|
||||
.eqIfPresent(WxAccountFansDO::getCountry, reqVO.getCountry())
|
||||
.eqIfPresent(WxAccountFansDO::getProvince, reqVO.getProvince())
|
||||
.eqIfPresent(WxAccountFansDO::getCity, reqVO.getCity())
|
||||
.eqIfPresent(WxAccountFansDO::getHeadimgUrl, reqVO.getHeadimgUrl())
|
||||
.eqIfPresent(WxAccountFansDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(WxAccountFansDO::getWxAccountId, reqVO.getWxAccountId())
|
||||
.eqIfPresent(WxAccountFansDO::getWxAccountAppid, reqVO.getWxAccountAppid())
|
||||
.betweenIfPresent(WxAccountFansDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc(WxAccountFansDO::getId));
|
||||
}
|
||||
|
||||
default List<WxAccountFansDO> selectList(WxAccountFansExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<WxAccountFansDO>()
|
||||
.eqIfPresent(WxAccountFansDO::getOpenid, reqVO.getOpenid())
|
||||
.eqIfPresent(WxAccountFansDO::getSubscribeStatus, reqVO.getSubscribeStatus())
|
||||
.betweenIfPresent(WxAccountFansDO::getSubscribeTime, reqVO.getBeginSubscribeTime(), reqVO.getEndSubscribeTime())
|
||||
.likeIfPresent(WxAccountFansDO::getNickname, reqVO.getNickname())
|
||||
.eqIfPresent(WxAccountFansDO::getGender, reqVO.getGender())
|
||||
.eqIfPresent(WxAccountFansDO::getLanguage, reqVO.getLanguage())
|
||||
.eqIfPresent(WxAccountFansDO::getCountry, reqVO.getCountry())
|
||||
.eqIfPresent(WxAccountFansDO::getProvince, reqVO.getProvince())
|
||||
.eqIfPresent(WxAccountFansDO::getCity, reqVO.getCity())
|
||||
.eqIfPresent(WxAccountFansDO::getHeadimgUrl, reqVO.getHeadimgUrl())
|
||||
.eqIfPresent(WxAccountFansDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(WxAccountFansDO::getWxAccountId, reqVO.getWxAccountId())
|
||||
.eqIfPresent(WxAccountFansDO::getWxAccountAppid, reqVO.getWxAccountAppid())
|
||||
.betweenIfPresent(WxAccountFansDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc(WxAccountFansDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.mp.mq.costomer;
|
||||
package cn.iocoder.yudao.module.mp.mq.consumer;
|
||||
|
||||
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
|
||||
import cn.iocoder.yudao.module.mp.mq.message.MpConfigRefreshMessage;
|
||||
@ -1,84 +0,0 @@
|
||||
package cn.iocoder.yudao.module.mp.service.accountfans;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansCreateReqVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansExportReqVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansPageReqVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信公众号粉丝 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface WxAccountFansService {
|
||||
|
||||
/**
|
||||
* 创建微信公众号粉丝
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createWxAccountFans(@Valid WxAccountFansCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新微信公众号粉丝
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateWxAccountFans(@Valid WxAccountFansUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除微信公众号粉丝
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteWxAccountFans(Long id);
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 微信公众号粉丝
|
||||
*/
|
||||
WxAccountFansDO getWxAccountFans(Long id);
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 微信公众号粉丝列表
|
||||
*/
|
||||
List<WxAccountFansDO> getWxAccountFansList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 微信公众号粉丝分页
|
||||
*/
|
||||
PageResult<WxAccountFansDO> getWxAccountFansPage(WxAccountFansPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 微信公众号粉丝列表
|
||||
*/
|
||||
List<WxAccountFansDO> getWxAccountFansList(WxAccountFansExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 查询粉丝
|
||||
*
|
||||
* @param sFunction
|
||||
* @param val
|
||||
* @return
|
||||
*/
|
||||
WxAccountFansDO findBy(SFunction<WxAccountFansDO, ?> sFunction, Object val);
|
||||
}
|
||||
@ -1,89 +0,0 @@
|
||||
package cn.iocoder.yudao.module.mp.service.accountfans;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansCreateReqVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansExportReqVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansPageReqVO;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.mp.convert.accountfans.WxAccountFansConvert;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;
|
||||
import cn.iocoder.yudao.module.mp.dal.mysql.accountfans.WxAccountFansMapper;
|
||||
import cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信公众号粉丝 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class WxAccountFansServiceImpl implements WxAccountFansService {
|
||||
|
||||
@Resource
|
||||
private WxAccountFansMapper wxAccountFansMapper;
|
||||
|
||||
@Override
|
||||
public Long createWxAccountFans(WxAccountFansCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
WxAccountFansDO wxAccountFans = WxAccountFansConvert.INSTANCE.convert(createReqVO);
|
||||
wxAccountFansMapper.insert(wxAccountFans);
|
||||
// 返回
|
||||
return wxAccountFans.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWxAccountFans(WxAccountFansUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
this.validateWxAccountFansExists(updateReqVO.getId());
|
||||
// 更新
|
||||
WxAccountFansDO updateObj = WxAccountFansConvert.INSTANCE.convert(updateReqVO);
|
||||
wxAccountFansMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteWxAccountFans(Long id) {
|
||||
// 校验存在
|
||||
this.validateWxAccountFansExists(id);
|
||||
// 删除
|
||||
wxAccountFansMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateWxAccountFansExists(Long id) {
|
||||
if (wxAccountFansMapper.selectById(id) == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.WX_ACCOUNT_FANS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxAccountFansDO getWxAccountFans(Long id) {
|
||||
return wxAccountFansMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WxAccountFansDO> getWxAccountFansList(Collection<Long> ids) {
|
||||
return wxAccountFansMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<WxAccountFansDO> getWxAccountFansPage(WxAccountFansPageReqVO pageReqVO) {
|
||||
return wxAccountFansMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WxAccountFansDO> getWxAccountFansList(WxAccountFansExportReqVO exportReqVO) {
|
||||
return wxAccountFansMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxAccountFansDO findBy(SFunction<WxAccountFansDO, ?> sFunction, Object val) {
|
||||
return wxAccountFansMapper.selectOne(sFunction, val);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.mp.service.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.user.vo.MpUserPageReqVO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信公众号粉丝 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface MpUserService {
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 微信公众号粉丝
|
||||
*/
|
||||
MpUserDO getUser(Long id);
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 微信公众号粉丝列表
|
||||
*/
|
||||
List<MpUserDO> getUserList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 微信公众号粉丝分页
|
||||
*/
|
||||
PageResult<MpUserDO> getUserPage(MpUserPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.mp.service.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.mp.controller.admin.user.vo.MpUserPageReqVO;
|
||||
import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
|
||||
import cn.iocoder.yudao.module.mp.dal.mysql.accountfans.MpUserMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信公众号粉丝 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MpUserServiceImpl implements MpUserService {
|
||||
|
||||
@Resource
|
||||
private MpUserMapper mpUserMapper;
|
||||
|
||||
@Override
|
||||
public MpUserDO getUser(Long id) {
|
||||
return mpUserMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MpUserDO> getUserList(Collection<Long> ids) {
|
||||
return mpUserMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MpUserDO> getUserPage(MpUserPageReqVO pageReqVO) {
|
||||
return mpUserMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue