diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/FansTagController.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/WxFansTagController.java similarity index 64% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/FansTagController.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/WxFansTagController.java index f89758e57..9b20ecc97 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/FansTagController.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/WxFansTagController.java @@ -1,54 +1,55 @@ package cn.iocoder.yudao.module.mp.controller.admin.fanstag; -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.fanstag.vo.*; -import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; -import cn.iocoder.yudao.module.mp.service.tag.FansTagService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import me.chanjar.weixin.mp.bean.tag.WxUserTag; -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 org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.annotations.*; + +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; import java.io.IOException; -import java.util.Collection; -import java.util.List; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -/** - * @author fengdan - */ +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; + +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; +import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; +import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; +import cn.iocoder.yudao.module.mp.service.fanstag.WxFansTagService; + @Api(tags = "管理后台 - 粉丝标签") @RestController -@RequestMapping("/wechat-mp/fans-tag") +@RequestMapping("/wechatMp/wx-fans-tag") @Validated -public class FansTagController { +public class WxFansTagController { @Resource - private FansTagService fansTagService; + private WxFansTagService wxFansTagService; @PostMapping("/create") @ApiOperation("创建粉丝标签") @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:create')") - public CommonResult createWxFansTag(@Valid @RequestBody FansTagCreateReqVO createReqVO) { - return success(fansTagService.createWxFansTag(createReqVO)); + public CommonResult createWxFansTag(@Valid @RequestBody WxFansTagCreateReqVO createReqVO) { + return success(wxFansTagService.createWxFansTag(createReqVO)); } @PutMapping("/update") @ApiOperation("更新粉丝标签") @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:update')") - public CommonResult updateWxFansTag(@Valid @RequestBody FansTagUpdateReqVO updateReqVO) { - fansTagService.updateWxFansTag(updateReqVO); + public CommonResult updateWxFansTag(@Valid @RequestBody WxFansTagUpdateReqVO updateReqVO) { + wxFansTagService.updateWxFansTag(updateReqVO); return success(true); } @@ -57,7 +58,7 @@ public class FansTagController { @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:delete')") public CommonResult deleteWxFansTag(@RequestParam("id") Integer id) { - fansTagService.deleteWxFansTag(id); + wxFansTagService.deleteWxFansTag(id); return success(true); } @@ -65,8 +66,8 @@ public class FansTagController { @ApiOperation("获得粉丝标签") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") - public CommonResult getWxFansTag(@RequestParam("id") Integer id) { - WxUserTag wxFansTag = fansTagService.getWxFansTag(id); + public CommonResult getWxFansTag(@RequestParam("id") Integer id) { + WxFansTagDO wxFansTag = wxFansTagService.getWxFansTag(id); return success(WxFansTagConvert.INSTANCE.convert(wxFansTag)); } @@ -74,16 +75,16 @@ public class FansTagController { @ApiOperation("获得粉丝标签列表") @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") - public CommonResult> getWxFansTagList(@RequestParam("ids") Collection ids) { - List list = fansTagService.getWxFansTagList(ids); + public CommonResult> getWxFansTagList(@RequestParam("ids") Collection ids) { + List list = wxFansTagService.getWxFansTagList(ids); return success(WxFansTagConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @ApiOperation("获得粉丝标签分页") @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") - public CommonResult> getWxFansTagPage(@Valid FansTagPageReqVO pageVO) { - PageResult pageResult = fansTagService.getWxFansTagPage(pageVO); + public CommonResult> getWxFansTagPage(@Valid WxFansTagPageReqVO pageVO) { + PageResult pageResult = wxFansTagService.getWxFansTagPage(pageVO); return success(WxFansTagConvert.INSTANCE.convertPage(pageResult)); } @@ -91,12 +92,12 @@ public class FansTagController { @ApiOperation("导出粉丝标签 Excel") @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:export')") @OperateLog(type = EXPORT) - public void exportWxFansTagExcel(@Valid FansTagExportReqVO exportReqVO, + public void exportWxFansTagExcel(@Valid WxFansTagExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = fansTagService.getWxFansTagList(exportReqVO); + List list = wxFansTagService.getWxFansTagList(exportReqVO); // 导出 Excel - List datas = WxFansTagConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "粉丝标签.xls", "数据", FansTagExcelVO.class, datas); + List datas = WxFansTagConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "粉丝标签.xls", "数据", WxFansTagExcelVO.class, datas); } } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagBaseVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagBaseVO.java similarity index 54% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagBaseVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagBaseVO.java index 3515dbae0..139a9b95a 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagBaseVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagBaseVO.java @@ -1,20 +1,22 @@ package cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; +import lombok.*; +import io.swagger.annotations.*; /** * 粉丝标签 Base VO,提供给添加、修改、详细的子 VO 使用 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 - * - * @author fengdan */ @Data -public class FansTagBaseVO { +public class WxFansTagBaseVO { - @ApiModelProperty(value = "标签名,UTF8编码.") + @ApiModelProperty(value = "标签名称") private String name; - @ApiModelProperty(value = "此标签下粉丝数") + @ApiModelProperty(value = "粉丝数量") private Integer count; + + @ApiModelProperty(value = "微信账号ID") + private String wxAccountId; + } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagCreateReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagCreateReqVO.java similarity index 74% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagCreateReqVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagCreateReqVO.java index 51dc8552e..a9ff3a8e8 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagCreateReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagCreateReqVO.java @@ -3,13 +3,10 @@ package cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo; import lombok.*; import io.swagger.annotations.*; -/** - * @author fengdan - */ @ApiModel("管理后台 - 粉丝标签创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class FansTagCreateReqVO extends FansTagBaseVO { +public class WxFansTagCreateReqVO extends WxFansTagBaseVO { } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExcelVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExcelVO.java similarity index 82% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExcelVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExcelVO.java index b55c9ddf5..26ecdeb25 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExcelVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExcelVO.java @@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty; * @author 芋道源码 */ @Data -public class FansTagExcelVO { +public class WxFansTagExcelVO { @ExcelProperty("主键") private Integer id; @@ -23,6 +23,9 @@ public class FansTagExcelVO { @ExcelProperty("粉丝数量") private Integer count; + @ExcelProperty("微信账号ID") + private String wxAccountId; + @ExcelProperty("创建时间") private Date createTime; diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExportReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExportReqVO.java similarity index 96% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExportReqVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExportReqVO.java index fbe23b2b4..f5ba4be2f 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExportReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExportReqVO.java @@ -11,7 +11,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ApiModel(value = "管理后台 - 粉丝标签 Excel 导出 Request VO", description = "参数和 WxFansTagPageReqVO 是一致的") @Data -public class FansTagExportReqVO { +public class WxFansTagExportReqVO { @ApiModelProperty(value = "标签名称") private String name; diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagPageReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagPageReqVO.java similarity index 95% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagPageReqVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagPageReqVO.java index 69014762d..94690e909 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagPageReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagPageReqVO.java @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class FansTagPageReqVO extends PageParam { +public class WxFansTagPageReqVO extends PageParam { @ApiModelProperty(value = "标签名称") private String name; diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagRespVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagRespVO.java similarity index 72% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagRespVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagRespVO.java index 7fd996715..601353583 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagRespVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagRespVO.java @@ -10,10 +10,10 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class FansTagRespVO extends FansTagBaseVO { +public class WxFansTagRespVO extends WxFansTagBaseVO { - @ApiModelProperty(value = "标签id,由微信分配.") - private Long id; + @ApiModelProperty(value = "主键", required = true) + private Integer id; @ApiModelProperty(value = "创建时间", required = true) private Date createTime; diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagUpdateReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagUpdateReqVO.java similarity index 87% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagUpdateReqVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagUpdateReqVO.java index bfb01dcfa..155f263dd 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagUpdateReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagUpdateReqVO.java @@ -9,7 +9,7 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class FansTagUpdateReqVO extends FansTagBaseVO { +public class WxFansTagUpdateReqVO extends WxFansTagBaseVO { @ApiModelProperty(value = "主键", required = true) @NotNull(message = "主键不能为空") diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/fanstag/WxFansTagConvert.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/fanstag/WxFansTagConvert.java index 968d62b8a..948199677 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/fanstag/WxFansTagConvert.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/fanstag/WxFansTagConvert.java @@ -4,31 +4,31 @@ import java.util.*; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import me.chanjar.weixin.mp.bean.tag.WxUserTag; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; +import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; /** * 粉丝标签 Convert * - * @author fengdan + * @author 芋道源码 */ @Mapper public interface WxFansTagConvert { WxFansTagConvert INSTANCE = Mappers.getMapper(WxFansTagConvert.class); - WxUserTag convert(FansTagCreateReqVO bean); + WxFansTagDO convert(WxFansTagCreateReqVO bean); - WxUserTag convert(FansTagUpdateReqVO bean); + WxFansTagDO convert(WxFansTagUpdateReqVO bean); - FansTagRespVO convert(WxUserTag bean); + WxFansTagRespVO convert(WxFansTagDO bean); - List convertList(List list); + List convertList(List list); - PageResult convertPage(PageResult page); + PageResult convertPage(PageResult page); - List convertList02(List list); + List convertList02(List list); } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/fanstag/WxFansTagDO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/fanstag/WxFansTagDO.java new file mode 100644 index 000000000..a98f009b5 --- /dev/null +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/fanstag/WxFansTagDO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.mp.dal.dataobject.fanstag; + +import lombok.*; + +import java.util.*; + +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 粉丝标签 DO + * + * @author 芋道源码 + */ +@TableName("wx_fans_tag") +@KeySequence("wx_fans_tag_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxFansTagDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Integer id; + /** + * 标签名称 + */ + private String name; + /** + * 粉丝数量 + */ + private Integer count; + /** + * 微信账号ID + */ + private String wxAccountId; + +} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/fanstag/WxFansTagMapper.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/fanstag/WxFansTagMapper.java new file mode 100644 index 000000000..5ec73ffcf --- /dev/null +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/fanstag/WxFansTagMapper.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.mp.dal.mysql.fanstag; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; + +/** + * 粉丝标签 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface WxFansTagMapper extends BaseMapperX { + + default PageResult selectPage(WxFansTagPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(WxFansTagDO::getName, reqVO.getName()) + .eqIfPresent(WxFansTagDO::getCount, reqVO.getCount()) + .eqIfPresent(WxFansTagDO::getWxAccountId, reqVO.getWxAccountId()) + .betweenIfPresent(WxFansTagDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(WxFansTagDO::getId)); + } + + default List selectList(WxFansTagExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(WxFansTagDO::getName, reqVO.getName()) + .eqIfPresent(WxFansTagDO::getCount, reqVO.getCount()) + .eqIfPresent(WxFansTagDO::getWxAccountId, reqVO.getWxAccountId()) + .betweenIfPresent(WxFansTagDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc(WxFansTagDO::getId)); + } + +} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagService.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagService.java new file mode 100644 index 000000000..da5ec220c --- /dev/null +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagService.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.mp.service.fanstag; + +import java.util.*; +import javax.validation.*; + +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; +import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 粉丝标签 Service 接口 + * + * @author 芋道源码 + */ +public interface WxFansTagService { + + /** + * 创建粉丝标签 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Integer createWxFansTag(@Valid WxFansTagCreateReqVO createReqVO); + + /** + * 更新粉丝标签 + * + * @param updateReqVO 更新信息 + */ + void updateWxFansTag(@Valid WxFansTagUpdateReqVO updateReqVO); + + /** + * 删除粉丝标签 + * + * @param id 编号 + */ + void deleteWxFansTag(Integer id); + + /** + * 获得粉丝标签 + * + * @param id 编号 + * @return 粉丝标签 + */ + WxFansTagDO getWxFansTag(Integer id); + + /** + * 获得粉丝标签列表 + * + * @param ids 编号 + * @return 粉丝标签列表 + */ + List getWxFansTagList(Collection ids); + + /** + * 获得粉丝标签分页 + * + * @param pageReqVO 分页查询 + * @return 粉丝标签分页 + */ + PageResult getWxFansTagPage(WxFansTagPageReqVO pageReqVO); + + /** + * 获得粉丝标签列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 粉丝标签列表 + */ + List getWxFansTagList(WxFansTagExportReqVO exportReqVO); + +} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagServiceImpl.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagServiceImpl.java new file mode 100644 index 000000000..f1ae773f8 --- /dev/null +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagServiceImpl.java @@ -0,0 +1,85 @@ +package cn.iocoder.yudao.module.mp.service.fanstag; + +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; +import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; +import cn.iocoder.yudao.module.mp.dal.mysql.fanstag.WxFansTagMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.*; + +/** + * 粉丝标签 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class WxFansTagServiceImpl implements WxFansTagService { + + @Resource + private WxFansTagMapper wxFansTagMapper; + + @Override + public Integer createWxFansTag(WxFansTagCreateReqVO createReqVO) { + // 插入 + WxFansTagDO wxFansTag = WxFansTagConvert.INSTANCE.convert(createReqVO); + wxFansTagMapper.insert(wxFansTag); + // 返回 + return wxFansTag.getId(); + } + + @Override + public void updateWxFansTag(WxFansTagUpdateReqVO updateReqVO) { + // 校验存在 + this.validateWxFansTagExists(updateReqVO.getId()); + // 更新 + WxFansTagDO updateObj = WxFansTagConvert.INSTANCE.convert(updateReqVO); + wxFansTagMapper.updateById(updateObj); + } + + @Override + public void deleteWxFansTag(Integer id) { + // 校验存在 + this.validateWxFansTagExists(id); + // 删除 + wxFansTagMapper.deleteById(id); + } + + private void validateWxFansTagExists(Integer id) { + if (wxFansTagMapper.selectById(id) == null) { + throw exception(COMMON_NOT_EXISTS); + } + } + + @Override + public WxFansTagDO getWxFansTag(Integer id) { + return wxFansTagMapper.selectById(id); + } + + @Override + public List getWxFansTagList(Collection ids) { + return wxFansTagMapper.selectBatchIds(ids); + } + + @Override + public PageResult getWxFansTagPage(WxFansTagPageReqVO pageReqVO) { + return wxFansTagMapper.selectPage(pageReqVO); + } + + @Override + public List getWxFansTagList(WxFansTagExportReqVO exportReqVO) { + return wxFansTagMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagService.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagService.java deleted file mode 100644 index f8f082608..000000000 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagService.java +++ /dev/null @@ -1,75 +0,0 @@ -package cn.iocoder.yudao.module.mp.service.tag; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagCreateReqVO; -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagExportReqVO; -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagPageReqVO; -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagUpdateReqVO; -import me.chanjar.weixin.mp.bean.tag.WxUserTag; - -import javax.validation.Valid; -import java.util.Collection; -import java.util.List; - -/** - * 粉丝标签 Service 接口 - * - * @author fengdan - */ -public interface FansTagService { - - /** - * 创建粉丝标签 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - WxUserTag createWxFansTag(@Valid FansTagCreateReqVO createReqVO); - - /** - * 更新粉丝标签 - * - * @param updateReqVO 更新信息 - */ - void updateWxFansTag(@Valid FansTagUpdateReqVO updateReqVO); - - /** - * 删除粉丝标签 - * - * @param id 编号 - */ - void deleteWxFansTag(Integer id); - - /** - * 获得粉丝标签 - * - * @param id 编号 - * @return 粉丝标签 - */ - WxUserTag getWxFansTag(Integer id); - - /** - * 获得粉丝标签列表 - * - * @param ids 编号 - * @return 粉丝标签列表 - */ - List getWxFansTagList(Collection ids); - - /** - * 获得粉丝标签分页 - * - * @param pageReqVO 分页查询 - * @return 粉丝标签分页 - */ - PageResult getWxFansTagPage(FansTagPageReqVO pageReqVO); - - /** - * 获得粉丝标签列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 粉丝标签列表 - */ - List getWxFansTagList(FansTagExportReqVO exportReqVO); - -} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagServiceImpl.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagServiceImpl.java deleted file mode 100644 index 61b207068..000000000 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagServiceImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package cn.iocoder.yudao.module.mp.service.tag; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagCreateReqVO; -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagExportReqVO; -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagPageReqVO; -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagUpdateReqVO; -import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; -import lombok.extern.slf4j.Slf4j; -import me.chanjar.weixin.common.error.WxErrorException; -import me.chanjar.weixin.mp.api.WxMpService; -import me.chanjar.weixin.mp.bean.tag.WxUserTag; -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 fengdan - */ -@Slf4j -@Service -@Validated -public class FansTagServiceImpl implements FansTagService { - - @Resource - private WxMpService wxMpService; - - @Override - public WxUserTag createWxFansTag(FansTagCreateReqVO createReqVO) { - try { - return wxMpService.getUserTagService().tagCreate("wxFansTag"); - } catch (WxErrorException e) { - throw new RuntimeException(e); - } - } - - @Override - public void updateWxFansTag(FansTagUpdateReqVO updateReqVO) { - // 校验存在 - // 更新 - WxUserTag updateObj = WxFansTagConvert.INSTANCE.convert(updateReqVO); - - } - - @Override - public void deleteWxFansTag(Integer id) { - // 校验存在 - // 删除 - } - - - @Override - public WxUserTag getWxFansTag(Integer id) { - return null; - } - - @Override - public List getWxFansTagList(Collection ids) { - return null; - } - - @Override - public PageResult getWxFansTagPage(FansTagPageReqVO pageReqVO) { - return null; - } - - @Override - public List getWxFansTagList(FansTagExportReqVO exportReqVO) { - return null; - } - -}