1、PlatformCategory继承BaseEntity
2、调整PlatformCategoryView字段
3、完成queryPlatformCategory接口开发
1 files deleted
1 files added
6 files modified
152 ■■■■ changed files
oying-system/src/main/java/com/oying/modules/pc/category/converter/PlatformCategoryViewAssembler.java 6 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/category/domain/PlatformCategory.java 37 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/category/domain/dto/PlatformCategoryQueryCriteria.java 23 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/category/rest/PlatformCategoryAdminController.java 12 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/category/service/impl/PlatformCategoryServiceImpl.java 2 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/category/view/PlatformCategoryAdminView.java 29 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/category/view/PlatformCategoryView.java 33 ●●●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/pc/category/PlatformCategoryMapper.xml 10 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/pc/category/converter/PlatformCategoryViewAssembler.java
@@ -3,14 +3,14 @@
import cn.hutool.core.bean.BeanUtil;
import com.oying.modules.pc.category.domain.PlatformCategory;
import com.oying.modules.pc.category.view.PlatformCategoryCustomerView;
import com.oying.modules.pc.category.view.PlatformCategoryView;
import com.oying.modules.pc.category.view.PlatformCategoryAdminView;
import org.springframework.stereotype.Component;
@Component
public class PlatformCategoryViewAssembler {
    public PlatformCategoryView toPlatformCategoryResponse(PlatformCategory category) {
        PlatformCategoryView categoryView = new PlatformCategoryView();
    public PlatformCategoryAdminView toPlatformCategoryResponse(PlatformCategory category) {
        PlatformCategoryAdminView categoryView = new PlatformCategoryAdminView();
        BeanUtil.copyProperties(category, categoryView);
        categoryView.setIconUrl("");
        return categoryView;
oying-system/src/main/java/com/oying/modules/pc/category/domain/PlatformCategory.java
@@ -1,25 +1,27 @@
package com.oying.modules.pc.category.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import java.sql.Timestamp;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.oying.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @description /
* @author lzp
* @date 2025-04-28
**/
@Data
@Getter
@Setter
@TableName("pc_platform_category")
public class PlatformCategory implements Serializable {
public class PlatformCategory extends BaseEntity implements Serializable {
    @TableId(value = "category_id", type = IdType.AUTO)
    @ApiModelProperty(value = "类目ID")
@@ -44,6 +46,9 @@
    @ApiModelProperty(value = "类目图标ID")
    private Long iconId;
    @ApiModelProperty(value = "类目图标Url")
    private String iconUrl;
    @NotNull
    @ApiModelProperty(value = "状态")
    private Integer status;
@@ -51,20 +56,6 @@
    @NotNull
    @ApiModelProperty(value = "是否启用(0-否 1-是)")
    private Integer active;
    @ApiModelProperty(value = "创建人")
    private Long createBy;
    @NotNull
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;
    @ApiModelProperty(value = "修改人")
    private Long updateBy;
    @NotNull
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;
    public void copy(PlatformCategory source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
oying-system/src/main/java/com/oying/modules/pc/category/domain/dto/PlatformCategoryQueryCriteria.java
@@ -1,7 +1,11 @@
package com.oying.modules.pc.category.domain.dto;
import lombok.Data;
import com.oying.utils.DateUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* @author lzp
@@ -10,8 +14,19 @@
@Data
public class PlatformCategoryQueryCriteria{
    @ApiModelProperty(value = "模糊查询")
    private String blurry;
    @ApiModelProperty(value = "是否启用", example = "1")
    private Integer active = 1;
    private Integer active;
    @ApiModelProperty(value = "开始时间", example = "2025-06-03 00:00:00")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createStart;
    @ApiModelProperty(value = "结束时间", example = "2025-06-03 23:59:59")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createEnd;
    @ApiModelProperty(value = "页码", example = "1")
    private Integer page = 1;
@@ -19,4 +34,8 @@
    @ApiModelProperty(value = "每页数据量", example = "10")
    private Integer size = 10;
    public static void main(String[] args) {
        System.out.println(DateUtil.getTimeStamp(DateUtil.parseLocalDateTimeFormat("2025-04-30 18:21:22", "yyyy-MM-dd HH:mm:ss")));
    }
}
oying-system/src/main/java/com/oying/modules/pc/category/rest/PlatformCategoryAdminController.java
@@ -9,7 +9,7 @@
import com.oying.modules.pc.category.domain.dto.PlatformCategoryUpdateDto;
import com.oying.modules.pc.category.domain.dto.PlatformCategoryUpdateRequest;
import com.oying.modules.pc.category.service.PlatformCategoryService;
import com.oying.modules.pc.category.view.PlatformCategoryView;
import com.oying.modules.pc.category.view.PlatformCategoryAdminView;
import com.oying.utils.R;
import com.oying.utils.PageResult;
import io.swagger.annotations.Api;
@@ -41,14 +41,14 @@
    private final PlatformCategoryService categoryService;
    private final PlatformCategoryViewAssembler assembler;
    @GetMapping
    @GetMapping(value = "/list")
    @ApiOperation("查询平台类目(支持分页)")
    @PreAuthorize("@el.check('admin:platformCategory:list')")
    //@PreAuthorize("@el.check('admin:platformCategory:list')")
    public ResponseEntity<?> queryPlatformCategory(PlatformCategoryQueryCriteria criteria) {
        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
        PageResult<PlatformCategory> pageResult = categoryService.queryAll(criteria, page);
        List<PlatformCategoryView> responseList = Optional.ofNullable(pageResult.getContent()).orElse(new ArrayList<>()).stream().map(assembler::toPlatformCategoryResponse).collect(Collectors.toList());
        PageResult<PlatformCategoryView> responsePageResult = new PageResult<>(responseList, pageResult.getTotalElements());
        List<PlatformCategoryAdminView> responseList = Optional.ofNullable(pageResult.getContent()).orElse(new ArrayList<>()).stream().map(assembler::toPlatformCategoryResponse).collect(Collectors.toList());
        PageResult<PlatformCategoryAdminView> responsePageResult = new PageResult<>(responseList, pageResult.getTotalElements());
        return ResponseEntity.ok(R.success(responsePageResult));
    }
@@ -60,7 +60,7 @@
        return ResponseEntity.status(HttpStatus.CREATED).build();
    }
    @PutMapping("/{categoryId}")
    @PutMapping(value = "/{categoryId}")
    @ApiOperation("修改平台类目")
    //@PreAuthorize("@el.check('admin:platformCategory:updateById')")
    public ResponseEntity<?> updateById(@PathVariable Long categoryId,
oying-system/src/main/java/com/oying/modules/pc/category/service/impl/PlatformCategoryServiceImpl.java
@@ -53,7 +53,6 @@
        platformCategoryCreate.setSortWeight(request.getSortWeight());
        platformCategoryCreate.setIconId(request.getIconUploadFileId());
        platformCategoryCreate.setActive(request.getActive());
        platformCategoryCreate.setCreateBy(SecurityUtils.getCurrentUserId());
        // 使用处理图标文件
        platformCategoryMapper.insert(platformCategoryCreate);
@@ -76,7 +75,6 @@
        platformCategoryUpdate.setIconId(updateDto.getIconUploadFileId());
        platformCategoryUpdate.setActive(updateDto.getActive());
        existingPlatformCategory.copy(platformCategoryUpdate);
        existingPlatformCategory.setUpdateBy(SecurityUtils.getCurrentUserId());
        platformCategoryMapper.updateById(existingPlatformCategory);
        // 使用处理图标文件
oying-system/src/main/java/com/oying/modules/pc/category/view/PlatformCategoryAdminView.java
New file
@@ -0,0 +1,29 @@
package com.oying.modules.pc.category.view;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
public class PlatformCategoryAdminView implements Serializable {
    private Long categoryId;
    private String name;
    private Integer sortWeight;
    private String iconUrl;
    private Integer active;
    private String createBy;
    private LocalDateTime createTime;
    private String updateBy;
    private LocalDateTime updateTime;
}
oying-system/src/main/java/com/oying/modules/pc/category/view/PlatformCategoryView.java
File was deleted
oying-system/src/main/resources/mapper/pc/category/PlatformCategoryMapper.xml
@@ -8,6 +8,7 @@
        <result column="level" property="level"/>
        <result column="sort_weight" property="sortWeight"/>
        <result column="icon_id" property="iconId"/>
        <result column="icon_url" property="iconId"/>
        <result column="status" property="status"/>
        <result column="active" property="active"/>
        <result column="create_by" property="createBy"/>
@@ -25,9 +26,18 @@
        <include refid="Base_Column_List"/>
        from pc_platform_category
        <where>
            <if test="criteria.blurry != null and criteria.blurry != ''">
                and name like concat('%',#{criteria.blurry},'%')
            </if>
            <if test="criteria.active != null">
                and active = #{criteria.active}
            </if>
            <if test="criteria.createStart != null">
                and create_time &gt;= #{criteria.createStart}
            </if>
            <if test="criteria.createEnd != null">
                and create_time &lt;= #{criteria.createEnd}
            </if>
        </where>
        order by category_id desc
    </select>