add biz sql

This commit is contained in:
2025-10-06 21:24:21 +08:00
parent 5dda521897
commit a8d7740e23
11 changed files with 671 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
import org.springblade.modules.kiosk.pojo.vo.CategoryVO;
import org.springblade.modules.kiosk.excel.CategoryExcel;
import org.springblade.modules.kiosk.wrapper.CategoryWrapper;
import org.springblade.modules.kiosk.service.ICategoryService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.tool.constant.BladeConstant;
import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/**
* 自助终端产品目录表 控制器
*
* @author Ray
* @since 2025-10-06
*/
@RestController
@AllArgsConstructor
@RequestMapping("kiosk/category")
@Tag(name = "自助终端产品目录表", description = "自助终端产品目录表接口")
public class CategoryController extends BladeController {
private final ICategoryService categoryService;
/**
* 自助终端产品目录表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入category")
public R<CategoryVO> detail(CategoryEntity category) {
CategoryEntity detail = categoryService.getOne(Condition.getQueryWrapper(category));
return R.data(CategoryWrapper.build().entityVO(detail));
}
/**
* 自助终端产品目录表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入category")
public R<IPage<CategoryVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> category, Query query) {
IPage<CategoryEntity> pages = categoryService.page(Condition.getPage(query), Condition.getQueryWrapper(category, CategoryEntity.class));
return R.data(CategoryWrapper.build().pageVO(pages));
}
/**
* 自助终端产品目录表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入category")
public R<IPage<CategoryVO>> page(CategoryVO category, Query query) {
IPage<CategoryVO> pages = categoryService.selectCategoryPage(Condition.getPage(query), category);
return R.data(pages);
}
/**
* 自助终端产品目录表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入category")
public R save(@Valid @RequestBody CategoryEntity category) {
return R.status(categoryService.save(category));
}
/**
* 自助终端产品目录表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入category")
public R update(@Valid @RequestBody CategoryEntity category) {
return R.status(categoryService.updateById(category));
}
/**
* 自助终端产品目录表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入category")
public R submit(@Valid @RequestBody CategoryEntity category) {
return R.status(categoryService.saveOrUpdate(category));
}
/**
* 自助终端产品目录表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(categoryService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,104 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.excel;
import lombok.Data;
import java.util.Date;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import java.io.Serializable;
import java.io.Serial;
/**
* 自助终端产品目录表 Excel实体类
*
* @author Ray
* @since 2025-10-06
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class CategoryExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ColumnWidth(20)
@ExcelProperty("主键")
private Long id;
/**
* 租户ID
*/
@ColumnWidth(20)
@ExcelProperty("租户ID")
private String tenantId;
/**
* 类型 1:单张,2:组合 3:配件
*/
@ColumnWidth(20)
@ExcelProperty("类型 1:单张,2:组合 3:配件")
private Integer type;
/**
* 产品名称
*/
@ColumnWidth(20)
@ExcelProperty("产品名称")
private String name;
/**
* 目录图片地址
*/
@ColumnWidth(20)
@ExcelProperty("目录图片地址")
private String imageUrl;
/**
* 照片数量
*/
@ColumnWidth(20)
@ExcelProperty("照片数量")
private Integer photoLimit;
/**
* 形状
*/
@ColumnWidth(20)
@ExcelProperty("形状")
private String shape;
/**
* 是否已删除
*/
@ColumnWidth(20)
@ExcelProperty("是否已删除")
private Integer isDeleted;
}

View File

