增加课程资源管理,对应数据表train_resource
This commit is contained in:
1 parent
1162f26e7d
commit
abb042ff1a
8 files changed
+1051
No files matched your search
+93
@@ -0,0 +1,93 @@
|
||||
package com.ruoyi.web.controller.train;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.train.domain.TrainResource;
|
||||
import com.ruoyi.train.service.ITrainResourceService;
|
||||
|
||||
/**
|
||||
* 教学资源Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/train/resource")
|
||||
public class TrainResourceController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITrainResourceService trainResourceService;
|
||||
|
||||
/**
|
||||
* 查询教学资源列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('train:resource:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TrainResource trainResource)
|
||||
{
|
||||
startPage();
|
||||
List<TrainResource> list = trainResourceService.selectTrainResourceList(trainResource);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取教学资源详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('train:resource:list')")
|
||||
@GetMapping(value = "/{resourceId}")
|
||||
public AjaxResult getInfo(@PathVariable("resourceId") String resourceId)
|
||||
{
|
||||
return success(trainResourceService.selectTrainResourceByResourceId(resourceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增教学资源
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('train:resource:edit')")
|
||||
@Log(title = "教学资源", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody TrainResource trainResource)
|
||||
{
|
||||
trainResource.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(trainResourceService.insertTrainResource(trainResource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除教学资源 (RESTful DELETE /train/resource/{resourceIds})
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('train:resource:edit')")
|
||||
@Log(title = "教学资源", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{resourceIds}")
|
||||
public AjaxResult remove(@PathVariable String[] resourceIds)
|
||||
{
|
||||
return toAjax(trainResourceService.deleteTrainResourceByResourceIds(resourceIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改教学资源 (RESTful PUT /train/resource/{resourceId})
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('train:resource:edit')")
|
||||
@Log(title = "教学资源", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{resourceId}")
|
||||
public AjaxResult edit(@PathVariable("resourceId") String resourceId, @Validated @RequestBody TrainResource trainResource)
|
||||
{
|
||||
trainResource.setResourceId(resourceId);
|
||||
trainResource.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(trainResourceService.updateTrainResource(trainResource));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.ruoyi.train.domain;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 教学资源对象 train_resource
|
||||
*
|
||||
* <p>统一教学资源:文档、视频、3D模型、VR资源、外部教学链接、其他。
|
||||
* 该表被 train_course_resource、train_study_duration 外键引用,删除一律走逻辑删除。</p>
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class TrainResource extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 资源唯一ID */
|
||||
private String resourceId;
|
||||
|
||||
/** 资源名称 */
|
||||
@NotBlank(message = "资源名称不能为空")
|
||||
@Size(max = 150, message = "资源名称长度不能超过150个字符")
|
||||
@Excel(name = "资源名称")
|
||||
private String resourceName;
|
||||
|
||||
/** 资源类型 (1:文档, 2:视频, 3:3D模型, 4:VR资源, 5:外部教学链接, 6:其他) */
|
||||
@NotNull(message = "资源类型不能为空")
|
||||
@Min(value = 1, message = "资源类型取值必须为1-6")
|
||||
@Max(value = 6, message = "资源类型取值必须为1-6")
|
||||
@Excel(name = "资源类型", readConverterExp = "1=文档,2=视频,3=3D模型,4=VR资源,5=外部教学链接,6=其他")
|
||||
private Integer resourceType;
|
||||
|
||||
/** 资源存储地址/在线链接 */
|
||||
@NotBlank(message = "资源地址不能为空")
|
||||
@Size(max = 500, message = "资源地址长度不能超过500个字符")
|
||||
@Excel(name = "资源地址")
|
||||
private String resourceUrl;
|
||||
|
||||
/** 资源描述/使用说明 */
|
||||
@Size(max = 500, message = "资源描述长度不能超过500个字符")
|
||||
@Excel(name = "资源描述")
|
||||
private String description;
|
||||
|
||||
/** 状态 (1:正常, 0:停用) */
|
||||
@Min(value = 0, message = "状态取值必须为0或1")
|
||||
@Max(value = 1, message = "状态取值必须为0或1")
|
||||
@Excel(name = "状态", readConverterExp = "0=停用,1=正常")
|
||||
private Integer status;
|
||||
|
||||
/** 删除标志 (0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public void setResourceId(String resourceId)
|
||||
{
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
public String getResourceId()
|
||||
{
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
public void setResourceName(String resourceName)
|
||||
{
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
|
||||
public String getResourceName()
|
||||
{
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
public void setResourceType(Integer resourceType)
|
||||
{
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
|
||||
public Integer getResourceType()
|
||||
{
|
||||
return resourceType;
|
||||
}
|
||||
|
||||
public void setResourceUrl(String resourceUrl)
|
||||
{
|
||||
this.resourceUrl = resourceUrl;
|
||||
}
|
||||
|
||||
public String getResourceUrl()
|
||||
{
|
||||
return resourceUrl;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("resourceId", getResourceId())
|
||||
.append("resourceName", getResourceName())
|
||||
.append("resourceType", getResourceType())
|
||||
.append("resourceUrl", getResourceUrl())
|
||||
.append("description", getDescription())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.train.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.train.domain.TrainResource;
|
||||
|
||||
/**
|
||||
* 教学资源Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface TrainResourceMapper
|
||||
{
|
||||
/**
|
||||
* 查询教学资源
|
||||
*
|
||||
* @param resourceId 教学资源主键
|
||||
* @return 教学资源
|
||||
*/
|
||||
public TrainResource selectTrainResourceByResourceId(String resourceId);
|
||||
|
||||
/**
|
||||
* 查询教学资源列表
|
||||
*
|
||||
* @param trainResource 教学资源查询条件
|
||||
* @return 教学资源集合
|
||||
*/
|
||||
public List<TrainResource> selectTrainResourceList(TrainResource trainResource);
|
||||
|
||||
/**
|
||||
* 新增教学资源
|
||||
*
|
||||
* @param trainResource 教学资源
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTrainResource(TrainResource trainResource);
|
||||
|
||||
/**
|
||||
* 修改教学资源
|
||||
*
|
||||
* @param trainResource 教学资源
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTrainResource(TrainResource trainResource);
|
||||
|
||||
/**
|
||||
* 删除教学资源(逻辑删除)
|
||||
*
|
||||
* @param resourceId 教学资源主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTrainResourceByResourceId(String resourceId);
|
||||
|
||||
/**
|
||||
* 批量删除教学资源(逻辑删除)
|
||||
*
|
||||
* @param resourceIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTrainResourceByResourceIds(String[] resourceIds);
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.train.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.train.domain.TrainResource;
|
||||
|
||||
/**
|
||||
* 教学资源Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ITrainResourceService
|
||||
{
|
||||
/**
|
||||
* 查询教学资源
|
||||
*
|
||||
* @param resourceId 教学资源主键
|
||||
* @return 教学资源
|
||||
*/
|
||||
public TrainResource selectTrainResourceByResourceId(String resourceId);
|
||||
|
||||
/**
|
||||
* 查询教学资源列表
|
||||
*
|
||||
* @param trainResource 教学资源查询条件
|
||||
* @return 教学资源集合
|
||||
*/
|
||||
public List<TrainResource> selectTrainResourceList(TrainResource trainResource);
|
||||
|
||||
/**
|
||||
* 新增教学资源
|
||||
*
|
||||
* @param trainResource 教学资源
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTrainResource(TrainResource trainResource);
|
||||
|
||||
/**
|
||||
* 修改教学资源
|
||||
*
|
||||
* @param trainResource 教学资源
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTrainResource(TrainResource trainResource);
|
||||
|
||||
/**
|
||||
* 批量删除教学资源
|
||||
*
|
||||
* @param resourceIds 需要删除的教学资源主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTrainResourceByResourceIds(String[] resourceIds);
|
||||
|
||||
/**
|
||||
* 删除教学资源信息
|
||||
*
|
||||
* @param resourceId 教学资源主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTrainResourceByResourceId(String resourceId);
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
package com.ruoyi.train.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.train.domain.TrainResource;
|
||||
import com.ruoyi.train.mapper.TrainResourceMapper;
|
||||
import com.ruoyi.train.service.ITrainResourceService;
|
||||
|
||||
/**
|
||||
* 教学资源Service业务层处理
|
||||
*
|
||||
* <p>资源表被 train_course_resource、train_study_duration 外键引用,
|
||||
* 因此删除统一使用逻辑删除(del_flag = '2'),禁止物理删除。</p>
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class TrainResourceServiceImpl implements ITrainResourceService
|
||||
{
|
||||
@Autowired
|
||||
private TrainResourceMapper trainResourceMapper;
|
||||
|
||||
/**
|
||||
* 查询教学资源
|
||||
*
|
||||
* @param resourceId 教学资源主键
|
||||
* @return 教学资源
|
||||
*/
|
||||
@Override
|
||||
public TrainResource selectTrainResourceByResourceId(String resourceId)
|
||||
{
|
||||
return trainResourceMapper.selectTrainResourceByResourceId(resourceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询教学资源列表
|
||||
*
|
||||
* @param trainResource 教学资源查询条件
|
||||
* @return 教学资源集合
|
||||
*/
|
||||
@Override
|
||||
public List<TrainResource> selectTrainResourceList(TrainResource trainResource)
|
||||
{
|
||||
return trainResourceMapper.selectTrainResourceList(trainResource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增教学资源
|
||||
*
|
||||
* @param trainResource 教学资源
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTrainResource(TrainResource trainResource)
|
||||
{
|
||||
validateResourceType(trainResource.getResourceType());
|
||||
validateStatus(trainResource.getStatus());
|
||||
// 未指定主键时自动生成32位UUID,与 resource_id VARCHAR(32) 对齐
|
||||
if (StringUtils.isEmpty(trainResource.getResourceId()))
|
||||
{
|
||||
trainResource.setResourceId(IdUtils.fastSimpleUUID());
|
||||
}
|
||||
if (trainResource.getStatus() == null)
|
||||
{
|
||||
trainResource.setStatus(1); // 默认正常
|
||||
}
|
||||
trainResource.setDelFlag("0");
|
||||
trainResource.setCreateTime(DateUtils.getNowDate());
|
||||
return trainResourceMapper.insertTrainResource(trainResource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改教学资源
|
||||
*
|
||||
* @param trainResource 教学资源(必须携带 resourceId)
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTrainResource(TrainResource trainResource)
|
||||
{
|
||||
if (StringUtils.isEmpty(trainResource.getResourceId()))
|
||||
{
|
||||
throw new ServiceException("资源ID不能为空");
|
||||
}
|
||||
if (trainResource.getResourceType() != null)
|
||||
{
|
||||
validateResourceType(trainResource.getResourceType());
|
||||
}
|
||||
if (trainResource.getStatus() != null)
|
||||
{
|
||||
validateStatus(trainResource.getStatus());
|
||||
}
|
||||
trainResource.setUpdateTime(DateUtils.getNowDate());
|
||||
return trainResourceMapper.updateTrainResource(trainResource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除教学资源
|
||||
*
|
||||
* @param resourceIds 需要删除的教学资源主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTrainResourceByResourceIds(String[] resourceIds)
|
||||
{
|
||||
if (resourceIds == null || resourceIds.length == 0)
|
||||
{
|
||||
throw new ServiceException("请选择要删除的资源");
|
||||
}
|
||||
return trainResourceMapper.deleteTrainResourceByResourceIds(resourceIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除教学资源信息
|
||||
*
|
||||
* @param resourceId 教学资源主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTrainResourceByResourceId(String resourceId)
|
||||
{
|
||||
if (StringUtils.isEmpty(resourceId))
|
||||
{
|
||||
throw new ServiceException("资源ID不能为空");
|
||||
}
|
||||
return trainResourceMapper.deleteTrainResourceByResourceId(resourceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验资源类型取值:1文档 2视频 33D模型 4VR资源 5外部教学链接 6其他
|
||||
*/
|
||||
private void validateResourceType(Integer resourceType)
|
||||
{
|
||||
if (resourceType == null)
|
||||
{
|
||||
throw new ServiceException("资源类型不能为空");
|
||||
}
|
||||
if (resourceType < 1 || resourceType > 6)
|
||||
{
|
||||
throw new ServiceException("资源类型取值必须为1-6");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验状态取值:0停用 1正常
|
||||
*/
|
||||
private void validateStatus(Integer status)
|
||||
{
|
||||
if (status != null && status != 0 && status != 1)
|
||||
{
|
||||
throw new ServiceException("资源状态取值必须为0或1");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?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.train.mapper.TrainResourceMapper">
|
||||
|
||||
<resultMap type="TrainResource" id="TrainResourceResult">
|
||||
<result property="resourceId" column="resource_id" />
|
||||
<result property="resourceName" column="resource_name" />
|
||||
<result property="resourceType" column="resource_type" />
|
||||
<result property="resourceUrl" column="resource_url" />
|
||||
<result property="description" column="description" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTrainResourceVo">
|
||||
select resource_id, resource_name, resource_type, resource_url, description, status, del_flag, create_by, create_time, update_by, update_time, remark from train_resource
|
||||
</sql>
|
||||
|
||||
<select id="selectTrainResourceList" parameterType="TrainResource" resultMap="TrainResourceResult">
|
||||
<include refid="selectTrainResourceVo"/>
|
||||
where del_flag = '0'
|
||||
<if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if>
|
||||
<if test="resourceType != null"> and resource_type = #{resourceType}</if>
|
||||
<if test="resourceUrl != null and resourceUrl != ''"> and resource_url like concat('%', #{resourceUrl}, '%')</if>
|
||||
<if test="description != null and description != ''"> and description like concat('%', #{description}, '%')</if>
|
||||
<if test="status != null"> and status = #{status}</if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"> and create_time >= #{params.beginTime}</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"> and create_time <= #{params.endTime}</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectTrainResourceByResourceId" parameterType="String" resultMap="TrainResourceResult">
|
||||
<include refid="selectTrainResourceVo"/>
|
||||
where resource_id = #{resourceId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertTrainResource" parameterType="TrainResource">
|
||||
insert into train_resource
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="resourceId != null">resource_id,</if>
|
||||
<if test="resourceName != null and resourceName != ''">resource_name,</if>
|
||||
<if test="resourceType != null">resource_type,</if>
|
||||
<if test="resourceUrl != null and resourceUrl != ''">resource_url,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="resourceId != null">#{resourceId},</if>
|
||||
<if test="resourceName != null and resourceName != ''">#{resourceName},</if>
|
||||
<if test="resourceType != null">#{resourceType},</if>
|
||||
<if test="resourceUrl != null and resourceUrl != ''">#{resourceUrl},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTrainResource" parameterType="TrainResource">
|
||||
update train_resource
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="resourceName != null and resourceName != ''">resource_name = #{resourceName},</if>
|
||||
<if test="resourceType != null">resource_type = #{resourceType},</if>
|
||||
<if test="resourceUrl != null and resourceUrl != ''">resource_url = #{resourceUrl},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where resource_id = #{resourceId} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<update id="deleteTrainResourceByResourceId" parameterType="String">
|
||||
update train_resource set del_flag = '2' where resource_id = #{resourceId}
|
||||
</update>
|
||||
|
||||
<update id="deleteTrainResourceByResourceIds" parameterType="String">
|
||||
update train_resource set del_flag = '2' where resource_id in
|
||||
<foreach item="resourceId" collection="array" open="(" separator="," close=")">
|
||||
#{resourceId}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user