大屏项目初始化
This commit is contained in:
15
src/main/java/com/mini/mybigscreen/Model/PageResult.java
Normal file
15
src/main/java/com/mini/mybigscreen/Model/PageResult.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.mini.mybigscreen.Model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PageResult<T> implements Serializable {
|
||||
|
||||
private List<T> list; // 当前页数据
|
||||
private Integer currentPage; // 当前页码
|
||||
private Integer pageSize; // 每页条数
|
||||
private Integer total; // 总记录数
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.mini.mybigscreen.biz.controller;
|
||||
|
||||
import com.mini.mybigscreen.Model.Result;
|
||||
import com.mini.mybigscreen.biz.domain.ErpCategory;
|
||||
import com.mini.mybigscreen.biz.service.ErpCategoryService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支分类 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/biz/erpCategory")
|
||||
public class ErpCategoryController {
|
||||
|
||||
|
||||
@Resource
|
||||
private ErpCategoryService categoryService;
|
||||
|
||||
@GetMapping("list")
|
||||
public Result<List<ErpCategory>> getList() {
|
||||
return Result.success(categoryService.list());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.mini.mybigscreen.biz.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mini.mybigscreen.Model.PageResult;
|
||||
import com.mini.mybigscreen.Model.Result;
|
||||
import com.mini.mybigscreen.biz.domain.ErpTransactionFlow;
|
||||
import com.mini.mybigscreen.biz.service.ErpTransactionFlowService;
|
||||
import com.mini.mybigscreen.utils.PageUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支流水总表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/biz/erpTransactionFlow")
|
||||
public class ErpTransactionFlowController {
|
||||
|
||||
@Resource
|
||||
private ErpTransactionFlowService flowService;
|
||||
|
||||
|
||||
@GetMapping("list")
|
||||
public Result<?> getList(Integer pageNum, Integer pageSize,
|
||||
String accountId, String flowName, String transactionType, String categoryId) {
|
||||
QueryWrapper<ErpTransactionFlow> query = new QueryWrapper<>();
|
||||
query.like(StrUtil.isNotBlank(flowName), "flow_name", flowName)
|
||||
.eq(StrUtil.isNotBlank(accountId), "account_id", accountId)
|
||||
.eq(StrUtil.isNotBlank(categoryId), "category_id", categoryId)
|
||||
.eq(StrUtil.isNotBlank(transactionType), "transaction_type", transactionType)
|
||||
.orderByDesc("create_time");
|
||||
List<ErpTransactionFlow> flowList = flowService.list(query);
|
||||
PageUtil<ErpTransactionFlow> pageUtil = new PageUtil<>(pageNum, pageSize, flowList);
|
||||
List<ErpTransactionFlow> pageData = pageUtil.OkData();
|
||||
PageResult<ErpTransactionFlow> result = new PageResult<>();
|
||||
result.setList(pageData); // 当前页数据
|
||||
result.setCurrentPage(pageNum); // 当前页码
|
||||
result.setPageSize(pageSize); // 每页条数
|
||||
result.setTotal(flowList.size()); // 总条数
|
||||
return Result.success(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.mini.mybigscreen.biz.domain;
|
||||
|
||||
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 java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支分类
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("erp_category")
|
||||
public class ErpCategory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 分类标识
|
||||
*/
|
||||
@TableId(value = "category_id", type = IdType.AUTO)
|
||||
private String categoryId;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
@TableField("category_name")
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 分类类型
|
||||
*/
|
||||
@TableField("category_type")
|
||||
private String categoryType;
|
||||
|
||||
/**
|
||||
* 父分类ID(0-一级分类)
|
||||
*/
|
||||
@TableField("parent_id")
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 排序序号
|
||||
*/
|
||||
@TableField("sort_order")
|
||||
private String sortOrder;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@TableField("is_active")
|
||||
private String isActive;
|
||||
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@TableField("f_tenant_id")
|
||||
private String fTenantId;
|
||||
|
||||
/**
|
||||
* 流程id
|
||||
*/
|
||||
@TableField("f_flow_id")
|
||||
private String fFlowId;
|
||||
|
||||
/**
|
||||
* 流程任务主键
|
||||
*/
|
||||
@TableField("f_flow_task_id")
|
||||
private String fFlowTaskId;
|
||||
|
||||
/**
|
||||
* 流程任务状态
|
||||
*/
|
||||
@TableField("f_flow_state")
|
||||
private Integer fFlowState;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.mini.mybigscreen.biz.domain;
|
||||
|
||||
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 java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支流水总表
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("erp_transaction_flow_view")
|
||||
public class ErpTransactionFlow implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 流水ID
|
||||
*/
|
||||
@TableId(value = "flow_id", type = IdType.AUTO)
|
||||
private String flowId;
|
||||
|
||||
/**
|
||||
* 交易名称
|
||||
*/
|
||||
@TableField("flow_name")
|
||||
private String flowName;
|
||||
|
||||
/**
|
||||
* 交易类型
|
||||
*/
|
||||
@TableField("transaction_type")
|
||||
private String transactionType;
|
||||
|
||||
/**
|
||||
* 交易金额(正数)
|
||||
*/
|
||||
@TableField("amount")
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 交易时间
|
||||
*/
|
||||
@TableField("transaction_time")
|
||||
private String transactionTime;
|
||||
|
||||
/**
|
||||
* 交易账户
|
||||
*/
|
||||
@TableField("account_id")
|
||||
private String accountId;
|
||||
|
||||
/**
|
||||
* 交易分类
|
||||
*/
|
||||
@TableField("category_id")
|
||||
private String categoryId;
|
||||
|
||||
/**
|
||||
* 交易备注
|
||||
*/
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否记账
|
||||
*/
|
||||
@TableField("is_finish")
|
||||
private String isFinish;
|
||||
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 账户名称
|
||||
*/
|
||||
@TableField("account_name")
|
||||
private String accountName;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
@TableField("category_name")
|
||||
private String categoryName;
|
||||
|
||||
@TableField("tran_type")
|
||||
private String tranType;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mini.mybigscreen.biz.mapper;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.ErpCategory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支分类 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
public interface ErpCategoryMapper extends BaseMapper<ErpCategory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mini.mybigscreen.biz.mapper;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.ErpTransactionFlow;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支流水总表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
public interface ErpTransactionFlowMapper extends BaseMapper<ErpTransactionFlow> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mini.mybigscreen.biz.service;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.ErpCategory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支分类 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
public interface ErpCategoryService extends IService<ErpCategory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mini.mybigscreen.biz.service;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.ErpTransactionFlow;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支流水总表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
public interface ErpTransactionFlowService extends IService<ErpTransactionFlow> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mini.mybigscreen.biz.service.impl;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.ErpCategory;
|
||||
import com.mini.mybigscreen.biz.mapper.ErpCategoryMapper;
|
||||
import com.mini.mybigscreen.biz.service.ErpCategoryService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支分类 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@Service
|
||||
public class ErpCategoryServiceImpl extends ServiceImpl<ErpCategoryMapper, ErpCategory> implements ErpCategoryService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mini.mybigscreen.biz.service.impl;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.ErpTransactionFlow;
|
||||
import com.mini.mybigscreen.biz.mapper.ErpTransactionFlowMapper;
|
||||
import com.mini.mybigscreen.biz.service.ErpTransactionFlowService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收支流水总表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@Service
|
||||
public class ErpTransactionFlowServiceImpl extends ServiceImpl<ErpTransactionFlowMapper, ErpTransactionFlow> implements ErpTransactionFlowService {
|
||||
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class demo {
|
||||
.pathInfo(Collections.singletonMap(OutputFile.xml, System.getProperty("user.dir") + "/src/main/resources/mapper"));
|
||||
})
|
||||
.strategyConfig(builder -> {
|
||||
builder.addInclude("biz_home_user")
|
||||
builder.addInclude("erp_category")
|
||||
.addTablePrefix("biz_")
|
||||
.entityBuilder()
|
||||
.enableLombok()
|
||||
|
||||
45
src/main/java/com/mini/mybigscreen/utils/PageUtil.java
Normal file
45
src/main/java/com/mini/mybigscreen/utils/PageUtil.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.mini.mybigscreen.utils;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PageUtil<T> {
|
||||
|
||||
|
||||
private List<T> data;
|
||||
private Integer curPage;// 当前页
|
||||
private int totalCount;// 总条数
|
||||
private int pageSize; // 每页显示的条数
|
||||
|
||||
//构造数据
|
||||
public PageUtil(int curPage, int pageSize, List<T> data) {
|
||||
this.data = data;
|
||||
this.curPage = curPage;
|
||||
this.pageSize = pageSize;
|
||||
this.totalCount = data.size();
|
||||
}
|
||||
|
||||
//求当前页的第一条数据的索引
|
||||
public int beginIndex(int pageSize, int curPage) {
|
||||
Integer begin = pageSize * (curPage - 1);
|
||||
return begin;
|
||||
}
|
||||
|
||||
//求当前页的最后一条数据的索引
|
||||
public int endIndex(int pageSize, int curPage) {
|
||||
Integer end = (pageSize * curPage) - 1;
|
||||
return end;
|
||||
}
|
||||
|
||||
//拿到分页后的数据
|
||||
public List<T> OkData() {
|
||||
List<T> list = new ArrayList<T>();
|
||||
for (int i = beginIndex(pageSize, curPage); i <= endIndex(pageSize, curPage); i++) {
|
||||
if (i < totalCount) {
|
||||
list.add(data.get(i));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user