diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterHubTokenManager.java b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterHubTokenManager.java index 0a2ba1a..27c3a32 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterHubTokenManager.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterHubTokenManager.java @@ -14,10 +14,11 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; public class JupyterHubTokenManager { @@ -128,7 +129,7 @@ public class JupyterHubTokenManager { } // 启动用户的 Jupyter 服务器 - public static void startServer(String username,String caseName) throws IOException { + public static void startServer(String username,String caseName,Boolean flag) throws IOException { // 启动服务器后将需要的文件复制到刚创建的容器内 模拟实现文件挂载 CloseableHttpClient client = HttpClients.createDefault(); @@ -150,6 +151,28 @@ public class JupyterHubTokenManager { System.out.println("服务成功的启动: " + username+"不需要挂载文件!"); return; } + + //教师端,或者管理员新增 + if (flag) + { + //1.创建案例名.ipynb文件移动到挂载目录下 + //2.用户保存的案例, 创建案例时候保存调用接口 将案例放到/etc/jupyterhub/data/"+caseName目录下,然后转为html + // 指定文件的路径 + + //复制文件并改名 + String directory = "/etc/jupyterhub/admincreatefile/Untitled.ipynb"; + + String tofileName = "/home/"+username+"/"+caseName+".ipynb"; // 文件名 + // 创建源文件路径 + Path sourcePath = Paths.get(directory); + // 创建目标文件路径 + Path destinationPath = Paths.get(tofileName); + + // 复制文件并重命名 + Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING,StandardCopyOption.COPY_ATTRIBUTES); + return; + } + //需要挂载的文件 String path = "/etc/jupyterhub/data/"+caseName+"/."; diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterhubController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterhubController.java index e63eda2..dbf2289 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterhubController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterhubController.java @@ -3,6 +3,9 @@ package com.sztzjy.financial_bigdata.controller.stu; import cn.hutool.core.util.IdUtil; import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; +import com.sztzjy.financial_bigdata.entity.SysJupyterUserInfo; +import com.sztzjy.financial_bigdata.entity.SysJupyterUserInfoExample; +import com.sztzjy.financial_bigdata.mapper.SysJupyterUserInfoMapper; import com.sztzjy.financial_bigdata.util.ResultEntity; import com.sztzjy.financial_bigdata.util.file.IFileUtil; import io.swagger.annotations.Api; @@ -21,9 +24,11 @@ import org.apache.http.util.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.mock.web.MockMultipartFile; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; import java.io.*; import java.util.List; @@ -41,10 +46,100 @@ public class JupyterhubController { @Autowired IFileUtil iFileUtil; + @Resource + private SysJupyterUserInfoMapper sysJupyterUserInfoMapper; + + + @ApiOperation("创建案例保存时调用") + @GetMapping("/createCaseNameSave") + @AnonymousAccess + public ResultEntity createCaseNameSave(@ApiParam("案例名") String caseName) { + //用户保存的案例, 创建案例时候保存调用接口 将案例放到/etc/jupyterhub/data/"+caseName目录下,然后转为html + + SysJupyterUserInfoExample sysJupyterUserInfoExample = new SysJupyterUserInfoExample(); + sysJupyterUserInfoExample.createCriteria().andCaseNameEqualTo(caseName); + List jupyterUserInfoList = sysJupyterUserInfoMapper.selectByExample(sysJupyterUserInfoExample); + if (!jupyterUserInfoList.isEmpty()) + { + //String name = "zy" + substring; + String jupyterUsername = jupyterUserInfoList.get(0).getJupyterUsername(); + + //将案例从 home/jupyterUsername 放到/etc/jupyterhub/data/"+caseName目录下 + try { + + String fileName = "/home/"+jupyterUsername+"/"+caseName+".ipynb"; + String jupyterFilePath = "/etc/jupyterhub/data/"+caseName+"/"; + File directory = new File(jupyterFilePath); + if (!directory.exists()) { + directory.mkdirs(); + } + + + String[] command = { "cp", fileName ,jupyterFilePath}; + // 创建一个新的进程来执行Python代码 + Process process = Runtime.getRuntime().exec(command); + + + // 等待进程执行完成 + int exitCode = process.waitFor(); + + if (exitCode == 0) { + // 执行成功,输出Python代码的结果 + //System.out.println("文件挂载成功!"); + + // System.out.println("文件同步"); + //讲文件转为HTML + + // 创建文件输入流 + File file = new File(fileName); + FileInputStream input = new FileInputStream(file); + + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int bytesRead; + + // 将文件内容读取到 ByteArrayOutputStream 中 + while ((bytesRead = input.read(buffer)) != -1) { + output.write(buffer, 0, bytesRead); + } + + // 转换为字节数组 + byte[] fileBytes = output.toByteArray(); + + // 使用 MockMultipartFile 转换 + MultipartFile multipartFile = new MockMultipartFile( + file.getName(), + file.getName(), + "application/octet-stream", // 这里你可以根据实际情况设置 MIME 类型 + fileBytes + ); + + input.close(); // 关闭输入流 + output.close(); // 关闭输出流 + ; + + uploadFileByIpynb(multipartFile,caseName,false); + + return new ResultEntity(HttpStatus.OK); + } else { + // 执行失败,输出错误信息 + System.out.println("文件同步失败"); + } + } catch (IOException | InterruptedException e) { + e.printStackTrace(); + } + + } + return new ResultEntity<>(HttpStatus.BAD_REQUEST,"案例创建异常!"); + + } + + @ApiOperation("创建容器") @GetMapping("/jumpJupyerHub") @AnonymousAccess - public ResultEntity jumpJupyerHub(@ApiParam("案例名") String caseName) { + public ResultEntity jumpJupyerHub(@ApiParam("案例名") String caseName, + @RequestParam(required = false,defaultValue = "false")Boolean flag) { String username = IdUtil.fastSimpleUUID(); String substring = username.substring(2, 9); @@ -53,7 +148,16 @@ public class JupyterhubController { try { JupyterHubTokenManager.createUser(name); - JupyterHubTokenManager.startServer(name, caseName); + JupyterHubTokenManager.startServer(name, caseName,flag); + if (flag) + { + SysJupyterUserInfo sysJupyterUserInfo = new SysJupyterUserInfo(); + sysJupyterUserInfo.setCaseName(caseName); + sysJupyterUserInfo.setJupyterUsername(name); + sysJupyterUserInfo.setId(IdUtil.simpleUUID()); + sysJupyterUserInfoMapper.insert(sysJupyterUserInfo); + } + // System.out.println("启动服务!"); String url = JupyterHubTokenManager.generateToken(name); return new ResultEntity<>(HttpStatus.OK, "容器创建成功!", url); @@ -64,6 +168,9 @@ public class JupyterhubController { } + //创建案例,老师那边打开生成一个案例名相同的ipynb文件为空案例,,编辑后保存,找到挂载文件下目录,调用ipynb文件接口 + + /** * 1.进入页面首先发送请求判断数据是否存在 @@ -284,15 +391,21 @@ public class JupyterhubController { @ApiOperation("超管端或者教师端上传ipynb文件") @PostMapping("/uploadFileByIpynb") @AnonymousAccess - public ResultEntity uploadFileByIpynb(@RequestPart @ApiParam("文件") MultipartFile file, @ApiParam("案例名") String caseName) { - - - String filepath = "/etc/jupyterhub/data/" + caseName; - iFileUtil.uploadResource(file, filepath, caseName); + public ResultEntity uploadFileByIpynb(@RequestPart @ApiParam("文件") MultipartFile file, @ApiParam("案例名") String caseName, + @RequestParam(required = false,defaultValue = "true") Boolean flag) { + + String newIpynb = null; + newIpynb = "/etc/jupyterhub/data/"+caseName+"/"+ caseName + ".ipynb"; + if (flag) + { + String filepath = "/etc/jupyterhub/data/" + caseName; + iFileUtil.uploadResource(file, filepath, caseName); + newIpynb = "/etc/jupyterhub/data/" + caseName + ".ipynb"; + } //上传之后转换html到前端展示 - String newIpynb = "/etc/jupyterhub/data/" + caseName + ".ipynb"; + String htmlIpynb = "/etc/jupyterhub/html/" + caseName + ".html"; @@ -360,6 +473,7 @@ public class JupyterhubController { // Use ByteArrayBody with proper encoding for the file name ByteArrayBody byteArrayBody = new ByteArrayBody(fileBytes, file.getOriginalFilename()); + builder.addPart("file", byteArrayBody); builder.addTextBody("caseName", caseName, ContentType.TEXT_PLAIN.withCharset("UTF-8")); builder.setMode(HttpMultipartMode.RFC6532);//解决文件名乱码问题 diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/SysJupyterUserInfo.java b/src/main/java/com/sztzjy/financial_bigdata/entity/SysJupyterUserInfo.java new file mode 100644 index 0000000..838fa1f --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/SysJupyterUserInfo.java @@ -0,0 +1,54 @@ +package com.sztzjy.financial_bigdata.entity; + +import java.util.Date; + +import io.swagger.annotations.ApiModelProperty; +/** + * + * @author xcj + * sys_jupyter_userinfo + */ +public class SysJupyterUserInfo { + private String id; + + @ApiModelProperty("用户名") + private String jupyterUsername; + + @ApiModelProperty("案例名") + private String caseName; + + @ApiModelProperty("创建时间") + private Date createTime; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id == null ? null : id.trim(); + } + + public String getJupyterUsername() { + return jupyterUsername; + } + + public void setJupyterUsername(String jupyterUsername) { + this.jupyterUsername = jupyterUsername == null ? null : jupyterUsername.trim(); + } + + public String getCaseName() { + return caseName; + } + + public void setCaseName(String caseName) { + this.caseName = caseName == null ? null : caseName.trim(); + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/SysJupyterUserInfoExample.java b/src/main/java/com/sztzjy/financial_bigdata/entity/SysJupyterUserInfoExample.java new file mode 100644 index 0000000..eb793d8 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/SysJupyterUserInfoExample.java @@ -0,0 +1,470 @@ +package com.sztzjy.financial_bigdata.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class SysJupyterUserInfoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SysJupyterUserInfoExample() { + oredCriteria = new ArrayList<>(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameIsNull() { + addCriterion("jupyter_username is null"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameIsNotNull() { + addCriterion("jupyter_username is not null"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameEqualTo(String value) { + addCriterion("jupyter_username =", value, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameNotEqualTo(String value) { + addCriterion("jupyter_username <>", value, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameGreaterThan(String value) { + addCriterion("jupyter_username >", value, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameGreaterThanOrEqualTo(String value) { + addCriterion("jupyter_username >=", value, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameLessThan(String value) { + addCriterion("jupyter_username <", value, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameLessThanOrEqualTo(String value) { + addCriterion("jupyter_username <=", value, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameLike(String value) { + addCriterion("jupyter_username like", value, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameNotLike(String value) { + addCriterion("jupyter_username not like", value, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameIn(List values) { + addCriterion("jupyter_username in", values, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameNotIn(List values) { + addCriterion("jupyter_username not in", values, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameBetween(String value1, String value2) { + addCriterion("jupyter_username between", value1, value2, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andJupyterUsernameNotBetween(String value1, String value2) { + addCriterion("jupyter_username not between", value1, value2, "jupyterUsername"); + return (Criteria) this; + } + + public Criteria andCaseNameIsNull() { + addCriterion("case_name is null"); + return (Criteria) this; + } + + public Criteria andCaseNameIsNotNull() { + addCriterion("case_name is not null"); + return (Criteria) this; + } + + public Criteria andCaseNameEqualTo(String value) { + addCriterion("case_name =", value, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameNotEqualTo(String value) { + addCriterion("case_name <>", value, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameGreaterThan(String value) { + addCriterion("case_name >", value, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameGreaterThanOrEqualTo(String value) { + addCriterion("case_name >=", value, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameLessThan(String value) { + addCriterion("case_name <", value, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameLessThanOrEqualTo(String value) { + addCriterion("case_name <=", value, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameLike(String value) { + addCriterion("case_name like", value, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameNotLike(String value) { + addCriterion("case_name not like", value, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameIn(List values) { + addCriterion("case_name in", values, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameNotIn(List values) { + addCriterion("case_name not in", values, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameBetween(String value1, String value2) { + addCriterion("case_name between", value1, value2, "caseName"); + return (Criteria) this; + } + + public Criteria andCaseNameNotBetween(String value1, String value2) { + addCriterion("case_name not between", value1, value2, "caseName"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/mapper/SysJupyterUserInfoMapper.java b/src/main/java/com/sztzjy/financial_bigdata/mapper/SysJupyterUserInfoMapper.java new file mode 100644 index 0000000..e81f8bd --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/mapper/SysJupyterUserInfoMapper.java @@ -0,0 +1,32 @@ +package com.sztzjy.financial_bigdata.mapper; + +import com.sztzjy.financial_bigdata.entity.SysJupyterUserInfo; +import com.sztzjy.financial_bigdata.entity.SysJupyterUserInfoExample; +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper +public interface SysJupyterUserInfoMapper { + long countByExample(SysJupyterUserInfoExample example); + + int deleteByExample(SysJupyterUserInfoExample example); + + int deleteByPrimaryKey(String id); + + int insert(SysJupyterUserInfo record); + + int insertSelective(SysJupyterUserInfo record); + + List selectByExample(SysJupyterUserInfoExample example); + + SysJupyterUserInfo selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") SysJupyterUserInfo record, @Param("example") SysJupyterUserInfoExample example); + + int updateByExample(@Param("record") SysJupyterUserInfo record, @Param("example") SysJupyterUserInfoExample example); + + int updateByPrimaryKeySelective(SysJupyterUserInfo record); + + int updateByPrimaryKey(SysJupyterUserInfo record); +} \ No newline at end of file diff --git a/src/main/resources/mapper/SysJupyterUserInfoMapper.xml b/src/main/resources/mapper/SysJupyterUserInfoMapper.xml new file mode 100644 index 0000000..fab3e6d --- /dev/null +++ b/src/main/resources/mapper/SysJupyterUserInfoMapper.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, jupyter_username, case_name, create_time + + + + + delete from sys_jupyter_userinfo + where id = #{id,jdbcType=VARCHAR} + + + delete from sys_jupyter_userinfo + + + + + + insert into sys_jupyter_userinfo (id, jupyter_username, case_name, + create_time) + values (#{id,jdbcType=VARCHAR}, #{jupyterUsername,jdbcType=VARCHAR}, #{caseName,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}) + + + insert into sys_jupyter_userinfo + + + id, + + + jupyter_username, + + + case_name, + + + create_time, + + + + + #{id,jdbcType=VARCHAR}, + + + #{jupyterUsername,jdbcType=VARCHAR}, + + + #{caseName,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + + update sys_jupyter_userinfo + + + id = #{record.id,jdbcType=VARCHAR}, + + + jupyter_username = #{record.jupyterUsername,jdbcType=VARCHAR}, + + + case_name = #{record.caseName,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + + + + + + update sys_jupyter_userinfo + set id = #{record.id,jdbcType=VARCHAR}, + jupyter_username = #{record.jupyterUsername,jdbcType=VARCHAR}, + case_name = #{record.caseName,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP} + + + + + + update sys_jupyter_userinfo + + + jupyter_username = #{jupyterUsername,jdbcType=VARCHAR}, + + + case_name = #{caseName,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=VARCHAR} + + + update sys_jupyter_userinfo + set jupyter_username = #{jupyterUsername,jdbcType=VARCHAR}, + case_name = #{caseName,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file