| | |
| | | |
| | | # Mybatis-plus |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | configuration: |
| | | #缓存开启 |
| | | cache-enabled: true |
| | | default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler # 通用枚举处理器 |
| | | #日志 |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | global-config: |
| | | db-config: |
| | | #逻辑删除配置字段 |
| | | logic-delete-field: deleteFlag |
| | | #逻辑删除配置字段 1 删除 |
| | | logic-delete-value: 1 |
| | | #逻辑删除配置字段 0 不删除 |
| | | logic-not-delete-value: 0 |
| | | |
| | | # 日志 |
| | | logging: |
New file |
| | |
| | | package cn.lili.base; |
| | | |
| | | import cn.lili.group.Update; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * @author xp |
| | | * @date 2022/11/29 |
| | | */ |
| | | @Data |
| | | public abstract class AbsForm { |
| | | |
| | | @ApiModelProperty(value = "id,修改必传", required = false) |
| | | @NotNull(message = "请选择数据", groups = {Update.class}) |
| | | private String id; |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.base; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 基础分页查询,默认第一页,每页10条 |
| | | * |
| | | * @author xp |
| | | * @date 2022/11/29 |
| | | */ |
| | | @Data |
| | | public class AbsQuery { |
| | | |
| | | @ApiModelProperty(value = "当前页", required = true) |
| | | private long pageNumber = 1L; |
| | | |
| | | @ApiModelProperty(value = "每页条数", required = true) |
| | | private long pageSize = 10L; |
| | | |
| | | public Map<String, Object> params = new HashMap<>(2); |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.base; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author xp |
| | | * @date 2022/11/29 |
| | | */ |
| | | @Data |
| | | public abstract class AbsVo { |
| | | |
| | | @ApiModelProperty("id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty("修改时间") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty("创建人") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty("修改人") |
| | | private String updateBy; |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.base; |
| | | |
| | | import org.springframework.lang.NonNull; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * 操作消息提醒 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Result extends HashMap<String, Object> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private static final String TOTAL = "total"; |
| | | |
| | | public static final String DATA = "data"; |
| | | |
| | | private static final String MSG = "msg"; |
| | | |
| | | private static final String CODE = "code"; |
| | | |
| | | public Result() { |
| | | put(MSG, "success"); |
| | | put(CODE, 200); |
| | | } |
| | | |
| | | /** |
| | | * 成功,啥也不做 |
| | | * @return |
| | | */ |
| | | public static Result ok() { |
| | | return new Result(); |
| | | } |
| | | |
| | | /** |
| | | * 成功,自定义提示信息 |
| | | * @param msg |
| | | * @return |
| | | */ |
| | | public static Result ok(String msg) { |
| | | Result result = new Result(); |
| | | result.put(MSG, msg); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 失败,啥也不做 |
| | | * @return |
| | | */ |
| | | public static Result error() { |
| | | Result result = new Result(); |
| | | result.put(CODE, 500); |
| | | result.put(MSG, "操作失败"); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 失败,自定义错误提示 |
| | | * @param msg |
| | | * @return |
| | | */ |
| | | public static Result error(String msg) { |
| | | Result result = new Result(); |
| | | result.put(CODE, 500); |
| | | result.put(MSG, msg); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 失败,自定义错误码 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static Result error(@NonNull Integer code) { |
| | | Result result = new Result(); |
| | | result.put(CODE, code); |
| | | result.put(MSG, "操作失败"); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 失败,自定义错误码和错误提示 |
| | | * @param code |
| | | * @param msg |
| | | * @return |
| | | */ |
| | | public static Result error(@NonNull Integer code, String msg) { |
| | | Result result = new Result(); |
| | | result.put(CODE, code); |
| | | result.put(MSG, msg); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public Result data(Object data) { |
| | | this.put(DATA, data); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 添加总条数 |
| | | * @param total |
| | | * @return |
| | | */ |
| | | public Result total(long total) { |
| | | this.put(TOTAL, total); |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public Result put(String key, Object value) { |
| | | super.put(key, value); |
| | | return this; |
| | | } |
| | | } |
New file |
| | |
| | | package cn.lili.group; |
| | | |
| | | /** |
| | | * @author:xp |
| | | * @date:2025/5/13 14:10 |
| | | */ |
| | | public interface Add { |
| | | } |
New file |
| | |
| | | package cn.lili.group; |
| | | |
| | | /** |
| | | * @author:xp |
| | | * @date:2025/5/13 14:10 |
| | | */ |
| | | public interface Update { |
| | | } |
New file |
| | |
| | | package cn.lili.utils; |
| | | |
| | | import cn.lili.base.AbsQuery; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | /** |
| | | * 分页工具类 |
| | | * @author xp |
| | | * @date 2022/12/2 |
| | | */ |
| | | public class PageUtil { |
| | | |
| | | /** |
| | | * 获取plus的分页对象 |
| | | * @param q |
| | | * @param <T> 实体类 |
| | | * @param <Q> 查询类 |
| | | * @return |
| | | */ |
| | | public static <T, Q extends AbsQuery> IPage<T> getPage(Q q, Class<T> c) { |
| | | Page<T> page = new Page<T>() |
| | | .setCurrent(q.getPageNumber()) |
| | | .setSize(q.getPageSize()); |
| | | return page; |
| | | } |
| | | |
| | | } |