@@ -0,0 +1,54 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.mapper;
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
import org.springblade.modules.kiosk.pojo.vo.CategoryVO;
import org.springblade.modules.kiosk.excel.CategoryExcel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 自助终端产品目录表 Mapper 接口
*
* @author Ray
* @since 2025-10-06
*/
public interface CategoryMapper extends BaseMapper<CategoryEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param category 查询参数
* @return List<CategoryVO>
*/
List<CategoryVO> selectCategoryPage(IPage page, CategoryVO category);
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.kiosk.mapper.CategoryMapper">
<!-- 通用查询映射结果 -->
<resultMap id="categoryResultMap" type="org.springblade.modules.kiosk.pojo.entity.CategoryEntity">
<result column="id" property="id"/>
<result column="tenant_id" property="tenantId"/>
<result column="type" property="type"/>
<result column="name" property="name"/>
<result column="image_url" property="imageUrl"/>
<result column="photo_limit" property="photoLimit"/>
<result column="shape" property="shape"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
<select id="selectCategoryPage" resultMap="categoryResultMap">
select * from kiosk_category where is_deleted = 0
</select>
</mapper>

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.pojo.dto;
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 自助终端产品目录表 数据传输对象实体类
*
* @author Ray
* @since 2025-10-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CategoryDTO extends CategoryEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,77 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.pojo.entity;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serial;
/**
* 自助终端产品目录表 实体类
*
* @author Ray
* @since 2025-10-06
*/
@Data
@TableName("kiosk_category")
@Schema(description = "Category对象")
@EqualsAndHashCode(callSuper = true)
public class CategoryEntity extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 类型 1:单张,2:组合 3:配件
*/
@Schema(description = "类型 1:单张,2:组合 3:配件")
private Integer type;
/**
* 产品名称
*/
@Schema(description = "产品名称")
private String name;
/**
* 目录图片地址
*/
@Schema(description = "目录图片地址")
private String imageUrl;
/**
* 照片数量
*/
@Schema(description = "照片数量")
private Integer photoLimit;
/**
* 形状
*/
@Schema(description = "形状")
private String shape;
}

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.pojo.vo;
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 自助终端产品目录表 视图实体类
*
* @author Ray
* @since 2025-10-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CategoryVO extends CategoryEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,52 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
import org.springblade.modules.kiosk.pojo.vo.CategoryVO;
import org.springblade.modules.kiosk.excel.CategoryExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* 自助终端产品目录表 服务类
*
* @author Ray
* @since 2025-10-06
*/
public interface ICategoryService extends BaseService<CategoryEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param category 查询参数
* @return IPage<CategoryVO>
*/
IPage<CategoryVO> selectCategoryPage(IPage<CategoryVO> page, CategoryVO category);
}

View File

@@ -0,0 +1,53 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.service.impl;
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
import org.springblade.modules.kiosk.pojo.vo.CategoryVO;
import org.springblade.modules.kiosk.excel.CategoryExcel;
import org.springblade.modules.kiosk.mapper.CategoryMapper;
import org.springblade.modules.kiosk.service.ICategoryService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import java.util.List;
/**
* 自助终端产品目录表 服务实现类
*
* @author Ray
* @since 2025-10-06
*/
@Service
public class CategoryServiceImpl extends BaseServiceImpl<CategoryMapper, CategoryEntity> implements ICategoryService {
@Override
public IPage<CategoryVO> selectCategoryPage(IPage<CategoryVO> page, CategoryVO category) {
return page.setRecords(baseMapper.selectCategoryPage(page, category));
}
}

View File

@@ -0,0 +1,59 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
import org.springblade.modules.kiosk.pojo.vo.CategoryVO;
import java.util.Objects;
/**
* 自助终端产品目录表 包装类,返回视图层所需的字段
*
* @author Ray
* @since 2025-10-06
*/
public class CategoryWrapper extends BaseEntityWrapper<CategoryEntity, CategoryVO> {
public static CategoryWrapper build() {
return new CategoryWrapper();
}
@Override
public CategoryVO entityVO(CategoryEntity category) {
CategoryVO categoryVO = Objects.requireNonNull(BeanUtil.copyProperties(category, CategoryVO.class));
//User createUser = UserCache.getUser(category.getCreateUser());
//User updateUser = UserCache.getUser(category.getUpdateUser());
//categoryVO.setCreateUserName(createUser.getName());
//categoryVO.setUpdateUserName(updateUser.getName());
return categoryVO;
}
}