mp:完成关注和取消的 user 保存
parent
cdb7348b08
commit
39d377b0bd
@ -1,103 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.mp.controller.admin.subscribetext;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
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 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 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.subscribetext.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.mp.dal.dataobject.subscribetext.WxSubscribeTextDO;
|
|
||||||
import cn.iocoder.yudao.module.mp.convert.subscribetext.WxSubscribeTextConvert;
|
|
||||||
import cn.iocoder.yudao.module.mp.service.subscribetext.WxSubscribeTextService;
|
|
||||||
|
|
||||||
@Api(tags = "管理后台 - 关注欢迎语")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/wechatMp/wx-subscribe-text")
|
|
||||||
@Validated
|
|
||||||
public class WxSubscribeTextController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private WxSubscribeTextService wxSubscribeTextService;
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
|
||||||
@ApiOperation("创建关注欢迎语")
|
|
||||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-subscribe-text:create')")
|
|
||||||
public CommonResult<Integer> createWxSubscribeText(@Valid @RequestBody WxSubscribeTextCreateReqVO createReqVO) {
|
|
||||||
return success(wxSubscribeTextService.createWxSubscribeText(createReqVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/update")
|
|
||||||
@ApiOperation("更新关注欢迎语")
|
|
||||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-subscribe-text:update')")
|
|
||||||
public CommonResult<Boolean> updateWxSubscribeText(@Valid @RequestBody WxSubscribeTextUpdateReqVO updateReqVO) {
|
|
||||||
wxSubscribeTextService.updateWxSubscribeText(updateReqVO);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
|
||||||
@ApiOperation("删除关注欢迎语")
|
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-subscribe-text:delete')")
|
|
||||||
public CommonResult<Boolean> deleteWxSubscribeText(@RequestParam("id") Integer id) {
|
|
||||||
wxSubscribeTextService.deleteWxSubscribeText(id);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/get")
|
|
||||||
@ApiOperation("获得关注欢迎语")
|
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-subscribe-text:query')")
|
|
||||||
public CommonResult<WxSubscribeTextRespVO> getWxSubscribeText(@RequestParam("id") Integer id) {
|
|
||||||
WxSubscribeTextDO wxSubscribeText = wxSubscribeTextService.getWxSubscribeText(id);
|
|
||||||
return success(WxSubscribeTextConvert.INSTANCE.convert(wxSubscribeText));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/list")
|
|
||||||
@ApiOperation("获得关注欢迎语列表")
|
|
||||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
|
||||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-subscribe-text:query')")
|
|
||||||
public CommonResult<List<WxSubscribeTextRespVO>> getWxSubscribeTextList(@RequestParam("ids") Collection<Integer> ids) {
|
|
||||||
List<WxSubscribeTextDO> list = wxSubscribeTextService.getWxSubscribeTextList(ids);
|
|
||||||
return success(WxSubscribeTextConvert.INSTANCE.convertList(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/page")
|
|
||||||
@ApiOperation("获得关注欢迎语分页")
|
|
||||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-subscribe-text:query')")
|
|
||||||
public CommonResult<PageResult<WxSubscribeTextRespVO>> getWxSubscribeTextPage(@Valid WxSubscribeTextPageReqVO pageVO) {
|
|
||||||
PageResult<WxSubscribeTextDO> pageResult = wxSubscribeTextService.getWxSubscribeTextPage(pageVO);
|
|
||||||
return success(WxSubscribeTextConvert.INSTANCE.convertPage(pageResult));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
|
||||||
@ApiOperation("导出关注欢迎语 Excel")
|
|
||||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-subscribe-text:export')")
|
|
||||||
@OperateLog(type = EXPORT)
|
|
||||||
public void exportWxSubscribeTextExcel(@Valid WxSubscribeTextExportReqVO exportReqVO,
|
|
||||||
HttpServletResponse response) throws IOException {
|
|
||||||
List<WxSubscribeTextDO> list = wxSubscribeTextService.getWxSubscribeTextList(exportReqVO);
|
|
||||||
// 导出 Excel
|
|
||||||
List<WxSubscribeTextExcelVO> datas = WxSubscribeTextConvert.INSTANCE.convertList02(list);
|
|
||||||
ExcelUtils.write(response, "关注欢迎语.xls", "数据", WxSubscribeTextExcelVO.class, datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.mp.controller.admin.subscribetext.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 关注欢迎语创建 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class WxSubscribeTextCreateReqVO extends WxSubscribeTextBaseVO {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.mp.controller.admin.subscribetext.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 关注欢迎语 Response VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class WxSubscribeTextRespVO extends WxSubscribeTextBaseVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键", required = true)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间", required = true)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.mp.controller.admin.subscribetext.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import io.swagger.annotations.*;
|
|
||||||
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
@ApiModel("管理后台 - 关注欢迎语更新 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class WxSubscribeTextUpdateReqVO extends WxSubscribeTextBaseVO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键", required = true)
|
|
||||||
@NotNull(message = "主键不能为空")
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.mp.convert.subscribetext;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
import cn.iocoder.yudao.module.mp.controller.admin.subscribetext.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.mp.dal.dataobject.subscribetext.WxSubscribeTextDO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注欢迎语 Convert
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface WxSubscribeTextConvert {
|
|
||||||
|
|
||||||
WxSubscribeTextConvert INSTANCE = Mappers.getMapper(WxSubscribeTextConvert.class);
|
|
||||||
|
|
||||||
WxSubscribeTextDO convert(WxSubscribeTextCreateReqVO bean);
|
|
||||||
|
|
||||||
WxSubscribeTextDO convert(WxSubscribeTextUpdateReqVO bean);
|
|
||||||
|
|
||||||
WxSubscribeTextRespVO convert(WxSubscribeTextDO bean);
|
|
||||||
|
|
||||||
List<WxSubscribeTextRespVO> convertList(List<WxSubscribeTextDO> list);
|
|
||||||
|
|
||||||
PageResult<WxSubscribeTextRespVO> convertPage(PageResult<WxSubscribeTextDO> page);
|
|
||||||
|
|
||||||
List<WxSubscribeTextExcelVO> convertList02(List<WxSubscribeTextDO> list);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.mp.dal.mysql.subscribetext;
|
|
||||||
|
|
||||||
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.subscribetext.WxSubscribeTextDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import cn.iocoder.yudao.module.mp.controller.admin.subscribetext.vo.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注欢迎语 Mapper
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface WxSubscribeTextMapper extends BaseMapperX<WxSubscribeTextDO> {
|
|
||||||
|
|
||||||
default PageResult<WxSubscribeTextDO> selectPage(WxSubscribeTextPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<WxSubscribeTextDO>()
|
|
||||||
.eqIfPresent(WxSubscribeTextDO::getMsgType, reqVO.getMsgType())
|
|
||||||
.eqIfPresent(WxSubscribeTextDO::getTplId, reqVO.getTplId())
|
|
||||||
.eqIfPresent(WxSubscribeTextDO::getWxAccountId, reqVO.getWxAccountId())
|
|
||||||
.betweenIfPresent(WxSubscribeTextDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
|
||||||
.orderByDesc(WxSubscribeTextDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<WxSubscribeTextDO> selectList(WxSubscribeTextExportReqVO reqVO) {
|
|
||||||
return selectList(new LambdaQueryWrapperX<WxSubscribeTextDO>()
|
|
||||||
.eqIfPresent(WxSubscribeTextDO::getMsgType, reqVO.getMsgType())
|
|
||||||
.eqIfPresent(WxSubscribeTextDO::getTplId, reqVO.getTplId())
|
|
||||||
.eqIfPresent(WxSubscribeTextDO::getWxAccountId, reqVO.getWxAccountId())
|
|
||||||
.betweenIfPresent(WxSubscribeTextDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
|
||||||
.orderByDesc(WxSubscribeTextDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.mp.service.subscribetext;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import javax.validation.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.mp.controller.admin.subscribetext.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.mp.dal.dataobject.subscribetext.WxSubscribeTextDO;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注欢迎语 Service 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface WxSubscribeTextService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建关注欢迎语
|
|
||||||
*
|
|
||||||
* @param createReqVO 创建信息
|
|
||||||
* @return 编号
|
|
||||||
*/
|
|
||||||
Integer createWxSubscribeText(@Valid WxSubscribeTextCreateReqVO createReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新关注欢迎语
|
|
||||||
*
|
|
||||||
* @param updateReqVO 更新信息
|
|
||||||
*/
|
|
||||||
void updateWxSubscribeText(@Valid WxSubscribeTextUpdateReqVO updateReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除关注欢迎语
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deleteWxSubscribeText(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得关注欢迎语
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
* @return 关注欢迎语
|
|
||||||
*/
|
|
||||||
WxSubscribeTextDO getWxSubscribeText(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得关注欢迎语列表
|
|
||||||
*
|
|
||||||
* @param ids 编号
|
|
||||||
* @return 关注欢迎语列表
|
|
||||||
*/
|
|
||||||
List<WxSubscribeTextDO> getWxSubscribeTextList(Collection<Integer> ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得关注欢迎语分页
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页查询
|
|
||||||
* @return 关注欢迎语分页
|
|
||||||
*/
|
|
||||||
PageResult<WxSubscribeTextDO> getWxSubscribeTextPage(WxSubscribeTextPageReqVO pageReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得关注欢迎语列表, 用于 Excel 导出
|
|
||||||
*
|
|
||||||
* @param exportReqVO 查询条件
|
|
||||||
* @return 关注欢迎语列表
|
|
||||||
*/
|
|
||||||
List<WxSubscribeTextDO> getWxSubscribeTextList(WxSubscribeTextExportReqVO exportReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注欢迎语分页
|
|
||||||
*
|
|
||||||
* @param column
|
|
||||||
* @param obj
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
WxSubscribeTextDO findBy(SFunction<WxSubscribeTextDO, ?> column, Object obj);
|
|
||||||
}
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.mp.service.subscribetext;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
|
||||||
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.subscribetext.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.mp.dal.dataobject.subscribetext.WxSubscribeTextDO;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.mp.convert.subscribetext.WxSubscribeTextConvert;
|
|
||||||
import cn.iocoder.yudao.module.mp.dal.mysql.subscribetext.WxSubscribeTextMapper;
|
|
||||||
|
|
||||||
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 WxSubscribeTextServiceImpl implements WxSubscribeTextService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private WxSubscribeTextMapper wxSubscribeTextMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer createWxSubscribeText(WxSubscribeTextCreateReqVO createReqVO) {
|
|
||||||
// 插入
|
|
||||||
WxSubscribeTextDO wxSubscribeText = WxSubscribeTextConvert.INSTANCE.convert(createReqVO);
|
|
||||||
wxSubscribeTextMapper.insert(wxSubscribeText);
|
|
||||||
// 返回
|
|
||||||
return wxSubscribeText.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateWxSubscribeText(WxSubscribeTextUpdateReqVO updateReqVO) {
|
|
||||||
// 校验存在
|
|
||||||
this.validateWxSubscribeTextExists(updateReqVO.getId());
|
|
||||||
// 更新
|
|
||||||
WxSubscribeTextDO updateObj = WxSubscribeTextConvert.INSTANCE.convert(updateReqVO);
|
|
||||||
wxSubscribeTextMapper.updateById(updateObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteWxSubscribeText(Integer id) {
|
|
||||||
// 校验存在
|
|
||||||
this.validateWxSubscribeTextExists(id);
|
|
||||||
// 删除
|
|
||||||
wxSubscribeTextMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateWxSubscribeTextExists(Integer id) {
|
|
||||||
if (wxSubscribeTextMapper.selectById(id) == null) {
|
|
||||||
throw exception(COMMON_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public WxSubscribeTextDO getWxSubscribeText(Integer id) {
|
|
||||||
return wxSubscribeTextMapper.selectById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<WxSubscribeTextDO> getWxSubscribeTextList(Collection<Integer> ids) {
|
|
||||||
return wxSubscribeTextMapper.selectBatchIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<WxSubscribeTextDO> getWxSubscribeTextPage(WxSubscribeTextPageReqVO pageReqVO) {
|
|
||||||
return wxSubscribeTextMapper.selectPage(pageReqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<WxSubscribeTextDO> getWxSubscribeTextList(WxSubscribeTextExportReqVO exportReqVO) {
|
|
||||||
return wxSubscribeTextMapper.selectList(exportReqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public WxSubscribeTextDO findBy(SFunction<WxSubscribeTextDO, ?> column, Object obj) {
|
|
||||||
return wxSubscribeTextMapper.selectOne(column, obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue