| @@ -0,0 +1,90 @@ | |||
| package com.ruoyi.platform.controller.devEnvironment; | |||
| import com.ruoyi.common.core.web.controller.BaseController; | |||
| import com.ruoyi.common.core.web.domain.GenericsAjaxResult; | |||
| import com.ruoyi.platform.domain.DevEnvironment; | |||
| import com.ruoyi.platform.service.DevEnvironmentService; | |||
| import io.swagger.annotations.Api; | |||
| 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; | |||
| /** | |||
| * (DevEnvironment)表控制层 | |||
| * | |||
| * @author Xidaray | |||
| * @since 2024-06-03 15:17:37 | |||
| */ | |||
| @RestController | |||
| @RequestMapping("devEnvironment") | |||
| @Api("开发环境管理") | |||
| public class DevEnvironmentController extends BaseController { | |||
| /** | |||
| * 服务对象 | |||
| */ | |||
| @Resource | |||
| private DevEnvironmentService devEnvironmentService; | |||
| /** | |||
| * 分页查询 | |||
| * | |||
| * @param devEnvironment 筛选条件 | |||
| * @param page 页数 | |||
| * @param size 每页大小 | |||
| * @return 查询结果 | |||
| */ | |||
| @GetMapping | |||
| public GenericsAjaxResult<Page<DevEnvironment>> queryByPage(DevEnvironment devEnvironment, int page, int size) { | |||
| PageRequest pageRequest = PageRequest.of(page,size); | |||
| return genericsSuccess(this.devEnvironmentService.queryByPage(devEnvironment, pageRequest)); | |||
| } | |||
| /** | |||
| * 通过主键查询单条数据 | |||
| * | |||
| * @param id 主键 | |||
| * @return 单条数据 | |||
| */ | |||
| @GetMapping("{id}") | |||
| public ResponseEntity<DevEnvironment> queryById(@PathVariable("id") Integer id) { | |||
| return ResponseEntity.ok(this.devEnvironmentService.queryById(id)); | |||
| } | |||
| /** | |||
| * 新增数据 | |||
| * | |||
| * @param devEnvironment 实体 | |||
| * @return 新增结果 | |||
| */ | |||
| @PostMapping | |||
| public ResponseEntity<DevEnvironment> add(DevEnvironment devEnvironment) { | |||
| return ResponseEntity.ok(this.devEnvironmentService.insert(devEnvironment)); | |||
| } | |||
| /** | |||
| * 编辑数据 | |||
| * | |||
| * @param devEnvironment 实体 | |||
| * @return 编辑结果 | |||
| */ | |||
| @PutMapping | |||
| public ResponseEntity<DevEnvironment> edit(DevEnvironment devEnvironment) { | |||
| return ResponseEntity.ok(this.devEnvironmentService.update(devEnvironment)); | |||
| } | |||
| /** | |||
| * 删除数据 | |||
| * | |||
| * @param id 主键 | |||
| * @return 删除是否成功 | |||
| */ | |||
| @DeleteMapping("{id}") | |||
| public ResponseEntity<Boolean> deleteById(@PathVariable("id") Integer id) { | |||
| return ResponseEntity.ok(this.devEnvironmentService.deleteById(id)); | |||
| } | |||
| } | |||
| @@ -0,0 +1,213 @@ | |||
| package com.ruoyi.platform.domain; | |||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||
| import java.util.Date; | |||
| import java.io.Serializable; | |||
| /** | |||
| * (DevEnvironment)实体类 | |||
| * | |||
| * @author Xidaray | |||
| * @since 2024-06-03 15:17:37 | |||
| */ | |||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||
| public class DevEnvironment implements Serializable { | |||
| private static final long serialVersionUID = 936999018935545992L; | |||
| /** | |||
| * 主键 | |||
| */ | |||
| private Integer id; | |||
| /** | |||
| * 编辑器名称 | |||
| */ | |||
| private String name; | |||
| /** | |||
| * 状态 | |||
| */ | |||
| private String status; | |||
| /** | |||
| * 计算资源 | |||
| */ | |||
| private String computingResource; | |||
| /** | |||
| * 资源规格 | |||
| */ | |||
| private String standard; | |||
| /** | |||
| * 环境变量 | |||
| */ | |||
| private String envVariable; | |||
| /** | |||
| * 所用镜像 | |||
| */ | |||
| private String image; | |||
| /** | |||
| * 对应数据集 | |||
| */ | |||
| private String dataset; | |||
| /** | |||
| * 对应模型 | |||
| */ | |||
| private String model; | |||
| /** | |||
| * 备用字段1 | |||
| */ | |||
| private String altField1; | |||
| /** | |||
| * 备用字段2 | |||
| */ | |||
| private String altField2; | |||
| /** | |||
| * 创建者 | |||
| */ | |||
| private String createBy; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| private Date createTime; | |||
| /** | |||
| * 更新者 | |||
| */ | |||
| private String updateBy; | |||
| /** | |||
| * 更新时间 | |||
| */ | |||
| private Date updateTime; | |||
| /** | |||
| * 状态,0失效1生效 | |||
| */ | |||
| private Integer state; | |||
| public Integer getId() { | |||
| return id; | |||
| } | |||
| public void setId(Integer id) { | |||
| this.id = id; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getStatus() { | |||
| return status; | |||
| } | |||
| public void setStatus(String status) { | |||
| this.status = status; | |||
| } | |||
| public String getComputingResource() { | |||
| return computingResource; | |||
| } | |||
| public void setComputingResource(String computingResource) { | |||
| this.computingResource = computingResource; | |||
| } | |||
| public String getStandard() { | |||
| return standard; | |||
| } | |||
| public void setStandard(String standard) { | |||
| this.standard = standard; | |||
| } | |||
| public String getEnvVariable() { | |||
| return envVariable; | |||
| } | |||
| public void setEnvVariable(String envVariable) { | |||
| this.envVariable = envVariable; | |||
| } | |||
| public String getImage() { | |||
| return image; | |||
| } | |||
| public void setImage(String image) { | |||
| this.image = image; | |||
| } | |||
| public String getDataset() { | |||
| return dataset; | |||
| } | |||
| public void setDataset(String dataset) { | |||
| this.dataset = dataset; | |||
| } | |||
| public String getModel() { | |||
| return model; | |||
| } | |||
| public void setModel(String model) { | |||
| this.model = model; | |||
| } | |||
| public String getAltField1() { | |||
| return altField1; | |||
| } | |||
| public void setAltField1(String altField1) { | |||
| this.altField1 = altField1; | |||
| } | |||
| public String getAltField2() { | |||
| return altField2; | |||
| } | |||
| public void setAltField2(String altField2) { | |||
| this.altField2 = altField2; | |||
| } | |||
| 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; | |||
| } | |||
| public Integer getState() { | |||
| return state; | |||
| } | |||
| public void setState(Integer state) { | |||
| this.state = state; | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| package com.ruoyi.platform.mapper; | |||
| import com.ruoyi.platform.domain.DevEnvironment; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.springframework.data.domain.Pageable; | |||
| import java.util.List; | |||
| /** | |||
| * (DevEnvironment)表数据库访问层 | |||
| * | |||
| * @author Xidaray | |||
| * @since 2024-06-03 15:17:37 | |||
| */ | |||
| public interface DevEnvironmentDao { | |||
| /** | |||
| * 通过ID查询单条数据 | |||
| * | |||
| * @param id 主键 | |||
| * @return 实例对象 | |||
| */ | |||
| DevEnvironment queryById(Integer id); | |||
| /** | |||
| * 查询指定行数据 | |||
| * | |||
| * @param devEnvironment 查询条件 | |||
| * @param pageable 分页对象 | |||
| * @return 对象列表 | |||
| */ | |||
| List<DevEnvironment> queryAllByLimit(@Param("devEnvironment") DevEnvironment devEnvironment, @Param("pageable") Pageable pageable); | |||
| /** | |||
| * 统计总行数 | |||
| * | |||
| * @param devEnvironment 查询条件 | |||
| * @return 总行数 | |||
| */ | |||
| long count(@Param("devEnvironment") DevEnvironment devEnvironment); | |||
| /** | |||
| * 新增数据 | |||
| * | |||
| * @param devEnvironment 实例对象 | |||
| * @return 影响行数 | |||
| */ | |||
| int insert(@Param("devEnvironment") DevEnvironment devEnvironment); | |||
| /** | |||
| * 批量新增数据(MyBatis原生foreach方法) | |||
| * | |||
| * @param entities List<DevEnvironment> 实例对象列表 | |||
| * @return 影响行数 | |||
| */ | |||
| int insertBatch(@Param("entities") List<DevEnvironment> entities); | |||
| /** | |||
| * 批量新增或按主键更新数据(MyBatis原生foreach方法) | |||
| * | |||
| * @param entities List<DevEnvironment> 实例对象列表 | |||
| * @return 影响行数 | |||
| * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 | |||
| */ | |||
| int insertOrUpdateBatch(@Param("entities") List<DevEnvironment> entities); | |||
| /** | |||
| * 修改数据 | |||
| * | |||
| * @param devEnvironment 实例对象 | |||
| * @return 影响行数 | |||
| */ | |||
| int update(@Param("devEnvironment") DevEnvironment devEnvironment); | |||
| /** | |||
| * 通过主键删除数据 | |||
| * | |||
| * @param id 主键 | |||
| * @return 影响行数 | |||
| */ | |||
| int deleteById(Integer id); | |||
| } | |||
| @@ -0,0 +1,57 @@ | |||
| package com.ruoyi.platform.service; | |||
| import com.ruoyi.platform.domain.DevEnvironment; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageRequest; | |||
| /** | |||
| * (DevEnvironment)表服务接口 | |||
| * | |||
| * @author Xidaray | |||
| * @since 2024-06-03 15:17:37 | |||
| */ | |||
| public interface DevEnvironmentService { | |||
| /** | |||
| * 通过ID查询单条数据 | |||
| * | |||
| * @param id 主键 | |||
| * @return 实例对象 | |||
| */ | |||
| DevEnvironment queryById(Integer id); | |||
| /** | |||
| * 分页查询 | |||
| * | |||
| * @param devEnvironment 筛选条件 | |||
| * @param pageRequest 分页对象 | |||
| * @return 查询结果 | |||
| */ | |||
| Page<DevEnvironment> queryByPage(DevEnvironment devEnvironment, PageRequest pageRequest); | |||
| /** | |||
| * 新增数据 | |||
| * | |||
| * @param devEnvironment 实例对象 | |||
| * @return 实例对象 | |||
| */ | |||
| DevEnvironment insert(DevEnvironment devEnvironment); | |||
| /** | |||
| * 修改数据 | |||
| * | |||
| * @param devEnvironment 实例对象 | |||
| * @return 实例对象 | |||
| */ | |||
| DevEnvironment update(DevEnvironment devEnvironment); | |||
| /** | |||
| * 通过主键删除数据 | |||
| * | |||
| * @param id 主键 | |||
| * @return 是否成功 | |||
| */ | |||
| boolean deleteById(Integer id); | |||
| String removeById(Integer id); | |||
| } | |||
| @@ -0,0 +1,114 @@ | |||
| package com.ruoyi.platform.service.impl; | |||
| import com.ruoyi.common.security.utils.SecurityUtils; | |||
| import com.ruoyi.platform.domain.DevEnvironment; | |||
| import com.ruoyi.platform.mapper.DevEnvironmentDao; | |||
| import com.ruoyi.platform.service.DevEnvironmentService; | |||
| import com.ruoyi.system.api.model.LoginUser; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| 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; | |||
| import java.util.Date; | |||
| /** | |||
| * (DevEnvironment)表服务实现类 | |||
| * | |||
| * @author Xidaray | |||
| * @since 2024-06-03 15:17:37 | |||
| */ | |||
| @Service("devEnvironmentService") | |||
| public class DevEnvironmentServiceImpl implements DevEnvironmentService { | |||
| @Resource | |||
| private DevEnvironmentDao devEnvironmentDao; | |||
| /** | |||
| * 通过ID查询单条数据 | |||
| * | |||
| * @param id 主键 | |||
| * @return 实例对象 | |||
| */ | |||
| @Override | |||
| public DevEnvironment queryById(Integer id) { | |||
| return this.devEnvironmentDao.queryById(id); | |||
| } | |||
| /** | |||
| * 分页查询 | |||
| * | |||
| * @param devEnvironment 筛选条件 | |||
| * @param pageRequest 分页对象 | |||
| * @return 查询结果 | |||
| */ | |||
| @Override | |||
| public Page<DevEnvironment> queryByPage(DevEnvironment devEnvironment, PageRequest pageRequest) { | |||
| long total = this.devEnvironmentDao.count(devEnvironment); | |||
| return new PageImpl<>(this.devEnvironmentDao.queryAllByLimit(devEnvironment, pageRequest), pageRequest, total); | |||
| } | |||
| /** | |||
| * 新增数据 | |||
| * | |||
| * @param devEnvironment 实例对象 | |||
| * @return 实例对象 | |||
| */ | |||
| @Override | |||
| public DevEnvironment insert(DevEnvironment devEnvironment) { | |||
| //插入预备,此时不需要判断版本重复 | |||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||
| devEnvironment.setCreateBy(loginUser.getUsername()); | |||
| devEnvironment.setUpdateBy(loginUser.getUsername()); | |||
| devEnvironment.setUpdateTime(new Date()); | |||
| devEnvironment.setCreateTime(new Date()); | |||
| this.devEnvironmentDao.insert(devEnvironment); | |||
| return devEnvironment; | |||
| } | |||
| /** | |||
| * 修改数据 | |||
| * | |||
| * @param devEnvironment 实例对象 | |||
| * @return 实例对象 | |||
| */ | |||
| @Override | |||
| public DevEnvironment update(DevEnvironment devEnvironment) { | |||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||
| devEnvironment.setUpdateBy(loginUser.getUsername()); | |||
| devEnvironment.setUpdateTime(new Date()); | |||
| this.devEnvironmentDao.update(devEnvironment); | |||
| return this.queryById(devEnvironment.getId()); | |||
| } | |||
| /** | |||
| * 通过主键删除数据 | |||
| * | |||
| * @param id 主键 | |||
| * @return 是否成功 | |||
| */ | |||
| @Override | |||
| public boolean deleteById(Integer id) { | |||
| return this.devEnvironmentDao.deleteById(id) > 0; | |||
| } | |||
| @Override | |||
| public String removeById(Integer id) { | |||
| DevEnvironment devEnvironment = this.devEnvironmentDao.queryById(id); | |||
| if (devEnvironment == null){ | |||
| return "开发环境信息不存在"; | |||
| } | |||
| //判断权限,只有admin和创建者本身可以删除该数据集 | |||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | |||
| String username = loginUser.getUsername(); | |||
| String createdBy = devEnvironment.getCreateBy(); | |||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | |||
| return "无权限删除该开发环境"; | |||
| } | |||
| devEnvironment.setState(0); | |||
| return this.devEnvironmentDao.update(devEnvironment)>0?"删除成功":"删除失败"; | |||
| } | |||
| } | |||
| @@ -71,7 +71,7 @@ public class ModelDependencyServiceImpl implements ModelDependencyService { | |||
| public ModelDependcyTreeVo getModelDependencyTree(ModelDependency modelDependencyQuery) throws Exception { | |||
| //查询当前模型 | |||
| List<ModelDependency> modelDependencyList = modelDependencyDao.queryByModelDependency(modelDependencyQuery); | |||
| if (modelDependencyList==null||modelDependencyList.size()==0){ | |||
| if (modelDependencyList==null || modelDependencyList.size()==0){ | |||
| throw new Exception("当前模型依赖关系不存在"); | |||
| } | |||
| ModelDependency modelDependency = modelDependencyList.get(0); | |||
| @@ -128,6 +128,7 @@ public class ModelDependencyServiceImpl implements ModelDependencyService { | |||
| } | |||
| modelDependcyTreeVo.setChildrenModels(cs); | |||
| } | |||
| private ModelDependcyTreeVo ModelDependencyConvertToTree(ModelDependency modelDependency){ | |||
| ModelDependcyTreeVo modelDependcyTreeVo = new ModelDependcyTreeVo(); | |||
| modelDependcyTreeVo.setCurrentModelId(modelDependency.getCurrentModelId()); | |||
| @@ -0,0 +1,231 @@ | |||
| <?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.platform.mapper.DevEnvironmentDao"> | |||
| <resultMap type="com.ruoyi.platform.domain.DevEnvironment" id="DevEnvironmentMap"> | |||
| <result property="id" column="id" jdbcType="INTEGER"/> | |||
| <result property="name" column="name" jdbcType="VARCHAR"/> | |||
| <result property="status" column="status" jdbcType="VARCHAR"/> | |||
| <result property="computingResource" column="computing_resource" jdbcType="VARCHAR"/> | |||
| <result property="standard" column="standard" jdbcType="VARCHAR"/> | |||
| <result property="envVariable" column="env_variable" jdbcType="VARCHAR"/> | |||
| <result property="image" column="image" jdbcType="VARCHAR"/> | |||
| <result property="dataset" column="dataset" jdbcType="VARCHAR"/> | |||
| <result property="model" column="model" jdbcType="VARCHAR"/> | |||
| <result property="altField1" column="alt_field1" jdbcType="VARCHAR"/> | |||
| <result property="altField2" column="alt_field2" 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="state" column="state" jdbcType="INTEGER"/> | |||
| </resultMap> | |||
| <!--查询单个--> | |||
| <select id="queryById" resultMap="DevEnvironmentMap"> | |||
| select | |||
| id,name,status,computing_resource,standard,env_variable,image,dataset,model,alt_field1,alt_field2,create_by,create_time,update_by,update_time,state | |||
| from dev_environment | |||
| where id = #{id} | |||
| </select> | |||
| <!--查询指定行数据--> | |||
| <select id="queryAllByLimit" resultMap="DevEnvironmentMap"> | |||
| select | |||
| id,name,status,computing_resource,standard,env_variable,image,dataset,model,alt_field1,alt_field2,create_by,create_time,update_by,update_time,state | |||
| from dev_environment | |||
| <where> | |||
| <if test="devEnvironment.id != null"> | |||
| and id = #{devEnvironment.id} | |||
| </if> | |||
| <if test="devEnvironment.name != null and devEnvironment.name != ''"> | |||
| and name = #{devEnvironment.name} | |||
| </if> | |||
| <if test="devEnvironment.status != null and devEnvironment.status != ''"> | |||
| and status = #{devEnvironment.status} | |||
| </if> | |||
| <if test="devEnvironment.computingResource != null and devEnvironment.computingResource != ''"> | |||
| and computing_resource = #{devEnvironment.computingResource} | |||
| </if> | |||
| <if test="devEnvironment.standard != null and devEnvironment.standard != ''"> | |||
| and standard = #{devEnvironment.standard} | |||
| </if> | |||
| <if test="devEnvironment.envVariable != null and devEnvironment.envVariable != ''"> | |||
| and env_variable = #{devEnvironment.envVariable} | |||
| </if> | |||
| <if test="devEnvironment.image != null and devEnvironment.image != ''"> | |||
| and image = #{devEnvironment.image} | |||
| </if> | |||
| <if test="devEnvironment.dataset != null and devEnvironment.dataset != ''"> | |||
| and dataset = #{devEnvironment.dataset} | |||
| </if> | |||
| <if test="devEnvironment.model != null and devEnvironment.model != ''"> | |||
| and model = #{devEnvironment.model} | |||
| </if> | |||
| <if test="devEnvironment.altField1 != null and devEnvironment.altField1 != ''"> | |||
| and alt_field1 = #{devEnvironment.altField1} | |||
| </if> | |||
| <if test="devEnvironment.altField2 != null and devEnvironment.altField2 != ''"> | |||
| and alt_field2 = #{devEnvironment.altField2} | |||
| </if> | |||
| <if test="devEnvironment.createBy != null and devEnvironment.createBy != ''"> | |||
| and create_by = #{devEnvironment.createBy} | |||
| </if> | |||
| <if test="devEnvironment.createTime != null"> | |||
| and create_time = #{devEnvironment.createTime} | |||
| </if> | |||
| <if test="devEnvironment.updateBy != null and devEnvironment.updateBy != ''"> | |||
| and update_by = #{devEnvironment.updateBy} | |||
| </if> | |||
| <if test="devEnvironment.updateTime != null"> | |||
| and update_time = #{devEnvironment.updateTime} | |||
| </if> | |||
| <if test="devEnvironment.state != null"> | |||
| and state = #{devEnvironment.state} | |||
| </if> | |||
| </where> | |||
| limit #{pageable.offset}, #{pageable.pageSize} | |||
| </select> | |||
| <!--统计总行数--> | |||
| <select id="count" resultType="java.lang.Long"> | |||
| select count(1) | |||
| from dev_environment | |||
| <where> | |||
| <if test="devEnvironment.id != null"> | |||
| and id = #{devEnvironment.id} | |||
| </if> | |||
| <if test="devEnvironment.name != null and devEnvironment.name != ''"> | |||
| and name = #{devEnvironment.name} | |||
| </if> | |||
| <if test="devEnvironment.status != null and devEnvironment.status != ''"> | |||
| and status = #{devEnvironment.status} | |||
| </if> | |||
| <if test="devEnvironment.computingResource != null and devEnvironment.computingResource != ''"> | |||
| and computing_resource = #{devEnvironment.computingResource} | |||
| </if> | |||
| <if test="devEnvironment.standard != null and devEnvironment.standard != ''"> | |||
| and standard = #{devEnvironment.standard} | |||
| </if> | |||
| <if test="devEnvironment.envVariable != null and devEnvironment.envVariable != ''"> | |||
| and env_variable = #{devEnvironment.envVariable} | |||
| </if> | |||
| <if test="devEnvironment.image != null and devEnvironment.image != ''"> | |||
| and image = #{devEnvironment.image} | |||
| </if> | |||
| <if test="devEnvironment.dataset != null and devEnvironment.dataset != ''"> | |||
| and dataset = #{devEnvironment.dataset} | |||
| </if> | |||
| <if test="devEnvironment.model != null and devEnvironment.model != ''"> | |||
| and model = #{devEnvironment.model} | |||
| </if> | |||
| <if test="devEnvironment.altField1 != null and devEnvironment.altField1 != ''"> | |||
| and alt_field1 = #{devEnvironment.altField1} | |||
| </if> | |||
| <if test="devEnvironment.altField2 != null and devEnvironment.altField2 != ''"> | |||
| and alt_field2 = #{devEnvironment.altField2} | |||
| </if> | |||
| <if test="devEnvironment.createBy != null and devEnvironment.createBy != ''"> | |||
| and create_by = #{devEnvironment.createBy} | |||
| </if> | |||
| <if test="devEnvironment.createTime != null"> | |||
| and create_time = #{devEnvironment.createTime} | |||
| </if> | |||
| <if test="devEnvironment.updateBy != null and devEnvironment.updateBy != ''"> | |||
| and update_by = #{devEnvironment.updateBy} | |||
| </if> | |||
| <if test="devEnvironment.updateTime != null"> | |||
| and update_time = #{devEnvironment.updateTime} | |||
| </if> | |||
| <if test="devEnvironment.state != null"> | |||
| and state = #{devEnvironment.state} | |||
| </if> | |||
| </where> | |||
| </select> | |||
| <!--新增所有列--> | |||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into dev_environment(name,status,computing_resource,standard,env_variable,image,dataset,model,alt_field1,alt_field2,create_by,create_time,update_by,update_time,state) | |||
| values (#{name},#{status},#{computingResource},#{standard},#{envVariable},#{image},#{dataset},#{model},#{altField1},#{altField2},#{createBy},#{createTime},#{updateBy},#{updateTime},#{state}) | |||
| </insert> | |||
| <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into dev_environment(name,status,computing_resource,standard,env_variable,image,dataset,model,alt_field1,alt_field2,create_by,create_time,update_by,update_time,state ) | |||
| values | |||
| <foreach collection="entities" item="entity" separator=","> | |||
| (#{entity.name},#{entity.status},#{entity.computingResource},#{entity.standard},#{entity.envVariable},#{entity.image},#{entity.dataset},#{entity.model},#{entity.altField1},#{entity.altField2},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state}) | |||
| </foreach> | |||
| </insert> | |||
| <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into dev_environment(name,status,computing_resource,standard,env_variable,image,dataset,model,alt_field1,alt_field2,create_by,create_time,update_by,update_time,state) | |||
| values | |||
| <foreach collection="entities" item="entity" separator=","> | |||
| (#{entity.name}#{entity.status}#{entity.computingResource}#{entity.standard}#{entity.envVariable}#{entity.image}#{entity.dataset}#{entity.model}#{entity.altField1}#{entity.altField2}#{entity.createBy}#{entity.createTime}#{entity.updateBy}#{entity.updateTime}#{entity.state}) | |||
| </foreach> | |||
| on duplicate key update | |||
| name = values(name)status = values(status)computing_resource = values(computing_resource)standard = values(standard)env_variable = values(env_variable)image = values(image)dataset = values(dataset)model = values(model)alt_field1 = values(alt_field1)alt_field2 = values(alt_field2)create_by = values(create_by)create_time = values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state) | |||
| </insert> | |||
| <!--通过主键修改数据--> | |||
| <update id="update"> | |||
| update dev_environment | |||
| <set> | |||
| <if test="devEnvironment.name != null and devEnvironment.name != ''"> | |||
| name = #{devEnvironment.name}, | |||
| </if> | |||
| <if test="devEnvironment.status != null and devEnvironment.status != ''"> | |||
| status = #{devEnvironment.status}, | |||
| </if> | |||
| <if test="devEnvironment.computingResource != null and devEnvironment.computingResource != ''"> | |||
| computing_resource = #{devEnvironment.computingResource}, | |||
| </if> | |||
| <if test="devEnvironment.standard != null and devEnvironment.standard != ''"> | |||
| standard = #{devEnvironment.standard}, | |||
| </if> | |||
| <if test="devEnvironment.envVariable != null and devEnvironment.envVariable != ''"> | |||
| env_variable = #{devEnvironment.envVariable}, | |||
| </if> | |||
| <if test="devEnvironment.image != null and devEnvironment.image != ''"> | |||
| image = #{devEnvironment.image}, | |||
| </if> | |||
| <if test="devEnvironment.dataset != null and devEnvironment.dataset != ''"> | |||
| dataset = #{devEnvironment.dataset}, | |||
| </if> | |||
| <if test="devEnvironment.model != null and devEnvironment.model != ''"> | |||
| model = #{devEnvironment.model}, | |||
| </if> | |||
| <if test="devEnvironment.altField1 != null and devEnvironment.altField1 != ''"> | |||
| alt_field1 = #{devEnvironment.altField1}, | |||
| </if> | |||
| <if test="devEnvironment.altField2 != null and devEnvironment.altField2 != ''"> | |||
| alt_field2 = #{devEnvironment.altField2}, | |||
| </if> | |||
| <if test="devEnvironment.createBy != null and devEnvironment.createBy != ''"> | |||
| create_by = #{devEnvironment.createBy}, | |||
| </if> | |||
| <if test="devEnvironment.createTime != null"> | |||
| create_time = #{devEnvironment.createTime}, | |||
| </if> | |||
| <if test="devEnvironment.updateBy != null and devEnvironment.updateBy != ''"> | |||
| update_by = #{devEnvironment.updateBy}, | |||
| </if> | |||
| <if test="devEnvironment.updateTime != null"> | |||
| update_time = #{devEnvironment.updateTime}, | |||
| </if> | |||
| <if test="devEnvironment.state != null"> | |||
| state = #{devEnvironment.state}, | |||
| </if> | |||
| </set> | |||
| where id = #{devEnvironment.id} | |||
| </update> | |||
| <!--通过主键删除--> | |||
| <delete id="deleteById"> | |||
| delete from dev_environment where id = #{id} | |||
| </delete> | |||
| </mapper> | |||