13 changed files with 589 additions and 2 deletions
@ -0,0 +1,113 @@ |
|||
package com.qs.serve.modules.exl.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.exl.entity.ExlTableConf; |
|||
import com.qs.serve.modules.exl.service.ExlTableConfService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 动态Excel表 表配置 |
|||
* @author YenHex |
|||
* @since 2023-08-11 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("exl/tableConf") |
|||
public class ExlTableConfController { |
|||
|
|||
private ExlTableConfService exlTableConfService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
//@GetMapping("/list")
|
|||
public R<List<ExlTableConf>> getList(ExlTableConf param){ |
|||
LambdaQueryWrapper<ExlTableConf> lqw = new LambdaQueryWrapper<>(param); |
|||
List<ExlTableConf> list = exlTableConfService.list(lqw); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<ExlTableConf>> getPage(ExlTableConf param){ |
|||
LambdaQueryWrapper<ExlTableConf> lqw = new LambdaQueryWrapper<>(param); |
|||
PageUtil.startPage(); |
|||
List<ExlTableConf> list = exlTableConfService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.Excel, title = "表配置", biz = BizType.QUERY) |
|||
public R<ExlTableConf> getById(@PathVariable("id") String id){ |
|||
ExlTableConf exlTableConf = exlTableConfService.getById(id); |
|||
return R.ok(exlTableConf); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.Excel, title = "表配置", biz = BizType.UPDATE) |
|||
public R<?> updateById(@RequestBody @Valid ExlTableConf param){ |
|||
boolean result = exlTableConfService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.Excel, title = "表配置", biz = BizType.INSERT) |
|||
public R<?> save(@RequestBody @Valid ExlTableConf param){ |
|||
boolean result = exlTableConfService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.Excel, title = "表配置", biz = BizType.DELETE) |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = exlTableConfService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,102 @@ |
|||
package com.qs.serve.modules.exl.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 行配置 实体类 |
|||
* @author YenHex |
|||
* @since 2023-08-14 |
|||
*/ |
|||
@Data |
|||
@TableName("exl_column_conf") |
|||
public class ExlColumnConf implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@JsonIgnore |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 表名 */ |
|||
@NotBlank(message = "表名不能为空") |
|||
@Length(max = 255,message = "表名长度不能超过255字") |
|||
private String columnName; |
|||
|
|||
/** excel头部 */ |
|||
@NotBlank(message = "excel头部不能为空") |
|||
@Length(max = 255,message = "excel头部长度不能超过255字") |
|||
private String columnHeader; |
|||
|
|||
/** 数据类型:string;int;money;date;datetime; */ |
|||
@Length(max = 255,message = "数据类型:string;int;money;date;datetime;长度不能超过255字") |
|||
private String columnType; |
|||
|
|||
@JsonIgnore |
|||
/** 作为查询条件标识 string-like;int-eq;date-between;datetime-between */ |
|||
@NotNull(message = "作为查询条件标识 string-like;int-eq;date-between;datetime-between不能为空") |
|||
private Integer conditionFlag; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
public static ExlColumnConf toNewObject(ExlColumnConf source){ |
|||
ExlColumnConf columnConf = new ExlColumnConf(); |
|||
columnConf.setId(source.getId()); |
|||
columnConf.setColumnName(source.getColumnName()); |
|||
columnConf.setColumnHeader(source.getColumnHeader()); |
|||
columnConf.setColumnType(source.getColumnType()); |
|||
columnConf.setConditionFlag(source.getConditionFlag()); |
|||
columnConf.setCreateTime(source.getCreateTime()); |
|||
columnConf.setUpdateTime(source.getUpdateTime()); |
|||
columnConf.setTenantId(source.getTenantId()); |
|||
columnConf.setCreateBy(source.getCreateBy()); |
|||
columnConf.setUpdateBy(source.getUpdateBy()); |
|||
columnConf.setDelFlag(source.getDelFlag()); |
|||
return columnConf; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,105 @@ |
|||
package com.qs.serve.modules.exl.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 数据源配置 实体类 |
|||
* @author YenHex |
|||
* @since 2023-08-11 |
|||
*/ |
|||
@Data |
|||
@TableName("exl_ds_conf") |
|||
public class ExlDsConf implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 启用 */ |
|||
@NotNull(message = "启用不能为空") |
|||
private Integer enable; |
|||
|
|||
/** 用户名 */ |
|||
@NotBlank(message = "用户名不能为空") |
|||
@Length(max = 255,message = "用户名长度不能超过255字") |
|||
private String username; |
|||
|
|||
/** 密码 */ |
|||
@NotBlank(message = "密码不能为空") |
|||
@Length(max = 255,message = "密码长度不能超过255字") |
|||
private String password; |
|||
|
|||
/** url */ |
|||
@Length(max = 255,message = "url长度不能超过255字") |
|||
private String url; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
public static ExlDsConf toNewObject(ExlDsConf source){ |
|||
ExlDsConf dsConf = new ExlDsConf(); |
|||
dsConf.setId(source.getId()); |
|||
dsConf.setEnable(source.getEnable()); |
|||
dsConf.setUsername(source.getUsername()); |
|||
dsConf.setPassword(source.getPassword()); |
|||
dsConf.setUrl(source.getUrl()); |
|||
dsConf.setRemark(source.getRemark()); |
|||
dsConf.setCreateTime(source.getCreateTime()); |
|||
dsConf.setUpdateTime(source.getUpdateTime()); |
|||
dsConf.setTenantId(source.getTenantId()); |
|||
dsConf.setCreateBy(source.getCreateBy()); |
|||
dsConf.setUpdateBy(source.getUpdateBy()); |
|||
dsConf.setDelFlag(source.getDelFlag()); |
|||
return dsConf; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,98 @@ |
|||
package com.qs.serve.modules.exl.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 表配置 实体类 |
|||
* @author YenHex |
|||
* @since 2023-08-11 |
|||
*/ |
|||
@Data |
|||
@TableName("exl_table_conf") |
|||
public class ExlTableConf implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 表名 */ |
|||
@NotBlank(message = "表名不能为空") |
|||
@Length(max = 255,message = "表名长度不能超过255字") |
|||
private String tableName; |
|||
|
|||
/** excel标题 */ |
|||
@NotBlank(message = "excel标题不能为空") |
|||
@Length(max = 255,message = "excel标题长度不能超过255字") |
|||
private String excelTitle; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 启用标识 (0/1) */ |
|||
private String enableFlag; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
public static ExlTableConf toNewObject(ExlTableConf source){ |
|||
ExlTableConf tableConf = new ExlTableConf(); |
|||
tableConf.setId(source.getId()); |
|||
tableConf.setTableName(source.getTableName()); |
|||
tableConf.setExcelTitle(source.getExcelTitle()); |
|||
tableConf.setRemark(source.getRemark()); |
|||
tableConf.setCreateTime(source.getCreateTime()); |
|||
tableConf.setUpdateTime(source.getUpdateTime()); |
|||
tableConf.setTenantId(source.getTenantId()); |
|||
tableConf.setCreateBy(source.getCreateBy()); |
|||
tableConf.setUpdateBy(source.getUpdateBy()); |
|||
tableConf.setDelFlag(source.getDelFlag()); |
|||
return tableConf; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,39 @@ |
|||
package com.qs.serve.modules.exl.entity.dto; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.qs.serve.modules.exl.entity.ExlColumnConf; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/8/14 |
|||
*/ |
|||
@Data |
|||
public class ExlTableBo { |
|||
|
|||
/** id(修改时参数) */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 表名 */ |
|||
@NotBlank(message = "表名不能为空") |
|||
@Length(max = 255,message = "表名长度不能超过255字") |
|||
private String tableName; |
|||
|
|||
/** excel标题 */ |
|||
@NotBlank(message = "excel标题不能为空") |
|||
@Length(max = 255,message = "excel标题长度不能超过255字") |
|||
private String excelTitle; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
private List<ExlColumnConf> columnList; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.exl.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.exl.entity.ExlColumnConf; |
|||
|
|||
/** |
|||
* 行配置 Mapper |
|||
* @author YenHex |
|||
* @date 2023-08-14 |
|||
*/ |
|||
public interface ExlColumnConfMapper extends BaseMapper<ExlColumnConf> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.exl.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.exl.entity.ExlDsConf; |
|||
|
|||
/** |
|||
* 数据源配置 Mapper |
|||
* @author YenHex |
|||
* @date 2023-08-11 |
|||
*/ |
|||
public interface ExlDsConfMapper extends BaseMapper<ExlDsConf> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.exl.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.exl.entity.ExlTableConf; |
|||
|
|||
/** |
|||
* 表配置 Mapper |
|||
* @author YenHex |
|||
* @date 2023-08-11 |
|||
*/ |
|||
public interface ExlTableConfMapper extends BaseMapper<ExlTableConf> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.exl.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.exl.entity.ExlColumnConf; |
|||
|
|||
/** |
|||
* 行配置 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-08-14 |
|||
*/ |
|||
public interface ExlColumnConfService extends IService<ExlColumnConf> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,21 @@ |
|||
package com.qs.serve.modules.exl.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.exl.entity.ExlTableConf; |
|||
import com.qs.serve.modules.exl.entity.dto.ExlTableBo; |
|||
|
|||
/** |
|||
* 表配置 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-08-11 |
|||
*/ |
|||
public interface ExlTableConfService extends IService<ExlTableConf> { |
|||
|
|||
/** |
|||
* 编辑 |
|||
* @param param |
|||
*/ |
|||
void modify(ExlTableBo param); |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.exl.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.exl.entity.ExlColumnConf; |
|||
import com.qs.serve.modules.exl.service.ExlColumnConfService; |
|||
import com.qs.serve.modules.exl.mapper.ExlColumnConfMapper; |
|||
|
|||
/** |
|||
* 行配置 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-08-14 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class ExlColumnConfServiceImpl extends ServiceImpl<ExlColumnConfMapper,ExlColumnConf> implements ExlColumnConfService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,31 @@ |
|||
package com.qs.serve.modules.exl.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.qs.serve.modules.exl.entity.dto.ExlTableBo; |
|||
import com.qs.serve.modules.exl.service.ExlColumnConfService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.exl.entity.ExlTableConf; |
|||
import com.qs.serve.modules.exl.service.ExlTableConfService; |
|||
import com.qs.serve.modules.exl.mapper.ExlTableConfMapper; |
|||
|
|||
/** |
|||
* 表配置 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-08-11 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class ExlTableConfServiceImpl extends ServiceImpl<ExlTableConfMapper,ExlTableConf> implements ExlTableConfService { |
|||
|
|||
private final ExlColumnConfService columnConfService; |
|||
|
|||
@Override |
|||
public void modify(ExlTableBo param) { |
|||
|
|||
} |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue