7 changed files with 275 additions and 17 deletions
@ -0,0 +1,99 @@ |
|||
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.StringUtils; |
|||
import com.qs.serve.modules.exl.entity.ExlColumnConf; |
|||
import com.qs.serve.modules.exl.entity.ExlTableConf; |
|||
import com.qs.serve.modules.exl.entity.dto.ExlQueryFieldDto; |
|||
import com.qs.serve.modules.exl.entity.dto.ExlTableBo; |
|||
import com.qs.serve.modules.exl.service.ExlColumnConfService; |
|||
import com.qs.serve.modules.exl.service.ExlTableConfService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.time.LocalDateTime; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 动态Excel表 表配置 |
|||
* @author YenHex |
|||
* @since 2023-08-11 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("exl/tableData") |
|||
public class ExlTableDataController { |
|||
|
|||
private ExlTableConfService exlTableConfService; |
|||
private ExlColumnConfService exlColumnConfService; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 翻页 |
|||
* @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); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
public R<?> updateById(@RequestBody @Valid ExlTableBo param){ |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
public R<?> save(@RequestBody @Valid ExlTableBo param){ |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @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); |
|||
LambdaQueryWrapper<ExlTableConf> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.in(ExlTableConf::getId,ids); |
|||
lqw.eq(ExlTableConf::getEnableFlag,1); |
|||
Long count = exlTableConfService.count(lqw); |
|||
if(count>0){ |
|||
return R.error("已启用的配置不可删除"); |
|||
} |
|||
boolean result = exlTableConfService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,24 @@ |
|||
package com.qs.serve.modules.exl.entity.dto; |
|||
|
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/8/14 |
|||
*/ |
|||
@Data |
|||
public class ExlQueryFieldDto { |
|||
|
|||
/** 字段名 */ |
|||
private String field; |
|||
|
|||
/** 数据类型 */ |
|||
private String type; |
|||
|
|||
/** 显示标签 */ |
|||
private String label; |
|||
|
|||
} |
Loading…
Reference in new issue