SpringCloud+Vue3主子表插入数据(芋道)

目的:多表联查获取到每个班级里面所有的学生上课的信息。点击消课插入到消课主表和消课子表,主表记录班级信息,消课人员信息,上课时间。子表记录上课学员的信息,学员姓名、手机号、班级名称、班级类型、上课时间、老师名称

前端:

<template><Dialog :title="dialogTitle" v-model="dialogVisible">
<!-- 列表 --><ContentWrap><el-buttontype="primary"plain@click="submitForm">消课</el-button><el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"@selection-change="handleSelectionChange"><el-table-columnlabel="序号"type="index"header-align="center"align="center"width="60px"fixed/><el-table-column type="selection" width="55" /><el-table-column label="班级名称" align="center" prop="className" /><el-table-column label="班级类型" align="center" prop="classType" width="100px"><template #default="scope"><dict-tag :type="DICT_TYPE.COURSE_TYPE" :value="scope.row.classType" /></template></el-table-column><el-table-column label="学生姓名" align="center" prop="stsStudentName" /><el-table-column label="手机号" align="center" prop="stsPhone" /><el-table-column label="所报课程" align="center" prop="courseName" /><el-table-column label="上课时间" align="center" prop="firstClassStartTime" /><!-- <el-table-columnlabel="上课时间"align="center"prop="classTime":formatter="dateFormatter"width="180px"/> --><el-table-column label="授课教师" align="center" prop="teacherName" /></el-table><!-- 分页 --><Pagination:total="total"v-model:page="queryParams.pageNo"v-model:limit="queryParams.pageSize"@pagination="getList"/>
</ContentWrap></Dialog>
</template><script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { CancleClassApi, CancleClassVO } from '@/api/study/cancleclass'
import { ref } from 'vue';/** 消课记录 列表 */
defineOptions({ name: 'CancleClass' })
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const loading = ref(true) // 列表的加载中
const list = ref([]) // 列表的数据
const queryParams = reactive({
pageNo: 1,
pageSize: 10,})
const formData = ref({id: undefined,studentId: undefined
})const emit = defineEmits(['clickChild'])
const studentId = ref([])
const handleSelectionChange = (val: CancleClassVO[]) => {studentId.value = []for (let i = 0; i < val.length; i++) {studentId.value.push(val[i])}
}
const submitForm=async ()=>{const tableData = formData.value as unknown as CancleClassVOtableData.studentId = studentId.valueawait CancleClassApi.createCancleClass(tableData)//传递给父组件dialogVisible.value = false;  
}
const open = async (type: string, classId?: number) => {dialogVisible.value = trueloading.value = true
try {const data = await CancleClassApi.getCancleClassDetail(classId)list.value = data
} finally {loading.value = false
}
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 查询列表 */
// const getList = async () => {// }// onMounted(() => {
// getList()
// })
</script>
<style scoped lang="scss">:deep(.el-dialog__body){width: 1000px !important;height: 1000px !important; 
}
</style>

关键:

const formData = ref({id: undefined,studentId: undefined
})const studentId = ref([])
const handleSelectionChange = (val: CancleClassVO[]) => {studentId.value = []for (let i = 0; i < val.length; i++) {studentId.value.push(val[i])}
}
const submitForm=async ()=>{const tableData = formData.value as unknown as CancleClassVOtableData.studentId = studentId.valueawait CancleClassApi.createCancleClass(tableData)//传递给父组件dialogVisible.value = false;  
}

index.ts

import request from '@/config/axios'// 消课记录 VO
export interface CancleClassVO {id: number // 主键idclassName: string // 班级名称classType: string // 班级类型reportCourse: string // 所报课程classTime: Date // 上课时间classTeacher: string // 授课教师cancelClassPerson: string // 消课人cancelClassTime: Date // 消课时间studentName: string // 学员姓名phone: string // 手机号arrivedNum: number // 实到人数arrivingNum: number // 应到人数rollCallPerson: string // 点名操作人员rollCallTime: Date // 店面时间operaName: string // 操作人operaTime: Date // 操作时间operaType: string // 操作类型operaExplain: string // 操作说明studentId: any
}// 消课记录 API
export const CancleClassApi = {// 查询消课记录分页getCancleClassPage: async (params: any) => {return await request.get({ url: `/study/cancle-class/page`, params })},// 查询消课记录分页getCancleClassPage2: async (params: any) => {return await request.get({ url: `/study/cancle-class/page2`, params })},// 查询消课记录详情getCancleClass: async (id: number) => {return await request.get({ url: `/study/cancle-class/get?id=` + id })},// 查询消课记录详情getCancleClass2: async (id: number) => {return await request.get({ url: `/study/cancle-class/get2?id=` + id })},// 查询消课记录详情getCancleClassDetail: async (id: number) => {return await request.gets({ url: `/study/cancle-class/findByIds?id=` + id })},// 查询消课记录详情2getFindDetail: async (id: number) => {return await request.gets({ url: `/study/cancle-class/findDetail?id=` + id })},// 新增消课记录createCancleClass: async (data: CancleClassVO) => {return await request.post({ url: `/study/cancle-class/create`, data })},// 修改消课记录updateCancleClass: async (data: CancleClassVO) => {return await request.put({ url: `/study/cancle-class/update`, data })},// 删除消课记录deleteCancleClass: async (id: number) => {return await request.delete({ url: `/study/cancle-class/delete?id=` + id })},// 导出消课记录 ExcelexportCancleClass: async (params) => {return await request.download({ url: `/study/cancle-class/export-excel`, params })},
}

关键:

studentId: any

解析:通过遍历studentId来往后端传值,传的是对象的数组,后端通过studentId来遍历插入值

通过const tableData = formData.value as unknown as CancleClassVO映射往后端传值

// 消课记录 VO
export interface CancleClassVO {id: number // 主键idclassName: string // 班级名称classType: string // 班级类型reportCourse: string // 所报课程classTime: Date // 上课时间classTeacher: string // 授课教师cancelClassPerson: string // 消课人cancelClassTime: Date // 消课时间studentName: string // 学员姓名phone: string // 手机号arrivedNum: number // 实到人数arrivingNum: number // 应到人数rollCallPerson: string // 点名操作人员rollCallTime: Date // 店面时间operaName: string // 操作人operaTime: Date // 操作时间operaType: string // 操作类型operaExplain: string // 操作说明studentId: any
}

调用新增方法往后台插入值

await CancleClassApi.createCancleClass(tableData)

后端:

不仅要给主表建实体类,保存回显方法,还要给子表建立相应的实体类,保存回显方法。

项目架构:

controller:

实体类:

Mapper:

Service和实现类:

主表

实体类:

package com.todod.education.module.study.dal.dataobject.cancleclass;import lombok.*;import java.sql.Time;
import java.time.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.todod.education.framework.mybatis.core.dataobject.BaseDO;/*** 消课记录 DO** @author 平台管理员*/
@TableName("study_cancle_class")
@KeySequence("study_cancle_class_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CancleClassDO extends BaseDO {/*** 主键id*/@TableIdprivate Long id;/*** 班级id*/private Long classId;/*** 课程id*/private Long courseId;/*** 学员姓名*/@TableField(exist = false)private String stsStudentName;/*** 手机号*/@TableField(exist = false)private String stsPhone;/*** 班级名称*/@TableField(exist = false)private String className;/*** 班级类型*/@TableField(exist = false)private String classType;/*** 所报课程*/@TableField(exist = false)private String courseNames;/*** 所报课程*/@TableField(exist = false)private String courseName;/*** 授课教师*/@TableField(exist = false)private String teacherNames;/*** 授课教师*/@TableField(exist = false)private String teacherName;/*** 上课时间*/@TableField(exist = false)private Time firstClassStartTime;/*** 上课日期*/@TableField(exist = false)private Date firstClassDate;/*** 消课人*/private String cancelClassPerson;/*** 消课时间*/private LocalDateTime cancelClassTime;/*** 实到人数*/private Integer arrivedNum;/*** 应到人数*/private Integer arrivingNum;/*** 点名操作人员*/private String rollCallPerson;/*** 点名时间*/private LocalDateTime rollCallTime;/*** 操作人*/private String operaName;/*** 操作时间*/private LocalDateTime operaTime;/*** 操作类型*/private String operaType;/*** 操作说明*/private String operaExplain;}

由于多表联查所以在这个表里的实体类映射的时候,很多字段是从别的表里获取的,所以要加上这句话

@TableField(exist = false)

否则会去数据库里查相应字段报错。

controller:

package com.todod.education.module.study.controller.admin.cancleclass;import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;import com.todod.education.framework.common.pojo.PageParam;
import com.todod.education.framework.common.pojo.PageResult;
import com.todod.education.framework.common.pojo.CommonResult;
import com.todod.education.framework.common.util.object.BeanUtils;
import static com.todod.education.framework.common.pojo.CommonResult.success;import com.todod.education.framework.excel.core.util.ExcelUtils;import com.todod.education.framework.apilog.core.annotation.ApiAccessLog;
import static com.todod.education.framework.apilog.core.enums.OperateTypeEnum.*;import com.todod.education.module.study.controller.admin.cancleclass.vo.*;
import com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassDO;
import com.todod.education.module.study.service.cancleclass.CancleClassService;@Tag(name = "管理后台 - 消课记录")
@RestController
@RequestMapping("/study/cancle-class")
@Validated
public class CancleClassController {@Resourceprivate CancleClassService cancleClassService;@PostMapping("/create")@Operation(summary = "创建消课记录")@PreAuthorize("@ss.hasPermission('study:cancle-class:create')")public CommonResult<Long> createCancleClass(@Valid @RequestBody CancleClassSaveReqVO createReqVO) {return success(cancleClassService.createCancleClass(createReqVO));}@PutMapping("/update")@Operation(summary = "更新消课记录")@PreAuthorize("@ss.hasPermission('study:cancle-class:update')")public CommonResult<Boolean> updateCancleClass(@Valid @RequestBody CancleClassSaveReqVO updateReqVO) {cancleClassService.updateCancleClass(updateReqVO);return success(true);}@DeleteMapping("/delete")@Operation(summary = "删除消课记录")@Parameter(name = "id", description = "编号", required = true)@PreAuthorize("@ss.hasPermission('study:cancle-class:delete')")public CommonResult<Boolean> deleteCancleClass(@RequestParam("id") Long id) {cancleClassService.deleteCancleClass(id);return success(true);}@GetMapping("/get")@Operation(summary = "获得消课记录")@Parameter(name = "id", description = "编号", required = true, example = "1024")@PreAuthorize("@ss.hasPermission('study:cancle-class:query')")public CommonResult<CancleClassRespVO> getCancleClass(@RequestParam("id") Long id) {CancleClassDO cancleClass = cancleClassService.getCancleClass(id);return success(BeanUtils.toBean(cancleClass, CancleClassRespVO.class));}@GetMapping("/findByIds")public List<CancleClassDO> findUsersByIds(@RequestParam Long id) {return cancleClassService.selectCheck(id);}@GetMapping("/findDetail")public List<CancleClassDO> findDetail(@RequestParam Long id) {return cancleClassService.selectDetail(id);}@GetMapping("/get2")@Operation(summary = "获得消课记录2")@Parameter(name = "id", description = "编号", required = true, example = "1024")@PreAuthorize("@ss.hasPermission('study:cancle-class:query')")public CommonResult<CancleClassRespVO> getCancleClass2(@RequestParam("id") Long id) {CancleClassDO cancleClass = cancleClassService.getCancleClass2(id);return success(BeanUtils.toBean(cancleClass, CancleClassRespVO.class));}@GetMapping("/page")@Operation(summary = "获得消课记录分页")@PreAuthorize("@ss.hasPermission('study:cancle-class:query')")public CommonResult<PageResult<CancleClassRespVO>> getCancleClassPage(@Valid CancleClassPageReqVO pageReqVO) {PageResult<CancleClassDO> pageResult = cancleClassService.getCancleClassPage(pageReqVO);return success(BeanUtils.toBean(pageResult, CancleClassRespVO.class));}@GetMapping("/page2")@Operation(summary = "获得消课记录分页2")@PreAuthorize("@ss.hasPermission('study:cancle-class:query')")public CommonResult<PageResult<CancleClassRespVO>> getCancleClassPage2(@Valid CancleClassPageReqVO pageReqVO) {PageResult<CancleClassDO> pageResult = cancleClassService.getCancleClassPage2(pageReqVO);return success(BeanUtils.toBean(pageResult, CancleClassRespVO.class));}@GetMapping("/export-excel")@Operation(summary = "导出消课记录 Excel")@PreAuthorize("@ss.hasPermission('study:cancle-class:export')")@ApiAccessLog(operateType = EXPORT)public void exportCancleClassExcel(@Valid CancleClassPageReqVO pageReqVO,HttpServletResponse response) throws IOException {pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);List<CancleClassDO> list = cancleClassService.getCancleClassPage(pageReqVO).getList();// 导出 ExcelExcelUtils.write(response, "消课记录.xls", "数据", CancleClassRespVO.class,BeanUtils.toBean(list, CancleClassRespVO.class));}}

主要看create新增方法,插入主表子表有这一个新增方法即可

CancleClassSaveReqVO:

package com.todod.education.module.study.controller.admin.cancleclass.vo;import com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassInfoDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;@Schema(description = "管理后台 - 消课记录新增/修改 Request VO")
@Data
public class CancleClassSaveReqVO {@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4886")private Long id;@Schema(description = "学员id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4886")private List<CancleClassInfoDO> studentId;@Schema(description = "课程id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4886")private Long courseId;@Schema(description = "班级id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4886")private Long classId;@Schema(description = "上课时间")private LocalDateTime classTime;@Schema(description = "消课人")private String cancelClassPerson;@Schema(description = "消课时间")private LocalDateTime cancelClassTime;@Schema(description = "实到人数")private Integer arrivedNum;@Schema(description = "应到人数")private Integer arrivingNum;@Schema(description = "点名操作人员")private String rollCallPerson;@Schema(description = "点名时间")private LocalDateTime rollCallTime;@Schema(description = "操作人", example = "王五")private String operaName;@Schema(description = "操作时间")private LocalDateTime operaTime;@Schema(description = "操作类型", example = "2")private String operaType;@Schema(description = "操作说明")private String operaExplain;}

CancleClassRespVO:

package com.todod.education.module.study.controller.admin.cancleclass.vo;import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;import java.sql.Time;
import java.time.LocalTime;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;@Schema(description = "管理后台 - 消课记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CancleClassRespVO {@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18505")private Long id;@Schema(description = "学员id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18505")private Long studentId;@Schema(description = "班级id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18505")private Long classId;@Schema(description = "课程id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18505")private Long courseId;@Schema(description = "学员姓名", example = "芋艿")private String stsStudentName;@Schema(description = "手机号")private String stsPhone;@Schema(description = "班级名称", example = "李四")@ExcelProperty("班级名称")private String className;@Schema(description = "班级类型", example = "1")@ExcelProperty("班级类型")private String classType;@Schema(description = "所报课程")@ExcelProperty("所报课程")private String courseNames;@Schema(description = "所报课程")@ExcelProperty("所报课程")private String courseName;@Schema(description = "上课时间")private Time firstClassStartTime;@Schema(description = "上课日期")private Date firstClassDate;@Schema(description = "授课教师")@ExcelProperty("授课教师")private String teacherNames;@Schema(description = "授课教师")@ExcelProperty("授课教师")private String teacherName;@Schema(description = "消课人")@ExcelProperty("消课人")private String cancelClassPerson;@Schema(description = "消课时间")@ExcelProperty("消课时间")private LocalDateTime cancelClassTime;@Schema(description = "创建时间")@ExcelProperty("创建时间")private LocalDateTime createTime;@Schema(description = "操作人", example = "王五")private String operaName;@Schema(description = "操作时间")private LocalDateTime operaTime;@Schema(description = "操作类型", example = "2")private String operaType;@Schema(description = "操作说明")private String operaExplain;@Schema(description = "实到人数")private Integer arrivedNum;@Schema(description = "应到人数")private Integer arrivingNum;@Schema(description = "点名操作人员")private String rollCallPerson;@Schema(description = "点名时间")private LocalDateTime rollCallTime;
}

CancleClassPageReqVO:

package com.todod.education.module.study.controller.admin.cancleclass.vo;import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.todod.education.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;import static com.todod.education.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;@Schema(description = "管理后台 - 消课记录分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CancleClassPageReqVO extends PageParam {@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18505")private Long id;@Schema(description = "班级名称", example = "李四")private String className;@Schema(description = "上课时间")@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)private LocalDateTime[] classTime;@Schema(description = "消课时间")@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)private LocalDateTime[] cancelClassTime;@Schema(description = "创建时间")@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)private LocalDateTime[] createTime;@Schema(description = "所报课程", example = "李四")private String courseName;@Schema(description = "学员姓名")private String stsStudentName;@Schema(description = "手机号")private String stsPhone;
}

