页面布局配置功能接口
parent
3d8316a277
commit
69d73d1afc
@ -0,0 +1,110 @@
|
||||
package com.ruoyi.basic.controller;
|
||||
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.ruoyi.basic.domain.LayoutConfig;
|
||||
import com.ruoyi.basic.service.LayoutConfigService;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 布局配置表(LayoutConfig)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-26 16:38:10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("layoutConfig")
|
||||
public class LayoutConfigController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private LayoutConfigService layoutConfigService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param layoutConfig 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping
|
||||
public ResponseEntity<Page<LayoutConfig>> queryByPage(LayoutConfig layoutConfig, PageRequest pageRequest) {
|
||||
return ResponseEntity.ok(this.layoutConfigService.queryByPage(layoutConfig, pageRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseEntity<LayoutConfig> queryById(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(this.layoutConfigService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param layoutConfig 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<LayoutConfig> add(LayoutConfig layoutConfig) {
|
||||
return ResponseEntity.ok(this.layoutConfigService.insert(layoutConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param layoutConfig 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseEntity<LayoutConfig> edit(LayoutConfig layoutConfig) {
|
||||
return ResponseEntity.ok(this.layoutConfigService.update(layoutConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Boolean> deleteById(Long id) {
|
||||
return ResponseEntity.ok(this.layoutConfigService.deleteById(id));
|
||||
}
|
||||
// 添加组件新配置
|
||||
@PostMapping("/insertLayoutConfig")
|
||||
public AjaxResult insertLayoutConfig(@RequestBody Map<String,Object> config) throws JsonProcessingException {
|
||||
System.out.println(config.get("items"));
|
||||
List<Object> items = (List<Object>)config.get("items");
|
||||
String option = config.get("option").toString();
|
||||
return layoutConfigService.insertSceneConfig(items,option);
|
||||
|
||||
}
|
||||
// 查询所有场景
|
||||
@GetMapping("/selectAllScenes")
|
||||
public AjaxResult selectAllScenes(){
|
||||
return layoutConfigService.selectAllScenes();
|
||||
}
|
||||
|
||||
// 根据场景id查询
|
||||
@GetMapping("selectConfigById")
|
||||
public AjaxResult selectConfigById(String sceneId){
|
||||
return layoutConfigService.selectConfigById(sceneId);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.ruoyi.basic.controller;
|
||||
|
||||
|
||||
import com.ruoyi.basic.domain.LayoutDesc;
|
||||
import com.ruoyi.basic.service.LayoutDescService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 布局详情表(LayoutDesc)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-26 16:47:45
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("layoutDesc")
|
||||
public class LayoutDescController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private LayoutDescService layoutDescService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param layoutDesc 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping
|
||||
public ResponseEntity<Page<LayoutDesc>> queryByPage(LayoutDesc layoutDesc, PageRequest pageRequest) {
|
||||
return ResponseEntity.ok(this.layoutDescService.queryByPage(layoutDesc, pageRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseEntity<LayoutDesc> queryById(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(this.layoutDescService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param layoutDesc 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<LayoutDesc> add(LayoutDesc layoutDesc) {
|
||||
return ResponseEntity.ok(this.layoutDescService.insert(layoutDesc));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param layoutDesc 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseEntity<LayoutDesc> edit(LayoutDesc layoutDesc) {
|
||||
return ResponseEntity.ok(this.layoutDescService.update(layoutDesc));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Boolean> deleteById(Long id) {
|
||||
return ResponseEntity.ok(this.layoutDescService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package com.ruoyi.basic.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 布局配置表(LayoutConfig)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-26 16:38:23
|
||||
*/
|
||||
@Data
|
||||
public class LayoutConfig implements Serializable {
|
||||
private static final long serialVersionUID = 540707408890304966L;
|
||||
/**
|
||||
* 配置id
|
||||
*/
|
||||
private Long configId;
|
||||
/**
|
||||
* 布局id
|
||||
*/
|
||||
private String layoutId;
|
||||
/**
|
||||
* 组件类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 布局描述
|
||||
*/
|
||||
private String configDesc;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
private String sceneConfig;
|
||||
private String value2;
|
||||
private String value3;
|
||||
private String value4;
|
||||
|
||||
|
||||
// public Long getConfigId() {
|
||||
// return configId;
|
||||
// }
|
||||
//
|
||||
// public void setConfigId(Long configId) {
|
||||
// this.configId = configId;
|
||||
// }
|
||||
//
|
||||
// public String getLayoutId() {
|
||||
// return layoutId;
|
||||
// }
|
||||
//
|
||||
// public void setLayoutId(String layoutId) {
|
||||
// this.layoutId = layoutId;
|
||||
// }
|
||||
//
|
||||
// public String getType() {
|
||||
// return type;
|
||||
// }
|
||||
//
|
||||
// public void setType(String type) {
|
||||
// this.type = type;
|
||||
// }
|
||||
//
|
||||
// public String getConfigDesc() {
|
||||
// return configDesc;
|
||||
// }
|
||||
//
|
||||
// public void setConfigDesc(String configDesc) {
|
||||
// this.configDesc = configDesc;
|
||||
// }
|
||||
//
|
||||
// public String getCreateBy() {
|
||||
// return createBy;
|
||||
// }
|
||||
//
|
||||
// public void setCreateBy(String createBy) {
|
||||
// this.createBy = createBy;
|
||||
// }
|
||||
//
|
||||
// public Date getCreateTime() {
|
||||
// return createTime;
|
||||
// }
|
||||
//
|
||||
// public void setCreateTime(Date createTime) {
|
||||
// this.createTime = createTime;
|
||||
// }
|
||||
//
|
||||
// public String getUpdateBy() {
|
||||
// return updateBy;
|
||||
// }
|
||||
//
|
||||
// public void setUpdateBy(String updateBy) {
|
||||
// this.updateBy = updateBy;
|
||||
// }
|
||||
//
|
||||
// public Date getUpdateTime() {
|
||||
// return updateTime;
|
||||
// }
|
||||
//
|
||||
// public void setUpdateTime(Date updateTime) {
|
||||
// this.updateTime = updateTime;
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.ruoyi.basic.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 布局配置表(LayoutConfig)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-26 16:38:23
|
||||
*/
|
||||
@Data
|
||||
public class LayoutDesc implements Serializable {
|
||||
private static final long serialVersionUID = 540707408890304966L;
|
||||
|
||||
/**
|
||||
* 布局id
|
||||
*/
|
||||
private String layoutId;
|
||||
/**
|
||||
* 布局描述
|
||||
*/
|
||||
private String layoutDesc;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
private String sceneConfig;
|
||||
private String value2;
|
||||
private String value3;
|
||||
private String value4;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// public String getLayoutId() {
|
||||
// return layoutId;
|
||||
// }
|
||||
//
|
||||
// public void setLayoutId(String layoutId) {
|
||||
// this.layoutId = layoutId;
|
||||
// }
|
||||
// public String getSceneConfig() {
|
||||
// return sceneConfig;
|
||||
// }
|
||||
//
|
||||
// public void setSceneConfig(String sceneConfig) {
|
||||
// this.sceneConfig = sceneConfig;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// public String getLayoutDesc() {
|
||||
// return layoutDesc;
|
||||
// }
|
||||
//
|
||||
// public void setLayoutDesc(String layoutDesc) {
|
||||
// this.layoutDesc = layoutDesc;
|
||||
// }
|
||||
//
|
||||
// public String getCreateBy() {
|
||||
// return createBy;
|
||||
// }
|
||||
//
|
||||
// public void setCreateBy(String createBy) {
|
||||
// this.createBy = createBy;
|
||||
// }
|
||||
//
|
||||
// public Date getCreateTime() {
|
||||
// return createTime;
|
||||
// }
|
||||
//
|
||||
// public void setCreateTime(Date createTime) {
|
||||
// this.createTime = createTime;
|
||||
// }
|
||||
//
|
||||
// public String getUpdateBy() {
|
||||
// return updateBy;
|
||||
// }
|
||||
//
|
||||
// public void setUpdateBy(String updateBy) {
|
||||
// this.updateBy = updateBy;
|
||||
// }
|
||||
//
|
||||
// public Date getUpdateTime() {
|
||||
// return updateTime;
|
||||
// }
|
||||
//
|
||||
// public void setUpdateTime(Date updateTime) {
|
||||
// this.updateTime = updateTime;
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.ruoyi.basic.mapper;
|
||||
|
||||
|
||||
import com.ruoyi.basic.domain.LayoutDesc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 布局配置表(LayoutConfig)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-26 16:38:12
|
||||
*/
|
||||
public interface LayoutDescDao {
|
||||
|
||||
|
||||
int insert(LayoutDesc layoutDesc);
|
||||
|
||||
List<LayoutDesc> selectAllScenes();
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.ruoyi.basic.service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.ruoyi.basic.domain.LayoutConfig;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 布局配置表(LayoutConfig)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-26 16:38:28
|
||||
*/
|
||||
public interface LayoutConfigService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param configId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
LayoutConfig queryById(Long configId);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param layoutConfig 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
Page<LayoutConfig> queryByPage(LayoutConfig layoutConfig, PageRequest pageRequest);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param layoutConfig 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
LayoutConfig insert(LayoutConfig layoutConfig);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param layoutConfig 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
LayoutConfig update(LayoutConfig layoutConfig);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param configId 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Long configId);
|
||||
|
||||
AjaxResult insertSceneConfig(List<Object> items, String option) throws JsonProcessingException;
|
||||
|
||||
AjaxResult selectConfigById(String sceneId);
|
||||
|
||||
AjaxResult selectAllScenes();
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.ruoyi.basic.service;
|
||||
|
||||
|
||||
import com.ruoyi.basic.domain.LayoutDesc;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
/**
|
||||
* 布局详情表(LayoutDesc)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-26 16:47:47
|
||||
*/
|
||||
public interface LayoutDescService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param layoutId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
LayoutDesc queryById(Long layoutId);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param layoutDesc 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
Page<LayoutDesc> queryByPage(LayoutDesc layoutDesc, PageRequest pageRequest);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param layoutDesc 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
LayoutDesc insert(LayoutDesc layoutDesc);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param layoutDesc 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
LayoutDesc update(LayoutDesc layoutDesc);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param layoutId 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Long layoutId);
|
||||
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
package com.ruoyi.basic.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.basic.domain.LayoutConfig;
|
||||
|
||||
import com.ruoyi.basic.domain.LayoutDesc;
|
||||
import com.ruoyi.basic.mapper.LayoutConfigDao;
|
||||
import com.ruoyi.basic.mapper.LayoutDescDao;
|
||||
import com.ruoyi.basic.service.LayoutConfigService;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.system.api.model.LoginUser;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 布局配置表(LayoutConfig)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-26 16:38:47
|
||||
*/
|
||||
@Service("layoutConfigService")
|
||||
public class LayoutConfigServiceImpl implements LayoutConfigService {
|
||||
@Resource
|
||||
private LayoutConfigDao layoutConfigDao;
|
||||
@Resource
|
||||
private LayoutDescDao layoutDescDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param configId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public LayoutConfig queryById(Long configId) {
|
||||
return this.layoutConfigDao.queryById(configId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param layoutConfig 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public Page<LayoutConfig> queryByPage(LayoutConfig layoutConfig, PageRequest pageRequest) {
|
||||
long total = this.layoutConfigDao.count(layoutConfig);
|
||||
return new PageImpl<>(this.layoutConfigDao.queryAllByLimit(layoutConfig, pageRequest), pageRequest, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param layoutConfig 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public LayoutConfig insert(LayoutConfig layoutConfig) {
|
||||
this.layoutConfigDao.insert(layoutConfig);
|
||||
return layoutConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param layoutConfig 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public LayoutConfig update(LayoutConfig layoutConfig) {
|
||||
this.layoutConfigDao.update(layoutConfig);
|
||||
return this.queryById(layoutConfig.getConfigId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param configId 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Long configId) {
|
||||
return this.layoutConfigDao.deleteById(configId) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult insertSceneConfig(List<Object> items, String option) throws JsonProcessingException {
|
||||
String layoutId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
LayoutDesc layoutDesc = new LayoutDesc();
|
||||
layoutDesc.setLayoutId(layoutId);
|
||||
layoutDesc.setSceneConfig(option);
|
||||
// layoutDesc.setCreateBy(loginUser.getUsername());
|
||||
Date date = new Date();
|
||||
layoutDesc.setCreateTime(date);
|
||||
List<LayoutConfig> layoutConfigs = new ArrayList<>();
|
||||
for (Object item : items) {
|
||||
LayoutConfig layoutConfig = new LayoutConfig();
|
||||
layoutConfig.setLayoutId(layoutId);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String itemString = objectMapper.writeValueAsString(item);
|
||||
JsonNode jsonNode = objectMapper.readTree(itemString);
|
||||
String type = jsonNode.get("type").asText();
|
||||
layoutConfig.setType(type);
|
||||
layoutConfig.setConfigDesc(itemString);
|
||||
// layoutConfig.setCreateBy(loginUser.getUsername());
|
||||
layoutConfig.setCreateTime(date);
|
||||
layoutConfigs.add(layoutConfig);
|
||||
}
|
||||
int descCount = layoutDescDao.insert(layoutDesc);
|
||||
int configCount = layoutConfigDao.insertBatch(layoutConfigs);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectConfigById(String sceneId) {
|
||||
List<LayoutConfig> layoutConfigs = layoutConfigDao.selectConfigById(sceneId);
|
||||
return AjaxResult.success(layoutConfigs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectAllScenes() {
|
||||
List<LayoutDesc> layoutDescs = layoutDescDao.selectAllScenes();
|
||||
return AjaxResult.success(layoutDescs);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.ruoyi.basic.service.impl;
|
||||
|
||||
|
||||
|
||||
import com.ruoyi.basic.domain.LayoutDesc;
|
||||
import com.ruoyi.basic.mapper.LayoutDescDao;
|
||||
import com.ruoyi.basic.service.LayoutDescService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 布局详情表(LayoutDesc)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-26 16:47:47
|
||||
*/
|
||||
@Service("layoutDescService")
|
||||
public class LayoutDescServiceImpl implements LayoutDescService {
|
||||
@Autowired
|
||||
private LayoutDescDao layoutDescDao;
|
||||
|
||||
|
||||
@Override
|
||||
public LayoutDesc queryById(Long layoutId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<LayoutDesc> queryByPage(LayoutDesc layoutDesc, PageRequest pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LayoutDesc insert(LayoutDesc layoutDesc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LayoutDesc update(LayoutDesc layoutDesc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(Long layoutId) {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.basic.mapper.LayoutConfigDao">
|
||||
|
||||
<resultMap type="com.ruoyi.basic.domain.LayoutConfig" id="LayoutConfigMap">
|
||||
<result property="configId" column="config_id" jdbcType="INTEGER"/>
|
||||
<result property="layoutId" column="layout_id" jdbcType="INTEGER"/>
|
||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||
<result property="configDesc" column="layout_desc" jdbcType="VARCHAR"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="LayoutConfigMap">
|
||||
select
|
||||
config_id, layout_id, type, layout_desc, create_by, create_time, update_by, update_time
|
||||
from layout_config
|
||||
where config_id = #{configId}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="LayoutConfigMap">
|
||||
select
|
||||
config_id, layout_id, type, layout_desc, create_by, create_time, update_by, update_time
|
||||
from layout_config
|
||||
<where>
|
||||
<if test="configId != null">
|
||||
and config_id = #{configId}
|
||||
</if>
|
||||
<if test="layoutId != null">
|
||||
and layout_id = #{layoutId}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="layoutDesc != null and layoutDesc != ''">
|
||||
and layout_desc = #{layoutDesc}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from layout_config
|
||||
<where>
|
||||
<if test="configId != null">
|
||||
and config_id = #{configId}
|
||||
</if>
|
||||
<if test="layoutId != null">
|
||||
and layout_id = #{layoutId}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="layoutDesc != null and layoutDesc != ''">
|
||||
and layout_desc = #{layoutDesc}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectConfigById" resultType="com.ruoyi.basic.domain.LayoutConfig"
|
||||
parameterType="java.lang.String">
|
||||
SELECT a.*,b.scene_config sceneConfig FROM layout_config a left join layout_desc b on a.layout_id = b.layout_id
|
||||
where a.layout_id = #{sceneId}
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="configId" useGeneratedKeys="true">
|
||||
insert into layout_config(layout_id, type, config_desc, create_by, create_time, update_by, update_time)
|
||||
values (#{layoutId}, #{type},#{configDesc}, #{layoutDesc}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="configId" useGeneratedKeys="true">
|
||||
insert into layout_config(layout_id, type, config_desc, create_by, create_time, update_by, update_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.layoutId}, #{entity.type}, #{entity.configDesc}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="configId" useGeneratedKeys="true">
|
||||
insert into layout_config(layout_id, type, layout_desc, create_by, create_time, update_by, update_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.layoutId}, #{entity.type}, #{entity.layoutDesc}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
layout_id = values(layout_id),
|
||||
type = values(type),
|
||||
layout_desc = values(layout_desc),
|
||||
create_by = values(create_by),
|
||||
create_time = values(create_time),
|
||||
update_by = values(update_by),
|
||||
update_time = values(update_time)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update layout_config
|
||||
<set>
|
||||
<if test="layoutId != null">
|
||||
layout_id = #{layoutId},
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
type = #{type},
|
||||
</if>
|
||||
<if test="layoutDesc != null and layoutDesc != ''">
|
||||
layout_desc = #{layoutDesc},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
where config_id = #{configId}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from layout_config where config_id = #{configId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.basic.mapper.LayoutDescDao">
|
||||
|
||||
<resultMap type="com.ruoyi.basic.domain.LayoutDesc" id="LayoutDescMap">
|
||||
<result property="layoutId" column="layout_id" jdbcType="INTEGER"/>
|
||||
<result property="layoutDesc" column="layout_desc" jdbcType="VARCHAR"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="sceneConfig" column="scene_config" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="LayoutDescMap">
|
||||
select
|
||||
layout_id, layout_desc, create_by, create_time, update_by, update_time
|
||||
from layout_desc
|
||||
where layout_id = #{layoutId}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="LayoutDescMap">
|
||||
select
|
||||
layout_id, layout_desc, create_by, create_time, update_by, update_time
|
||||
from layout_desc
|
||||
<where>
|
||||
<if test="layoutId != null">
|
||||
and layout_id = #{layoutId}
|
||||
</if>
|
||||
<if test="layoutDesc != null and layoutDesc != ''">
|
||||
and layout_desc = #{layoutDesc}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from layout_desc
|
||||
<where>
|
||||
<if test="layoutId != null">
|
||||
and layout_id = #{layoutId}
|
||||
</if>
|
||||
<if test="layoutDesc != null and layoutDesc != ''">
|
||||
and layout_desc = #{layoutDesc}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectAllScenes" resultType="com.ruoyi.basic.domain.LayoutDesc">
|
||||
select * from layout_desc
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="layoutId" useGeneratedKeys="true">
|
||||
insert into layout_desc(layout_id,layout_desc, create_by, create_time, update_by, update_time,scene_config)
|
||||
values (#{layoutId},#{layoutDesc}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime},#{sceneConfig})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="layoutId" useGeneratedKeys="true">
|
||||
insert into layout_desc(layout_desc, create_by, create_time, update_by, update_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.layoutDesc}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="layoutId" useGeneratedKeys="true">
|
||||
insert into layout_desc(layout_desc, create_by, create_time, update_by, update_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.layoutDesc}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
layout_desc = values(layout_desc),
|
||||
create_by = values(create_by),
|
||||
create_time = values(create_time),
|
||||
update_by = values(update_by),
|
||||
update_time = values(update_time)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update layout_desc
|
||||
<set>
|
||||
<if test="layoutDesc != null and layoutDesc != ''">
|
||||
layout_desc = #{layoutDesc},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
where layout_id = #{layoutId}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from layout_desc where layout_id = #{layoutId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue