diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/MpQrcodeApplicationService.java b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/MpQrcodeApplicationService.java new file mode 100644 index 0000000..d6997fc --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/MpQrcodeApplicationService.java @@ -0,0 +1,79 @@ +package com.agileboot.domain.qywx.mpQrcode; + +import com.agileboot.common.core.page.PageDTO; +import com.agileboot.domain.common.command.BulkOperationCommand; +import com.agileboot.domain.qywx.mpQrcode.command.AddMpQrcodeCommand; +import com.agileboot.domain.qywx.mpQrcode.command.UpdateMpQrcodeCommand; +import com.agileboot.domain.qywx.mpQrcode.db.QyMpQrcodeEntity; +import com.agileboot.domain.qywx.mpQrcode.db.QyMpQrcodeService; +import com.agileboot.domain.qywx.mpQrcode.dto.QyMpQrcodeDTO; +import com.agileboot.domain.qywx.mpQrcode.model.MpQrcodeModel; +import com.agileboot.domain.qywx.mpQrcode.model.MpQrcodeModelFactory; +import com.agileboot.domain.qywx.mpQrcode.query.SearchMpQrcodeQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import java.util.List; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *
+ * 小程序二维码应用服务层 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +@Service +@RequiredArgsConstructor +public class MpQrcodeApplicationService { + + private final QyMpQrcodeService qrcodeService; + private final MpQrcodeModelFactory qrcodeModelFactory; + + /** + * 分页查询二维码列表 + */ + public PageDTO+ * 添加小程序二维码命令 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class AddMpQrcodeCommand extends QyMpQrcodeEntity { + +} diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/command/UpdateMpQrcodeCommand.java b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/command/UpdateMpQrcodeCommand.java new file mode 100644 index 0000000..63bd315 --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/command/UpdateMpQrcodeCommand.java @@ -0,0 +1,24 @@ +package com.agileboot.domain.qywx.mpQrcode.command; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.PositiveOrZero; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *+ * 更新小程序二维码命令 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class UpdateMpQrcodeCommand extends AddMpQrcodeCommand { + + @NotNull + @PositiveOrZero + private Long qrcodeId; + +} diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/db/QyMpQrcodeEntity.java b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/db/QyMpQrcodeEntity.java new file mode 100644 index 0000000..a7dbfd7 --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/db/QyMpQrcodeEntity.java @@ -0,0 +1,55 @@ +package com.agileboot.domain.qywx.mpQrcode.db; + +import com.agileboot.common.core.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *+ * 企业小程序二维码表 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("qy_mp_qrcode") +@ApiModel(value = "QyMpQrcodeEntity对象", description = "企业小程序二维码表") +public class QyMpQrcodeEntity extends BaseEntity+ * 企业小程序二维码表 Mapper 接口 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +public interface QyMpQrcodeMapper extends BaseMapper+ * 企业小程序二维码表 服务类 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +public interface QyMpQrcodeService extends IService+ * 企业小程序二维码表 服务类 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +@Service +@RequiredArgsConstructor +public class QyMpQrcodeServiceImpl extends ServiceImpl+ * 企业小程序二维码 DTO + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +@ExcelSheet(name = "企业小程序二维码列表") +@Data +public class QyMpQrcodeDTO { + + public QyMpQrcodeDTO(QyMpQrcodeEntity entity) { + if (entity != null) { + BeanUtil.copyProperties(entity, this); + +/* // 设置创建者信息 + SysUserEntity creator = CacheCenter.userCache.get(entity.getCreatorId() + ""); + if (creator != null) { + this.creatorName = creator.getUsername(); + } + + // 设置更新者信息 + SysUserEntity updater = CacheCenter.userCache.get(entity.getUpdaterId() + ""); + if (updater != null) { + this.updaterName = updater.getUsername(); + }*/ + + // 格式化时间 + if (entity.getCreateTime() != null) { + this.createTimeStr = DateUtil.formatDateTime(entity.getCreateTime()); + } + if (entity.getUpdateTime() != null) { + this.updateTimeStr = DateUtil.formatDateTime(entity.getUpdateTime()); + } + } + } + + @ExcelColumn(name = "二维码ID") + private Long qrcodeId; + + @ExcelColumn(name = "企业微信ID") + private String corpid; + + @ExcelColumn(name = "二维码名称") + private String name; + + @ExcelColumn(name = "小程序码参数") + private String scene; + + @ExcelColumn(name = "小程序页面路径") + private String page; + + @ExcelColumn(name = "二维码链接") + private String qrcodeUrl; + + @ExcelColumn(name = "创建者") + private String creatorName; + + @ExcelColumn(name = "创建时间") + private String createTimeStr; + + @ExcelColumn(name = "更新者") + private String updaterName; + + @ExcelColumn(name = "更新时间") + private String updateTimeStr; + + @ExcelColumn(name = "删除标志") + private Boolean deleted; +} diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/model/MpQrcodeModel.java b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/model/MpQrcodeModel.java new file mode 100644 index 0000000..638fc06 --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/model/MpQrcodeModel.java @@ -0,0 +1,48 @@ +package com.agileboot.domain.qywx.mpQrcode.model; + +import cn.hutool.core.bean.BeanUtil; +import com.agileboot.domain.qywx.mpQrcode.command.AddMpQrcodeCommand; +import com.agileboot.domain.qywx.mpQrcode.command.UpdateMpQrcodeCommand; +import com.agileboot.domain.qywx.mpQrcode.db.QyMpQrcodeEntity; +import com.agileboot.domain.qywx.mpQrcode.db.QyMpQrcodeService; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *+ * 小程序二维码模型 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class MpQrcodeModel extends QyMpQrcodeEntity { + + private QyMpQrcodeService qrcodeService; + + public MpQrcodeModel(QyMpQrcodeEntity entity, QyMpQrcodeService qrcodeService) { + this(qrcodeService); + if (entity != null) { + BeanUtil.copyProperties(entity, this); + } + } + + public MpQrcodeModel(QyMpQrcodeService qrcodeService) { + this.qrcodeService = qrcodeService; + } + + public void loadAddCommand(AddMpQrcodeCommand command) { + if (command != null) { + BeanUtil.copyProperties(command, this, "qrcodeId"); + } + } + + public void loadUpdateCommand(UpdateMpQrcodeCommand command) { + if (command != null) { + loadAddCommand(command); + this.setQrcodeId(command.getQrcodeId()); + } + } +} diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/model/MpQrcodeModelFactory.java b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/model/MpQrcodeModelFactory.java new file mode 100644 index 0000000..d0dc530 --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/model/MpQrcodeModelFactory.java @@ -0,0 +1,35 @@ +package com.agileboot.domain.qywx.mpQrcode.model; + +import com.agileboot.common.exception.ApiException; +import com.agileboot.common.exception.error.ErrorCode; +import com.agileboot.domain.qywx.mpQrcode.db.QyMpQrcodeEntity; +import com.agileboot.domain.qywx.mpQrcode.db.QyMpQrcodeService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *+ * 小程序二维码模型工厂 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +@Component +@RequiredArgsConstructor +public class MpQrcodeModelFactory { + + private final QyMpQrcodeService qrcodeService; + + public MpQrcodeModel loadById(Long qrcodeId) { + QyMpQrcodeEntity entity = qrcodeService.getById(qrcodeId); + if (entity == null) { + throw new ApiException(ErrorCode.Business.COMMON_OBJECT_NOT_FOUND, qrcodeId, "二维码"); + } + return new MpQrcodeModel(entity, qrcodeService); + } + + public MpQrcodeModel create() { + return new MpQrcodeModel(qrcodeService); + } +} diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/query/SearchMpQrcodeQuery.java b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/query/SearchMpQrcodeQuery.java new file mode 100644 index 0000000..7275b3c --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/qywx/mpQrcode/query/SearchMpQrcodeQuery.java @@ -0,0 +1,42 @@ +package com.agileboot.domain.qywx.mpQrcode.query; + +import cn.hutool.core.util.StrUtil; +import com.agileboot.common.core.page.AbstractPageQuery; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import java.util.Date; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *+ * 查询小程序二维码 + *
+ * + * @author AgileBoot + * @since 2025-12-02 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class SearchMpQrcodeQuery