Mapper:

package com.todod.education.module.study.dal.mysql.cancleclass;import java.util.*;import com.baomidou.mybatisplus.core.metadata.IPage;
import com.todod.education.framework.common.pojo.PageResult;
import com.todod.education.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.todod.education.framework.mybatis.core.mapper.BaseMapperX;
import com.todod.education.module.study.controller.admin.entranceexam.vo.EntranceExamPageReqVO;
import com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassDO;
import com.todod.education.module.study.dal.dataobject.entranceexam.EntranceExamDO;
import org.apache.ibatis.annotations.Mapper;
import com.todod.education.module.study.controller.admin.cancleclass.vo.*;
import org.apache.ibatis.annotations.Param;/*** 消课记录 Mapper** @author 平台管理员*/
@Mapper
public interface CancleClassMapper extends BaseMapperX<CancleClassDO> {default PageResult<CancleClassDO> selectPage(CancleClassPageReqVO reqVO) {return selectPage(reqVO, new LambdaQueryWrapperX<CancleClassDO>().likeIfPresent(CancleClassDO::getClassName, reqVO.getClassName()).betweenIfPresent(CancleClassDO::getCancelClassTime, reqVO.getCancelClassTime()).betweenIfPresent(CancleClassDO::getCreateTime, reqVO.getCreateTime()).orderByDesc(CancleClassDO::getId));}IPage<CancleClassDO> fetchPageResults(IPage<CancleClassDO> page, @Param("queryEntry") CancleClassPageReqVO pageReqVO);List<CancleClassDO> selectCheck(@Param("id") Long id);List<CancleClassDO> selectDetail(@Param("id") Long id);}

