监测断面管理查询,渗压设备管理查询,渗流设备管理列表查询,位移设备管理列表查询,数据字典列表查询接口新增
parent
a49185944b
commit
90baf8c4d8
|
|
@ -14,6 +14,7 @@ import com.gunshi.project.xyt.validate.markers.Update;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -41,9 +42,15 @@ public class AttDamProfileController extends AbstractCommonFileController{
|
|||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<AttDamProfile> insert(@Validated(Insert.class) @RequestBody AttDamProfile dto) {
|
||||
if (Objects.nonNull(service.lambdaQuery().eq(AttDamProfile::getProfileName,dto.getProfileName()))) {
|
||||
if (Objects.nonNull(service.getById(dto.getProfileCode()))) {
|
||||
throw new RuntimeException("当前编号已存在");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dto.getProfileName())){
|
||||
if (service.lambdaQuery().eq(AttDamProfile::getProfileName,dto.getProfileName()).count() > 0) {
|
||||
throw new RuntimeException("当前名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
boolean result = service.save(dto);
|
||||
if (result){
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode());
|
||||
|
|
@ -57,6 +64,14 @@ public class AttDamProfileController extends AbstractCommonFileController{
|
|||
if (Objects.isNull(service.getById(dto.getProfileCode()))) {
|
||||
throw new RuntimeException("当前数据不存在");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(dto.getProfileName())){
|
||||
if (service.lambdaQuery().eq(AttDamProfile::getProfileName,dto.getProfileName())
|
||||
.ne(AttDamProfile::getProfileCode,dto.getProfileCode())
|
||||
.count() > 0) {
|
||||
throw new RuntimeException("当前名称已存在");
|
||||
}
|
||||
}
|
||||
boolean result = service.updateById(dto);
|
||||
if (result){
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode());
|
||||
|
|
@ -93,7 +108,11 @@ public class AttDamProfileController extends AbstractCommonFileController{
|
|||
query.like(AttDamProfile::getProfileName, page.getName());
|
||||
}
|
||||
|
||||
return R.ok(service.page(page.getPageSo().toPage(), query));
|
||||
Page<AttDamProfile> data = service.page(page.getPageSo().toPage(), query);
|
||||
data.getRecords().forEach(o -> o.setFiles(
|
||||
fileService.getFiles(getGroupId(),o.getProfileCode())
|
||||
));
|
||||
return R.ok(data);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -38,6 +39,15 @@ public class IaCBsnssinfoController extends AbstractCommonFileController{
|
|||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<IaCBsnssinfo> insert(@Validated(Insert.class) @RequestBody IaCBsnssinfo dto) {
|
||||
if (Objects.nonNull(service.getById(dto.getEicd()))) {
|
||||
throw new RuntimeException("当前编号已存在");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dto.getName())){
|
||||
if (service.lambdaQuery().eq(IaCBsnssinfo::getName,dto.getName()).count() > 0) {
|
||||
throw new RuntimeException("当前名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
boolean result = service.save(dto);
|
||||
if (result){
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getEicd());
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.so.OsmoticDevicePage;
|
||||
import com.gunshi.project.xyt.entity.vo.HomeOsmoticFlowDeviceVo;
|
||||
import com.gunshi.project.xyt.model.OsmoticFlowDevice;
|
||||
import com.gunshi.project.xyt.service.FileAssociationsService;
|
||||
import com.gunshi.project.xyt.service.OsmoticFlowDeviceService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
|
|
@ -15,6 +20,8 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 描述: 渗流设备表
|
||||
* author: xusan
|
||||
|
|
@ -23,29 +30,50 @@ import java.util.List;
|
|||
@Tag(name = "渗流设备表")
|
||||
@RestController
|
||||
@RequestMapping(value="/osmoticFlowDevice")
|
||||
public class OsmoticFlowDeviceController {
|
||||
public class OsmoticFlowDeviceController extends AbstractCommonFileController{
|
||||
|
||||
@Autowired
|
||||
private OsmoticFlowDeviceService service;
|
||||
|
||||
|
||||
@Autowired
|
||||
private FileAssociationsService fileService;
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<OsmoticFlowDevice> insert(@Validated(Insert.class) @RequestBody OsmoticFlowDevice dto) {
|
||||
if (Objects.nonNull(service.getById(dto.getStationCode()))) {
|
||||
throw new RuntimeException("当前编号已存在");
|
||||
}
|
||||
|
||||
|
||||
boolean result = service.save(dto);
|
||||
if (result){
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode());
|
||||
}
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<OsmoticFlowDevice> update(@Validated(Update.class) @RequestBody OsmoticFlowDevice dto) {
|
||||
if (Objects.isNull(service.getById(dto.getStationCode()))) {
|
||||
throw new RuntimeException("当前数据不存在");
|
||||
}
|
||||
|
||||
boolean result = service.updateById(dto);
|
||||
if (result){
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode());
|
||||
}
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
if (Objects.isNull(service.getById(id))) {
|
||||
throw new RuntimeException("当前数据不存在");
|
||||
}
|
||||
return R.ok(service.removeById(id));
|
||||
}
|
||||
|
||||
|
|
@ -57,8 +85,20 @@ public class OsmoticFlowDeviceController {
|
|||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<List<OsmoticFlowDevice>> page() {
|
||||
return R.ok(service.page(null,null));
|
||||
public R<Page<OsmoticFlowDevice>> page(@RequestBody @Validated OsmoticDevicePage page) {
|
||||
LambdaQueryChainWrapper<OsmoticFlowDevice> query = service.lambdaQuery();
|
||||
if (ObjectUtils.isNotNull(page.getStationCode())) {
|
||||
query.like(OsmoticFlowDevice::getStationCode, page.getStationCode());
|
||||
}
|
||||
if (ObjectUtils.isNotNull(page.getDeviceCode())) {
|
||||
query.like(OsmoticFlowDevice::getDeviceName, page.getDeviceCode());
|
||||
}
|
||||
|
||||
Page<OsmoticFlowDevice> data = service.page(page.getPageSo().toPage(), query);
|
||||
data.getRecords().forEach(o -> o.setFiles(
|
||||
fileService.getFiles(getGroupId(),o.getStationCode())
|
||||
));
|
||||
return R.ok(data);
|
||||
}
|
||||
|
||||
@Operation(summary = "详情和监测数据查询")
|
||||
|
|
@ -66,4 +106,9 @@ public class OsmoticFlowDeviceController {
|
|||
public R<List<HomeOsmoticFlowDeviceVo>> getDetailsAndMonitoringDataList() {
|
||||
return R.ok(service.getDetailsAndMonitoringDataList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "OsmoticFlowDevice";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,13 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.so.OsmoticDevicePage;
|
||||
import com.gunshi.project.xyt.entity.vo.HomeOsmoticPressDeviceVo;
|
||||
import com.gunshi.project.xyt.model.OsmoticPressDevice;
|
||||
import com.gunshi.project.xyt.service.FileAssociationsService;
|
||||
import com.gunshi.project.xyt.service.OsmoticPressDeviceService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
|
|
@ -15,6 +20,8 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 描述: 渗压设备表
|
||||
* author: xusan
|
||||
|
|
@ -23,29 +30,47 @@ import java.util.List;
|
|||
@Tag(name = "渗压设备表")
|
||||
@RestController
|
||||
@RequestMapping(value="/osmoticPressDevice")
|
||||
public class OsmoticPressDeviceController {
|
||||
public class OsmoticPressDeviceController extends AbstractCommonFileController{
|
||||
|
||||
@Autowired
|
||||
private OsmoticPressDeviceService service;
|
||||
|
||||
@Autowired
|
||||
private FileAssociationsService fileService;
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<OsmoticPressDevice> insert(@Validated(Insert.class) @RequestBody OsmoticPressDevice dto) {
|
||||
if (Objects.nonNull(service.getById(dto.getStationCode()))) {
|
||||
throw new RuntimeException("当前编号已存在");
|
||||
}
|
||||
|
||||
boolean result = service.save(dto);
|
||||
if (result){
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode());
|
||||
}
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<OsmoticPressDevice> update(@Validated(Update.class) @RequestBody OsmoticPressDevice dto) {
|
||||
if (Objects.isNull(service.getById(dto.getProfileCode()))) {
|
||||
throw new RuntimeException("当前数据不存在");
|
||||
}
|
||||
boolean result = service.updateById(dto);
|
||||
if (result){
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode());
|
||||
}
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
if (Objects.isNull(service.getById(id))) {
|
||||
throw new RuntimeException("当前数据不存在");
|
||||
}
|
||||
return R.ok(service.removeById(id));
|
||||
}
|
||||
|
||||
|
|
@ -57,8 +82,20 @@ public class OsmoticPressDeviceController {
|
|||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<List<OsmoticPressDevice>> page() {
|
||||
return R.ok(service.page(null,null));
|
||||
public R<Page<OsmoticPressDevice>> page(@RequestBody @Validated OsmoticDevicePage page) {
|
||||
LambdaQueryChainWrapper<OsmoticPressDevice> query = service.lambdaQuery();
|
||||
if (ObjectUtils.isNotNull(page.getStationCode())) {
|
||||
query.like(OsmoticPressDevice::getStationCode, page.getStationCode());
|
||||
}
|
||||
if (ObjectUtils.isNotNull(page.getDeviceCode())) {
|
||||
query.like(OsmoticPressDevice::getDeviceName, page.getDeviceCode());
|
||||
}
|
||||
|
||||
Page<OsmoticPressDevice> data = service.page(page.getPageSo().toPage(), query);
|
||||
data.getRecords().forEach(o -> o.setFiles(
|
||||
fileService.getFiles(getGroupId(),o.getStationCode())
|
||||
));
|
||||
return R.ok(data);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -68,4 +105,8 @@ public class OsmoticPressDeviceController {
|
|||
return R.ok(service.getDetailsAndMonitoringDataList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "OsmoticPressDevice";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.page.GenericPageParams;
|
||||
import com.gunshi.project.xyt.model.SysDictB;
|
||||
import com.gunshi.project.xyt.service.SysDictBService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
|
|
@ -8,12 +11,15 @@ import com.gunshi.project.xyt.validate.markers.Update;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 描述: 系统字典表
|
||||
* author: xusan
|
||||
|
|
@ -31,6 +37,19 @@ public class SysDictBController {
|
|||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<SysDictB> insert(@Validated(Insert.class) @RequestBody SysDictB dto) {
|
||||
|
||||
if (StringUtils.isNotBlank(dto.getDictNm())){
|
||||
if (service.lambdaQuery().eq(SysDictB::getDictNm,dto.getDictNm())
|
||||
.count() > 0) {
|
||||
throw new RuntimeException("当前名称已存在");
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(dto.getPid())){
|
||||
if (service.lambdaQuery().eq(SysDictB::getId,dto.getPid())
|
||||
.count() == 0) {
|
||||
throw new RuntimeException("当父级不存在");
|
||||
}
|
||||
}
|
||||
boolean result = service.save(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
|
@ -38,6 +57,19 @@ public class SysDictBController {
|
|||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<SysDictB> update(@Validated(Update.class) @RequestBody SysDictB dto) {
|
||||
|
||||
if (StringUtils.isNotBlank(dto.getDictNm())){
|
||||
if (service.lambdaQuery().eq(SysDictB::getDictNm,dto.getDictNm())
|
||||
.count() > 0) {
|
||||
throw new RuntimeException("当前名称已存在");
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(dto.getPid())){
|
||||
if (service.lambdaQuery().eq(SysDictB::getId,dto.getPid())
|
||||
.count() == 0) {
|
||||
throw new RuntimeException("当父级不存在");
|
||||
}
|
||||
}
|
||||
boolean result = service.updateById(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
|
@ -45,19 +77,36 @@ public class SysDictBController {
|
|||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
if (Objects.isNull(service.getById(id))) {
|
||||
throw new RuntimeException("当前数据不存在");
|
||||
}
|
||||
return R.ok(service.removeById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@Operation(summary = "列表 通过父id查子项")
|
||||
@PostMapping("/list")
|
||||
public R<List<SysDictB>> list() {
|
||||
return R.ok(service.lambdaQuery().list());
|
||||
public R<List<SysDictB>> list(@RequestBody SysDictB dto) {
|
||||
LambdaQueryChainWrapper<SysDictB> query = service.lambdaQuery();
|
||||
Long pid = dto.getPid();
|
||||
if (Objects.nonNull(pid)){
|
||||
query.eq(SysDictB::getPid, pid);
|
||||
}
|
||||
return R.ok(query.list());
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@Operation(summary = "分页 只查父项")
|
||||
@PostMapping("/page")
|
||||
public R<List<SysDictB>> page() {
|
||||
return R.ok(service.page(null,null));
|
||||
public R<Page<SysDictB>> page(@RequestBody GenericPageParams page) {
|
||||
|
||||
Page<SysDictB> data = service.page(page.getPageSo().toPage(), service.lambdaQuery().isNull(SysDictB::getPid));
|
||||
return R.ok(data);
|
||||
}
|
||||
|
||||
@Operation(summary = "树")
|
||||
@GetMapping("/tree")
|
||||
public R<List<SysDictB>> tree() {
|
||||
return R.ok(service.tree());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.gunshi.project.xyt.entity.so;
|
||||
|
||||
import com.gunshi.project.xyt.entity.page.GenericPageParams;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Created by XuSan on 2024/7/18.
|
||||
*
|
||||
* @author XuSan
|
||||
* @version 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class OsmoticDevicePage extends GenericPageParams {
|
||||
|
||||
/**
|
||||
* 测点编号
|
||||
*/
|
||||
@Schema(description="测点编号")
|
||||
private String stationCode;
|
||||
|
||||
/**
|
||||
* 仪器编号
|
||||
*/
|
||||
@Schema(description="仪器编号")
|
||||
private String deviceCode;
|
||||
|
||||
}
|
||||
|
|
@ -44,13 +44,6 @@ public class FileAssociations implements Serializable {
|
|||
@Schema(description="业务id")
|
||||
@NotBlank(message = "业务id不能为空")
|
||||
private String businessId;
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
@TableField(value="business_str_id")
|
||||
@Schema(description="业务id")
|
||||
@NotBlank(message = "业务id不能为空")
|
||||
private String businessStrId;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
|
|
@ -30,7 +32,7 @@ public class IaCBsnssinfo implements Serializable {
|
|||
/**
|
||||
* 单位编码
|
||||
*/
|
||||
@TableField(value="eicd")
|
||||
@TableId(value="eicd", type= IdType.AUTO)
|
||||
@Schema(description="单位编码")
|
||||
@Size(max = 50,message = "单位编码最大长度要小于 50")
|
||||
@NotBlank(message = "单位编码不能为空")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 渗流设备表
|
||||
|
|
@ -182,4 +183,7 @@ public class OsmoticFlowDevice implements Serializable {
|
|||
// @Size(max = 0,message = "纬度最大长度要小于 0")
|
||||
private String lttd;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "文件集合")
|
||||
private List<FileAssociations> files;
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 渗压设备表
|
||||
|
|
@ -190,4 +191,8 @@ public class OsmoticPressDevice implements Serializable {
|
|||
// @Size(max = 0,message = "纬度最大长度要小于 0")
|
||||
private String lttd;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "文件集合")
|
||||
private List<FileAssociations> files;
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 系统字典表
|
||||
|
|
@ -102,4 +103,8 @@ public class SysDictB implements Serializable {
|
|||
@NotBlank(message = "状态 1:启用 0:禁用不能为空")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description="子集")
|
||||
private List<SysDictB> children;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.FileAssociationsMapper;
|
||||
import com.gunshi.project.xyt.model.FileAssociations;
|
||||
|
|
@ -70,9 +71,9 @@ public class FileAssociationsService extends ServiceImpl<FileAssociationsMapper,
|
|||
if (CollectionUtils.isNotEmpty(files)) {
|
||||
|
||||
files.forEach(fileId -> {
|
||||
FileAssociations fileAssociations = new FileAssociations();
|
||||
fileAssociations.setTableName(tableName);
|
||||
fileAssociations.setBusinessId(businessId);
|
||||
fileId.setId(IdWorker.getId());
|
||||
fileId.setTableName(tableName);
|
||||
fileId.setBusinessId(businessId);
|
||||
});
|
||||
|
||||
if (!this.saveBatch(files)) {
|
||||
|
|
|
|||
|
|
@ -2,12 +2,15 @@ package com.gunshi.project.xyt.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.SysDictBMapper;
|
||||
import com.gunshi.project.xyt.model.CctvBMenu;
|
||||
import com.gunshi.project.xyt.model.SysDictB;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 描述: 系统字典表
|
||||
|
|
@ -20,6 +23,34 @@ import java.util.Date;
|
|||
public class SysDictBService extends ServiceImpl<SysDictBMapper, SysDictB>
|
||||
{
|
||||
|
||||
|
||||
public List<SysDictB> tree() {
|
||||
List<SysDictB> list = list(lambdaQuery().orderByDesc(SysDictB::getId));
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
return list;
|
||||
}
|
||||
Map<Long, List<SysDictB>> listMap = list.stream().collect(Collectors.groupingBy(SysDictB::getPid));
|
||||
|
||||
list.forEach(o -> o.setChildren(listMap.get(o.getId())));
|
||||
List<CctvBMenu> parentList = list.stream().filter(o -> Objects.isNull(o.getPid())).collect(Collectors.toList());
|
||||
return sorted(parentList);
|
||||
}
|
||||
|
||||
private List<SysDictB> sorted( List<SysDictB> tree) {
|
||||
|
||||
List<SysDictB> sorteds = null;
|
||||
|
||||
if (CollectionUtils.isNotEmpty(tree)){
|
||||
sorteds = tree.stream().sorted(Comparator.comparing(SysDictB::getSortOn)
|
||||
).collect(Collectors.toList());
|
||||
sorteds.forEach(o->{
|
||||
o.setChildren(sorted(o.getChildren()));
|
||||
});
|
||||
}
|
||||
|
||||
return sorteds;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue