页面布局配置功能接口

master
马雪伟 3 months ago
parent 6f12728a60
commit f35d45a3a1

@ -0,0 +1,111 @@
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,85 @@
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,120 @@
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,108 @@
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,88 @@
package com.ruoyi.basic.mapper;
import com.ruoyi.basic.domain.LayoutConfig;
import com.ruoyi.basic.domain.LayoutDesc;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* (LayoutConfig)访
*
* @author makejava
* @since 2024-08-26 16:38:12
*/
public interface LayoutConfigDao {
/**
* ID
*
* @param configId
* @return
*/
LayoutConfig queryById(Long configId);
/**
*
*
* @param layoutConfig
* @param pageable
* @return
*/
List<LayoutConfig> queryAllByLimit(LayoutConfig layoutConfig, @Param("pageable") Pageable pageable);
/**
*
*
* @param layoutConfig
* @return
*/
long count(LayoutConfig layoutConfig);
/**
*
*
* @param layoutConfig
* @return
*/
int insert(LayoutConfig layoutConfig);
/**
* MyBatisforeach
*
* @param entities List<LayoutConfig>
* @return
*/
int insertBatch(@Param("entities") List<LayoutConfig> entities);
/**
* MyBatisforeach
*
* @param entities List<LayoutConfig>
* @return
* @throws org.springframework.jdbc.BadSqlGrammarException ListSQL
*/
int insertOrUpdateBatch(@Param("entities") List<LayoutConfig> entities);
/**
*
*
* @param layoutConfig
* @return
*/
int update(LayoutConfig layoutConfig);
/**
*
*
* @param configId
* @return
*/
int deleteById(Long configId);
List<LayoutConfig> selectConfigById(String sceneId);
List<LayoutDesc> selectAllScenes();
}

@ -0,0 +1,22 @@
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,161 @@
<?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,137 @@
<?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…
Cancel
Save