Service:

package com.todod.education.module.study.service.cancleclass;import java.util.*;
import jakarta.validation.*;
import com.todod.education.module.study.controller.admin.cancleclass.vo.*;
import com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassDO;
import com.todod.education.framework.common.pojo.PageResult;
import com.todod.education.framework.common.pojo.PageParam;/*** 消课记录 Service 接口** @author 平台管理员*/
public interface CancleClassService {/*** 创建消课记录** @param createReqVO 创建信息* @return 编号*/Long createCancleClass(@Valid CancleClassSaveReqVO createReqVO);/*** 更新消课记录** @param updateReqVO 更新信息*/void updateCancleClass(@Valid CancleClassSaveReqVO updateReqVO);/*** 删除消课记录** @param id 编号*/void deleteCancleClass(Long id);/*** 获得消课记录** @param id 编号* @return 消课记录*/CancleClassDO getCancleClass(Long id);/*** 获得消课记录** @param id 编号* @return 消课记录*/CancleClassDO getCancleClass2(Long id);/*** 获得消课记录分页** @param pageReqVO 分页查询* @return 消课记录分页*/PageResult<CancleClassDO> getCancleClassPage(CancleClassPageReqVO pageReqVO);/*** 获得消课记录分页2** @param pageReqVO 分页查询* @return 消课记录分页*/PageResult<CancleClassDO> getCancleClassPage2(CancleClassPageReqVO pageReqVO);List<CancleClassDO> selectCheck(Long id);List<CancleClassDO> selectDetail(Long id);}

实现类:

package com.todod.education.module.study.service.cancleclass;import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzt.logapi.context.LogRecordContext;
import com.mzt.logapi.service.impl.DiffParseFunction;
import com.mzt.logapi.starter.annotation.LogRecord;
import com.todod.education.module.study.controller.admin.monthexam.vo.MonthExamPageReqVO;
import com.todod.education.module.study.controller.admin.plan.vo.PlanSaveReqVO;
import com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassInfoDO;
import com.todod.education.module.study.dal.dataobject.monthexam.MonthExamDO;
import com.todod.education.module.study.dal.dataobject.plan.PlanDO;
import com.todod.education.module.study.dal.mysql.cancleclass.CancleClassInfoMapper;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;import java.util.*;
import com.todod.education.module.study.controller.admin.cancleclass.vo.*;
import com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassDO;
import com.todod.education.framework.common.pojo.PageResult;
import com.todod.education.framework.common.pojo.PageParam;
import com.todod.education.framework.common.util.object.BeanUtils;import com.todod.education.module.study.dal.mysql.cancleclass.CancleClassMapper;import static com.todod.education.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.todod.education.module.study.enums.ErrorCodeConstants.*;
import static com.todod.education.module.system.enums.LogRecordConstants.*;/*** 消课记录 Service 实现类** @author 平台管理员*/
@Service
@Validated
public class CancleClassServiceImpl implements CancleClassService {@Resourceprivate CancleClassMapper cancleClassMapper;@Resourceprivate CancleClassInfoMapper cancleClassInfoMapper;@Override@LogRecord(type = STUDY_CANCLE_CLASS_TYPE, subType = STUDY_CANCLE_CLASS_SUB_TYPE, bizNo = "{{#cancleClass.id}}",success = STUDY_CANCLE_CLASS_CREATE_SUCCESS)public Long createCancleClass(CancleClassSaveReqVO createReqVO) {if(createReqVO.getStudentId().size() == 0){throw exception(CANCLE_CLASS_NOT_EXISTS);}// 插入CancleClassDO cancleClass = BeanUtils.toBean(createReqVO, CancleClassDO.class);cancleClassMapper.insert(cancleClass);List<CancleClassInfoDO> studentIds = createReqVO.getStudentId();for (CancleClassInfoDO studentId : studentIds) {CancleClassInfoDO cancleClassInfoDO = new CancleClassInfoDO();cancleClassInfoDO.setStudentId(studentId.getStudentId());cancleClassInfoDO.setStudentName(studentId.getStudentName());cancleClassInfoDO.setStudentPhone(studentId.getStudentPhone());cancleClassInfoDO.setClassType(studentId.getClassType());cancleClassInfoDO.setClassName(studentId.getClassName());cancleClassInfoDO.setCourseName(studentId.getCourseName());cancleClassInfoDO.setTeacherName(studentId.getTeacherName());cancleClassInfoDO.setClassStartTime(studentId.getClassStartTime());cancleClassInfoDO.setId(studentId.getId());cancleClassInfoMapper.insert(cancleClassInfoDO);}// 3. 记录操作日志上下文LogRecordContext.putVariable("cancleClass", cancleClass);return cancleClass.getId();}//    @Override
//    @LogRecord(type = STUDY_CANCLE_CLASS_TYPE, subType = STUDY_CANCLE_CLASS_SUB_TYPE, bizNo = "{{#cancleClass.id}}",
//            success = STUDY_CANCLE_CLASS_CREATE_SUCCESS)
//    public Long createCancleClass(CancleClassSaveReqVO createReqVO) {
//        // 插入
//        CancleClassDO cancleClass = BeanUtils.toBean(createReqVO, CancleClassDO.class);
//        cancleClassMapper.insert(cancleClass);
//
//        // 3. 记录操作日志上下文
//        LogRecordContext.putVariable("cancleClass", cancleClass);
//
//        // 返回
//        return cancleClass.getId();
//    }@Override@LogRecord(type = STUDY_PLAN_TYPE, subType = STUDY_CANCLE_CLASS_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",success = STUDY_CANCLE_CLASS_UPDATE_SUCCESS)public void updateCancleClass(CancleClassSaveReqVO updateReqVO) {// 校验存在validateCancleClassExists(updateReqVO.getId());CancleClassDO oldCancleClassDO = cancleClassMapper.selectById(updateReqVO.getId());// 更新CancleClassDO updateObj = BeanUtils.toBean(updateReqVO, CancleClassDO.class);cancleClassMapper.updateById(updateObj);// 3. 记录操作日志上下文LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldCancleClassDO, PlanSaveReqVO.class));LogRecordContext.putVariable("cancleClass", oldCancleClassDO);}@Override@LogRecord(type = STUDY_PLAN_TYPE, subType = STUDY_CANCLE_CLASS_DELETE_SUB_TYPE, bizNo = "{{#id}}",success = STUDY_CANCLE_CLASS_DELETE_SUCCESS)public void deleteCancleClass(Long id) {// 校验存在validateCancleClassExists(id);CancleClassDO oldCancleClassDO = cancleClassMapper.selectById(id);// 删除cancleClassMapper.deleteById(id);// 3. 记录操作日志上下文LogRecordContext.putVariable("cancleClass", oldCancleClassDO);}private void validateCancleClassExists(Long id) {if (cancleClassMapper.selectById(id) == null) {throw exception(CANCLE_CLASS_NOT_EXISTS);}}@Overridepublic CancleClassDO getCancleClass(Long id) {return cancleClassMapper.selectById(id);}@Overridepublic CancleClassDO getCancleClass2(Long id) {return cancleClassMapper.selectById(id);}@Overridepublic PageResult<CancleClassDO> getCancleClassPage(CancleClassPageReqVO pageReqVO) {return cancleClassMapper.selectPage(pageReqVO);}@Overridepublic PageResult<CancleClassDO> getCancleClassPage2(CancleClassPageReqVO pageReqVO) {IPage<CancleClassDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());cancleClassMapper.fetchPageResults(page, pageReqVO);return new PageResult<>(page.getRecords(), page.getTotal());}@Overridepublic List<CancleClassDO> selectCheck(Long id) {return cancleClassMapper.selectCheck(id);}@Overridepublic List<CancleClassDO> selectDetail(Long id) {return cancleClassMapper.selectDetail(id);}}

XML文件:

<?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.todod.education.module.study.dal.mysql.cancleclass.CancleClassMapper"><select id="fetchPageResults" resultType="com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassDO">SELECT tcm.class_name,tcm.id AS class_id,tcm.class_type,tcmc.teacherNames,tcmc.courseNames,tcms.students,FIRST_VALUE(stt.class_start_time) OVER (PARTITION BY tcm.id ORDER BY stt.class_date) AS first_class_start_time,FIRST_VALUE(stt.class_date) OVER (PARTITION BY tcm.id ORDER BY stt.class_date) AS first_class_start_dateFROM teach_class_manage tcmINNER JOIN (SELECT tcmc.class_id,string_agg(htm.teacher_name, ',') AS teacherNames,string_agg(tcm.course_name, ',') AS courseNamesFROM teach_class_manage_course tcmcINNER JOIN hr_teacher_manage htm ON htm."id" = tcmc.teacher_idINNER JOIN teach_course_manage tcm ON tcm."id" = tcmc.course_idGROUP BY tcmc.class_id) tcmc ON tcm."id" = tcmc.class_idLEFT JOIN (SELECT tcms.class_id,COALESCE(COUNT(*), 0) AS studentsFROM teach_class_manage_student tcmsGROUP BY tcms.class_id) tcms ON  tcm."id" = tcms.class_idLEFT JOIN study_time_table stt ON stt.study_course_id = ANY(ARRAY(SELECT tcmc2.course_id FROM teach_class_manage_course tcmc2 WHERE tcmc2.class_id = tcm.id))WHERE 1 = 1 AND tcm.deleted = 0<if test=" queryEntry.stsStudentName != null and queryEntry.stsStudentName != '' and queryEntry.stsStudentName != 'null' ">AND ss.sts_student_name like '%${queryEntry.stsStudentName}'</if>ORDER BYtcm.create_time desc</select><select id="selectCheck" resultType="com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassDO">SELECTtcm.class_name,tcm.class_type,ss.sts_student_name,FIRST_VALUE(stt.class_start_time) OVER (PARTITION BY tcm.id ORDER BY stt.class_date) AS first_class_start_time,
--                 FIRST_VALUE(stt.class_date) OVER (PARTITION BY tcm.id ORDER BY stt.class_date) AS first_class_start_datess.sts_phone,tcs.student_id,tcmc.course_id,tcm2.course_name,htm.teacher_nameFROMteach_class_manage tcmJOIN teach_class_manage_student tcs ON tcm.id = tcs.class_idJOIN study_student ss ON tcs.student_id = ss.idJOIN teach_class_manage_course tcmc ON tcm.id = tcmc.class_idJOIN teach_course_manage tcm2 ON tcmc.course_id = tcm2.idJOIN hr_teacher_manage htm ON tcmc.teacher_id = htm.idLEFT JOIN study_time_table stt ON stt.study_course_id = ANY(ARRAY(SELECT tcmc2.course_id FROM teach_class_manage_course tcmc2 WHERE tcmc2.class_id = tcm.id))WHEREtcm.id = #{id}ORDER BYtcs.student_id, tcmc.course_id;</select><select id="selectDetail" resultType="com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassDO">SELECTtcm.class_name,tcm.id AS class_id,tcm.class_type,tcmc.teacherNames,tcmc.courseNames,tcms.students,FIRST_VALUE(stt.class_start_time) OVER (PARTITION BY tcm.id ORDER BY stt.class_date) AS first_class_start_time,FIRST_VALUE(stt.class_date) OVER (PARTITION BY tcm.id ORDER BY stt.class_date) AS first_class_start_dateFROMteach_class_manage tcmINNER JOIN (SELECTtcmc.class_id,string_agg(htm.teacher_name, ',') AS teacherNames,string_agg(tcm.course_name, ',') AS courseNamesFROMteach_class_manage_course tcmcINNER JOIN hr_teacher_manage htm ON htm.id = tcmc.teacher_idINNER JOIN teach_course_manage tcm ON tcm.id = tcmc.course_idGROUP BYtcmc.class_id) tcmc ON tcm.id = tcmc.class_idLEFT JOIN (SELECTtcms.class_id,COALESCE(COUNT(*), 0) AS studentsFROMteach_class_manage_student tcmsGROUP BYtcms.class_id) tcms ON tcm.id = tcms.class_idLEFT JOIN study_time_table stt ON stt.study_course_id IN (SELECT tcmc2.course_id FROM teach_class_manage_course tcmc2 WHERE tcmc2.class_id = tcm.id)WHEREtcm.deleted = 0AND tcm.id = 9 -- 替换为实际的参数或变量ORDER BYtcm.create_time DESC;</select></mapper>

从表

CancleClassInfoSaveReqVO:

package com.todod.education.module.study.controller.admin.cancleclass.vo;import com.alibaba.excel.annotation.ExcelProperty;
import com.todod.education.module.study.dal.dataobject.cancleclass.CancleClassInfoDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;import java.sql.Time;
import java.time.LocalDateTime;
import java.util.List;@Schema(description = "管理后台 - 消课记录新增/修改 Request VO")
@Data
public class CancleClassInfoSaveReqVO {@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4886")private Long id;@Schema(description = "学员id", example = "21490")private List<CancleClassInfoDO> studentId;@Schema(description = "学员姓名", example = "芋艿")private String studentName;@Schema(description = "手机号")private String studentPhone;@Schema(description = "班级名称", example = "李四")@ExcelProperty("班级名称")private String className;@Schema(description = "班级类型", example = "1")@ExcelProperty("班级类型")private String classType;@Schema(description = "所报课程")@ExcelProperty("所报课程")private String courseName;@Schema(description = "上课时间")@ExcelProperty("上课时间")private Time classStartTime;@Schema(description = "授课教师")@ExcelProperty("授课教师")private String teacherName;@Schema(description = "操作人", example = "王五")private String operaName;@Schema(description = "操作时间")private LocalDateTime operaTime;@Schema(description = "操作类型", example = "2")private String operaType;@Schema(description = "操作说明")private String operaExplain;}

关键

@Schema(description = "学员id", example = "21490")
    private List<CancleClassInfoDO> studentId;

要把学员id定义成一个list对象集合,用来往子表批量插入学生的数据

CancleClassInfoRespVO:

package com.todod.education.module.study.controller.admin.cancleclass.vo;import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;import java.sql.Time;
import java.time.LocalDateTime;@Schema(description = "管理后台 - 消课记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CancleClassInfoRespVO {@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18505")private Long id;@Schema(description = "学员姓名", example = "芋艿")private String studentName;@Schema(description = "手机号")private String studentPhone;@Schema(description = "班级名称", example = "李四")@ExcelProperty("班级名称")private String className;@Schema(description = "班级类型", example = "1")@ExcelProperty("班级类型")private String classType;@Schema(description = "所报课程")@ExcelProperty("所报课程")private String courseName;@Schema(description = "上课时间")@ExcelProperty("上课时间")private Time classStartTime;@Schema(description = "授课教师")@ExcelProperty("授课教师")private String teacherName;@Schema(description = "创建时间")@ExcelProperty("创建时间")private LocalDateTime createTime;@Schema(description = "操作人", example = "王五")private String operaName;@Schema(description = "操作时间")private LocalDateTime operaTime;@Schema(description = "操作类型", example = "2")private String operaType;@Schema(description = "操作说明")private String operaExplain;}

实现类:

package com.todod.education.module.study.dal.dataobject.cancleclass;import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.todod.education.framework.mybatis.core.dataobject.BaseDO;
import lombok.*;import java.sql.Time;
import java.time.LocalDateTime;/*** 消课记录 DO** @author 平台管理员*/
@TableName("study_cancle_class_info")
@KeySequence("study_cancle_class_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CancleClassInfoDO extends BaseDO {/*** 主键id*/@TableIdprivate Long id;private Long studentId;/*** 学员姓名*/private String studentName;/*** 手机号*/private String studentPhone;/*** 班级名称*/private String className;/*** 班级类型*/private String classType;/*** 所报课程*/private String courseName;/*** 授课教师*/private String teacherName;/*** 上课时间*/private Time classStartTime;/*** 操作人*/private String operaName;/*** 操作时间*/private LocalDateTime operaTime;/*** 操作类型*/private String operaType;/*** 操作说明*/private String operaExplain;}

关键:

  @Override@LogRecord(type = STUDY_CANCLE_CLASS_TYPE, subType = STUDY_CANCLE_CLASS_SUB_TYPE, bizNo = "{{#cancleClass.id}}",success = STUDY_CANCLE_CLASS_CREATE_SUCCESS)public Long createCancleClass(CancleClassSaveReqVO createReqVO) {if(createReqVO.getStudentId().size() == 0){throw exception(CANCLE_CLASS_NOT_EXISTS);}// 插入CancleClassDO cancleClass = BeanUtils.toBean(createReqVO, CancleClassDO.class);cancleClassMapper.insert(cancleClass);List<CancleClassInfoDO> studentIds = createReqVO.getStudentId();for (CancleClassInfoDO studentId : studentIds) {CancleClassInfoDO cancleClassInfoDO = new CancleClassInfoDO();cancleClassInfoDO.setStudentId(studentId.getStudentId());cancleClassInfoDO.setStudentName(studentId.getStudentName());cancleClassInfoDO.setStudentPhone(studentId.getStudentPhone());cancleClassInfoDO.setClassType(studentId.getClassType());cancleClassInfoDO.setClassName(studentId.getClassName());cancleClassInfoDO.setCourseName(studentId.getCourseName());cancleClassInfoDO.setTeacherName(studentId.getTeacherName());cancleClassInfoDO.setClassStartTime(studentId.getClassStartTime());cancleClassInfoDO.setId(studentId.getId());cancleClassInfoMapper.insert(cancleClassInfoDO);}// 3. 记录操作日志上下文LogRecordContext.putVariable("cancleClass", cancleClass);return cancleClass.getId();}

主表插入:

// 插入
CancleClassDO cancleClass = BeanUtils.toBean(createReqVO, CancleClassDO.class);
cancleClassMapper.insert(cancleClass);

直接用Mapper以及mybatis-plus插入到数据库里面

子表插入:

List<CancleClassInfoDO> studentIds = createReqVO.getStudentId();
for (CancleClassInfoDO studentId : studentIds) {CancleClassInfoDO cancleClassInfoDO = new CancleClassInfoDO();cancleClassInfoDO.setStudentId(studentId.getStudentId());cancleClassInfoDO.setStudentName(studentId.getStudentName());cancleClassInfoDO.setStudentPhone(studentId.getStudentPhone());cancleClassInfoDO.setClassType(studentId.getClassType());cancleClassInfoDO.setClassName(studentId.getClassName());cancleClassInfoDO.setCourseName(studentId.getCourseName());cancleClassInfoDO.setTeacherName(studentId.getTeacherName());cancleClassInfoDO.setClassStartTime(studentId.getClassStartTime());cancleClassInfoDO.setId(studentId.getId());cancleClassInfoMapper.insert(cancleClassInfoDO);
}

List<CancleClassInfoDO> studentIds = createReqVO.getStudentId();

遍历前端传过来的studentId,往子表里插入数据

        for (CancleClassInfoDO studentId : studentIds) {
            CancleClassInfoDO cancleClassInfoDO = new CancleClassInfoDO();
            cancleClassInfoDO.setStudentId(studentId.getStudentId());
            cancleClassInfoDO.setStudentName(studentId.getStudentName());
            cancleClassInfoDO.setStudentPhone(studentId.getStudentPhone());
            cancleClassInfoDO.setClassType(studentId.getClassType());
            cancleClassInfoDO.setClassName(studentId.getClassName());
            cancleClassInfoDO.setCourseName(studentId.getCourseName());
            cancleClassInfoDO.setTeacherName(studentId.getTeacherName());
            cancleClassInfoDO.setClassStartTime(studentId.getClassStartTime());
            cancleClassInfoDO.setId(studentId.getId());
            cancleClassInfoMapper.insert(cancleClassInfoDO);
        }

CancleClassInfoDO cancleClassInfoDO = new CancleClassInfoDO();

新建一个CancleClassInfoDO 实体类对象。

cancleClassInfoDO.setStudentId(studentId.getStudentId());
            cancleClassInfoDO.setStudentName(studentId.getStudentName());
            cancleClassInfoDO.setStudentPhone(studentId.getStudentPhone());
            cancleClassInfoDO.setClassType(studentId.getClassType());
            cancleClassInfoDO.setClassName(studentId.getClassName());
            cancleClassInfoDO.setCourseName(studentId.getCourseName());
            cancleClassInfoDO.setTeacherName(studentId.getTeacherName());
            cancleClassInfoDO.setClassStartTime(studentId.getClassStartTime());
            cancleClassInfoDO.setId(studentId.getId());

往数据库插入数据

cancleClassInfoMapper.insert(cancleClassInfoDO);

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/386333.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

词的向量化和文本向量化

词的向量化和文本向量化 向量化one-hot编码提前准备词表不提前准备词表one-hot缺点 词向量简介词向量的定义和目标word embedding和word vector的区别onehot编码与词向量关系构建 训练方式1&#xff08;基于语言模型&#xff09;训练方式2&#xff08;基于窗口&#xff09;CBOW…

Javascript前端面试基础(八)

window.onload和$(document).ready区别 window.onload()方法是必须等到页面内包括图片的所有元素加载完毕后才能执行$(document).ready()是DOM结构绘制完毕后就执行&#xff0c;不必等到加载完毕 window.onload 触发时机&#xff1a;window.onload 事件会在整个页面&#xf…

[css3] 如何设置边框颜色渐变

div {border: 4px solid;border-image: linear-gradient(to right, #8f41e9, #578aef) 1; }参考&#xff1a; 5种CSS实现渐变色边框&#xff08;Gradient borders方法的汇总

银行贷款信用评分不足?大数据帮你找回失去的“分”

在这个信息爆炸的时代&#xff0c;无论是个人还是企业&#xff0c;数据都成为了衡量信用和评估风险的重要依据。贷款、融资、求职甚至是日常消费&#xff0c;都可能因为一份好的数据报告而变得更加顺畅。那么&#xff0c;如何高效地查询自己的大数据&#xff0c;面对评分不足时…

文件上传漏洞(ctfshow web151-161)

Web151 F12修改源代码 exts后面png改为php 这样就可以上传php的文件了 Web152&#xff1a; 考点&#xff1a;后端不能单一校验 就是要传图片格式&#xff0c;抓个包传个png的图片 然后bp抓包修改php后缀解析 然后放包 Web153-web156 在php代码中可以使用“{}”代替“[]” …

uniapp时间戳转时间

时间戳转时间 utils页面 function timestampToTime(time) { const date new Date(time); const year date.getFullYear(); const month String(date.getMonth() 1).padStart(2, 0); // 月份从0开始&#xff0c;所以要加1&#xff0c;并补齐0 const day String(date…

尚庭公寓(五)

图片上传管理 由于公寓、房间等实体均包含图片信息&#xff0c;所以在新增或修改公寓、房间信息时&#xff0c;需要上传图片&#xff0c;因此我们需要实现一个上传图片的接口。 **1. 图片上传流程** 下图展示了新增房间或公寓时&#xff0c;上传图片的流程。 可以看出图片上传…

深度学习Week21——学习DenseNet算法

文章目录 深度学习Week21——学习DenseNet算法 一、前言 二、我的环境 三、学习DenseNet算法 四、代码复现 4.1 配置数据集 4.2 构建模型 五、模型应用与评估 5.1 编写训练函数 5.2 编写测试函数 5.3 训练模型 5.4 结果可视化 一、前言 &#x1f368; 本文为&#x1f517;365天…

第一个设计模式——单例模式

目录 一、特点&#xff1a; 二、实现单例模式步骤 三、饿汉式 四、懒汉式 五、双重检查锁 六、静态内部类 七、枚举 八、可能被反序列化和反射破坏什么意思&#xff1f; 九、如何解决呢&#xff1f; 一、特点&#xff1a; 唯一性&#xff0c;单例模式确保程序中只有一…

Qt自定义带前后缀图标的PushButton

写在前面 Qt提供QPushButton不满足带前后缀图标的需求&#xff0c;因此考虑自定义实现带前后缀图标的PushButton&#xff0c;方便后续快速使用。 效果如下&#xff1a; 同时可设置前后缀图标和文本之间间隙&#xff1a; 代码实现 通过前文介绍的Qt样式表底层实现 可以得…

HiveSQL中last_value和first_value函数的应用

概述 今天做一个数据分析&#xff0c;其中有一列数据有些有数据有些没数据&#xff0c;因此我们需要把每数据的进行补充进来因此我们需要使用last_value 函数和over 结合使用&#xff0c;但是遇到一个比较奇葩的问题不能按照预期进行处理。 新说原因&#xff1a; 由于我们要处…

vue3-环境变量-JavaScript-axio-基础使用-lzstring-字符串压缩-python

文章目录 1.Vue3环境变量1.1.简介1.2.全局变量的引用1.3.package.json文件 2.axio2.1.promise2.2.安装2.3.配置2.3.1.全局 axios 默认值2.3.2.响应信息格式 2.4.Axios的拦截器2.4.1.请求拦截器2.4.2.响应拦截器2.4.3.移除拦截器2.4.4.自定义实例添加拦截器 3.lz-string3.1.java…

java项目数据库 mysql 迁移到 达梦

目录 一、下载安装达梦数据库 1、下载 2、解压 3、安装 二、迁移 三、更改SpringBoot 的 yml文件 1、达梦创建用户 2、修改yml 一、下载安装达梦数据库 1、下载 下载地址 https://eco.dameng.com/download/ 点击下载 开发版 (X86平台) , 然后选择操作系统并点击立…

“科技创新‘圳’在变革”2025深圳电子展

电子产业作为现代社会的核心驱动力之一&#xff0c;正以前所未有的速度发展。在这样的背景下&#xff0c;深圳作为中国的经济特区和创新高地&#xff0c;又一次迎来了备受瞩目的盛会——2025深圳电子展览会。本次展览会定于2025年4月9日至11日&#xff0c;在深圳会展中心&#…

剪画小程序:手机提取人声和伴奏

在音乐的海洋中&#xff0c;我们常常渴望更纯粹地感受歌手的嗓音魅力。 如今&#xff0c;有了 剪画&#xff0c;人声分离不再是难题&#xff01; 想象一下&#xff0c;当您沉浸在一首动人的歌曲中&#xff0c;却希望更清晰地捕捉到歌手声音中的每一个微妙情感。 无论是经典老…

算能端侧 AI 盒子 Stable Diffusion 一秒一张图:AirBox BM1684X

本篇文章聊聊基于 端侧 AI 计算设备&#xff0c;20~30 瓦功耗运行大模型的算能 AirBox。 写在前面 去年的双十二的时候&#xff0c;在群里看到了一张照片&#xff0c;“手掌大小的 NUC”&#xff0c;但是能够跑大模型。 这个草就种下了。 今年 7 月初的时候&#xff0c;在上…

学习008-02-04-09 Assign a Standard Image(分配标准图像)

Assign a Standard Image&#xff08;分配标准图像&#xff09; This lesson explains how to associate an entity class with a standard image from the DevExpress.Images assembly. This image illustrates the entity class in the following sections of the UI: 本课介…

C# 知识点总结

入门 C#程序在.NET上运行&#xff0c;.NET framework包含两个部分&#xff1a; ①&#xff1a;.NET framework类库 ②&#xff1a;公共语言运行库CLR&#xff08;.NET虚拟机&#xff09; CLS&#xff08;公共语言规范&#xff09; CTS&#xff08;通用类型系统&#xff09; .N…

ubuntu20.04安装nginx,mysql8,php7.4详细教程,包成功

目录 1.更新索引 2.安装 Nginx 1.安装 Nginx&#xff1a; 2.启动 Nginx 服务并设置为开机自启&#xff1a; 3.开放防火墙的 80 端口&#xff1a; 4.检查 Nginx 是否正常运行&#xff1a; 3.安装 MySQL 8.0 1.首先&#xff0c;安装 MySQL 的仓库&#xff1a; 安装过程中你会看…

RewardBench:Evaluating Reward Models for Language Modeling

Leaderboard&#xff1a; https://hf.co/spaces/allenai/reward-bench Code&#xff1a; https://github.com/allenai/reward-bench Dataset&#xff1a; https://hf.co/datasets/allenai/reward-bench 在人类偏好的强化学习&#xff08;RLHF&#xff09;过程中&#xff0c;奖励…