Procházet zdrojové kódy

学习资料代码提交

jingyuanchao před 2 roky
rodič
revize
28d8b14cca

+ 5 - 6
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/constant/Constants.java

@@ -2,11 +2,10 @@ package com.xunmei.common.core.constant;
 
 /**
  * 通用常量信息
- * 
+ *
  * @author xunmei
  */
-public class Constants
-{
+public class Constants {
     /**
      * UTF-8 字符集
      */
@@ -120,11 +119,11 @@ public class Constants
     /**
      * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
      */
-    public static final String[] JOB_WHITELIST_STR = { "com.xunmei" };
+    public static final String[] JOB_WHITELIST_STR = {"com.xunmei"};
 
     /**
      * 定时任务违规的字符
      */
-    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
-            "org.springframework", "org.apache", "com.xunmei.common.core.utils.file" };
+    public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
+            "org.springframework", "org.apache", "com.xunmei.common.core.utils.file"};
 }

+ 95 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysLearningMaterialsController.java

@@ -0,0 +1,95 @@
+package com.xunmei.system.controller;
+
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.xunmei.common.log.annotation.Log;
+import com.xunmei.common.log.enums.BusinessType;
+import com.xunmei.common.security.annotation.RequiresPermissions;
+import com.xunmei.system.domain.SysLearningMaterials;
+import com.xunmei.system.service.ISysLearningMaterialsService;
+import com.xunmei.common.core.web.controller.BaseController;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.web.page.TableDataInfo;
+
+/**
+ * 学习资料Controller
+ *
+ * @author xunmei
+ * @date 2023-08-21
+ */
+@Api(tags = {"SysLearningMaterials" })
+@RestController
+@RequestMapping("/materials")
+public class SysLearningMaterialsController extends BaseController {
+    @Autowired
+    private ISysLearningMaterialsService sysLearningMaterialsService;
+
+/**
+ * 查询学习资料列表
+ */
+@ApiOperation(value = "查询SysLearningMaterials列表")
+@RequiresPermissions("system:materials:list")
+@GetMapping("/list")
+    public TableDataInfo list(SysLearningMaterials sysLearningMaterials) {
+        return sysLearningMaterialsService.selectPage( sysLearningMaterials);
+    }
+
+
+
+    /**
+     * 获取学习资料详细信息
+     */
+    @ApiOperation(value = "获取SysLearningMaterials详细信息")
+    @RequiresPermissions("system:materials:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(sysLearningMaterialsService.selectSysLearningMaterialsById(id));
+    }
+
+    /**
+     * 新增学习资料
+     */
+    @ApiOperation(value = "新增SysLearningMaterials")
+    @RequiresPermissions("system:materials:add")
+    @Log(title = "学习资料" , businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysLearningMaterials sysLearningMaterials) {
+        return toAjax(sysLearningMaterialsService.insertSysLearningMaterials(sysLearningMaterials));
+    }
+
+    /**
+     * 修改学习资料
+     */
+    @ApiOperation(value = "修改SysLearningMaterials")
+    @RequiresPermissions("system:materials:edit")
+    @Log(title = "学习资料" , businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysLearningMaterials sysLearningMaterials) {
+        return toAjax(sysLearningMaterialsService.updateSysLearningMaterials(sysLearningMaterials));
+    }
+
+    /**
+     * 删除学习资料
+     */
+    @ApiOperation(value = "删除SysLearningMaterials")
+    @RequiresPermissions("system:materials:remove")
+    @Log(title = "学习资料" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(sysLearningMaterialsService.deleteSysLearningMaterialsByIds(ids));
+    }
+}

+ 107 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/domain/SysLearningMaterials.java

@@ -0,0 +1,107 @@
+package com.xunmei.system.domain;
+
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.xunmei.common.core.web.domain.BaseEntity;
+
+/**
+ * 学习资料对象 sys_learning_materials
+ *
+ * @author xunmei
+ * @date 2023-08-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sys_learning_materials")
+@ApiModel(value = "SysLearningMaterials对象", description = "学习资料")
+public class SysLearningMaterials extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    private Long id;
+
+    @ApiModelProperty(value = "资料标题")
+    private String title;
+
+    @ApiModelProperty(value = "资料内容")
+    private String content;
+
+    @JsonSerialize(using = com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
+    @ApiModelProperty(value = "资料类型(知识库标签)")
+    private Long knowledgeId;
+
+    @ApiModelProperty(value = "所属机构")
+    private Long orgId;
+
+    @ApiModelProperty(value = "机构名称")
+    private String orgName;
+
+    @ApiModelProperty(value = "机构path")
+    private String orgPath;
+
+    @ApiModelProperty(value = "是否公开,0:未公开,1:已公开")
+    private Integer isOpen;
+
+    @ApiModelProperty(value = "附件")
+    private String file;
+
+    @TableLogic(value = "0", delval = "1")
+    @ApiModelProperty(value = "是否删除,0:未删除,1:已删除")
+    private Integer deleted;
+
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+
+
+                .append("id", getId())
+
+
+                .append("title", getTitle())
+
+
+                .append("knowledgeId", getKnowledgeId())
+
+
+                .append("orgId", getOrgId())
+
+
+                .append("orgName", getOrgName())
+
+
+                .append("orgPath", getOrgPath())
+
+
+                .append("isOpen", getIsOpen())
+
+
+                .append("file", getFile())
+
+
+                .append("deleted", getDeleted())
+
+
+                .append("createBy", getCreateBy())
+
+
+                .append("createTime", getCreateTime())
+
+
+                .append("updateBy", getUpdateBy())
+
+
+                .append("updateTime", getUpdateTime())
+                .toString();
+    }
+}

+ 62 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysLearningMaterialsMapper.java

@@ -0,0 +1,62 @@
+package com.xunmei.system.mapper;
+
+import java.util.List;
+
+import com.xunmei.system.domain.SysLearningMaterials;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 学习资料Mapper接口
+ *
+ * @author xunmei
+ * @date 2023-08-21
+ */
+public interface SysLearningMaterialsMapper extends BaseMapper<SysLearningMaterials> {
+    /**
+     * 查询学习资料
+     *
+     * @param id 学习资料主键
+     * @return 学习资料
+     */
+    public SysLearningMaterials selectSysLearningMaterialsById(Long id);
+
+    /**
+     * 查询学习资料列表
+     *
+     * @param sysLearningMaterials 学习资料
+     * @return 学习资料集合
+     */
+    public List<SysLearningMaterials> selectSysLearningMaterialsList(SysLearningMaterials sysLearningMaterials);
+
+    /**
+     * 新增学习资料
+     *
+     * @param sysLearningMaterials 学习资料
+     * @return 结果
+     */
+    public int insertSysLearningMaterials(SysLearningMaterials sysLearningMaterials);
+
+    /**
+     * 修改学习资料
+     *
+     * @param sysLearningMaterials 学习资料
+     * @return 结果
+     */
+    public int updateSysLearningMaterials(SysLearningMaterials sysLearningMaterials);
+
+    /**
+     * 删除学习资料
+     *
+     * @param id 学习资料主键
+     * @return 结果
+     */
+    public int deleteSysLearningMaterialsById(Long id);
+
+    /**
+     * 批量删除学习资料
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteSysLearningMaterialsByIds(Long[] ids);
+}

+ 72 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysLearningMaterialsService.java

@@ -0,0 +1,72 @@
+package com.xunmei.system.service;
+
+import java.util.List;
+
+import com.xunmei.system.domain.SysLearningMaterials;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.web.page.TableDataInfo;
+
+/**
+ * 学习资料Service接口
+ *
+ * @author xunmei
+ * @date 2023-08-21
+ */
+public interface ISysLearningMaterialsService extends IService<SysLearningMaterials> {
+    /**
+     * 查询学习资料
+     *
+     * @param id 学习资料主键
+     * @return 学习资料
+     */
+    public SysLearningMaterials selectSysLearningMaterialsById(Long id);
+
+    /**
+     * 查询学习资料列表
+     *
+     * @param sysLearningMaterials 学习资料
+     * @return 学习资料集合
+     */
+    public List<SysLearningMaterials> selectSysLearningMaterialsList(SysLearningMaterials sysLearningMaterials);
+
+    /**
+     * 新增学习资料
+     *
+     * @param sysLearningMaterials 学习资料
+     * @return 结果
+     */
+    public int insertSysLearningMaterials(SysLearningMaterials sysLearningMaterials);
+
+    /**
+     * 修改学习资料
+     *
+     * @param sysLearningMaterials 学习资料
+     * @return 结果
+     */
+    public int updateSysLearningMaterials(SysLearningMaterials sysLearningMaterials);
+
+    /**
+     * 批量删除学习资料
+     *
+     * @param ids 需要删除的学习资料主键集合
+     * @return 结果
+     */
+    public int deleteSysLearningMaterialsByIds(Long[] ids);
+
+    /**
+     * 删除学习资料信息
+     *
+     * @param id 学习资料主键
+     * @return 结果
+     */
+    public int deleteSysLearningMaterialsById(Long id);
+
+    /**
+     * 查询学习资料分页数据
+     *
+     * @param sysLearningMaterials 查询条件对象
+     * @return Page
+     */
+    public TableDataInfo selectPage(SysLearningMaterials sysLearningMaterials);
+}

+ 2 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgService.java

@@ -68,4 +68,6 @@ public interface ISysOrgService extends IService<SysOrg> {
      * @return Page
      */
     TableDataInfo selectPage(SysOrg sysOrg);
+
+    String selectPathById(Long orgId);
 }

+ 136 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysLearningMaterialsServiceImpl.java

@@ -0,0 +1,136 @@
+package com.xunmei.system.service.impl;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.xunmei.common.core.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.xunmei.system.service.ISysOrgService;
+
+import java.util.Arrays;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.system.mapper.SysLearningMaterialsMapper;
+import com.xunmei.system.domain.SysLearningMaterials;
+import com.xunmei.system.service.ISysLearningMaterialsService;
+
+/**
+ * 学习资料Service业务层处理
+ *
+ * @author xunmei
+ * @date 2023-08-21
+ */
+@Service
+public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMaterialsMapper, SysLearningMaterials> implements ISysLearningMaterialsService {
+    @Autowired
+    private SysLearningMaterialsMapper sysLearningMaterialsMapper;
+    @Autowired
+    private ISysOrgService orgService;
+
+    @Override
+    public TableDataInfo selectPage(SysLearningMaterials sysLearningMaterials) {
+        //未删除
+        sysLearningMaterials.setDeleted(0);
+        Page<SysLearningMaterials> page;
+        //分页
+        if (sysLearningMaterials.getPageNum() != null && sysLearningMaterials.getPageSize() != null) {
+            page = new Page<>(sysLearningMaterials.getPageNum(), sysLearningMaterials.getPageSize());
+        } else {
+            page = new Page<>();
+        }
+        //查询条件
+        LambdaQueryWrapper<SysLearningMaterials> query = new LambdaQueryWrapper<SysLearningMaterials>(sysLearningMaterials);
+        //下穿
+        if (sysLearningMaterials.getCheckSub()) {
+            String orgPath = orgService.selectPathById(sysLearningMaterials.getOrgId());
+            sysLearningMaterials.setOrgId(null);
+            query.likeRight(SysLearningMaterials::getOrgPath, orgPath);
+        }
+        //时间范围查询
+        if (sysLearningMaterials.getParams().get("beginTime") != null && sysLearningMaterials.getParams().get("endTime") != null) {
+            query.between(SysLearningMaterials::getCreateTime, sysLearningMaterials.getParams().get("beginTime"), sysLearningMaterials.getParams().get("endTime"));
+        }
+        //获取数据
+        page = sysLearningMaterialsMapper.selectPage(page, query);
+        //抓换为TableDataInfo适配前端
+        TableDataInfo tableDataInfo = new TableDataInfo();
+        tableDataInfo.setMsg("操作成功");
+        tableDataInfo.setCode(200);
+        tableDataInfo.setTotal(page.getTotal());
+        tableDataInfo.setRows(page.getRecords());
+        return tableDataInfo;
+    }
+
+
+    /**
+     * 查询学习资料
+     *
+     * @param id 学习资料主键
+     * @return 学习资料
+     */
+    @Override
+    public SysLearningMaterials selectSysLearningMaterialsById(Long id) {
+        return sysLearningMaterialsMapper.selectById(id);
+    }
+
+    /**
+     * 查询学习资料列表
+     *
+     * @param sysLearningMaterials 学习资料
+     * @return 学习资料
+     */
+    @Override
+    public List<SysLearningMaterials> selectSysLearningMaterialsList(SysLearningMaterials sysLearningMaterials) {
+        return sysLearningMaterialsMapper.selectList(new QueryWrapper<>(sysLearningMaterials));
+    }
+
+    /**
+     * 新增学习资料
+     *
+     * @param sysLearningMaterials 学习资料
+     * @return 结果
+     */
+    @Override
+    public int insertSysLearningMaterials(SysLearningMaterials sysLearningMaterials) {
+        sysLearningMaterials.setCreateTime(DateUtils.getNowDate());
+        return sysLearningMaterialsMapper.insert(sysLearningMaterials);
+    }
+
+    /**
+     * 修改学习资料
+     *
+     * @param sysLearningMaterials 学习资料
+     * @return 结果
+     */
+    @Override
+    public int updateSysLearningMaterials(SysLearningMaterials sysLearningMaterials) {
+        sysLearningMaterials.setUpdateTime(DateUtils.getNowDate());
+        return sysLearningMaterialsMapper.updateById(sysLearningMaterials);
+    }
+
+    /**
+     * 批量删除学习资料
+     *
+     * @param ids 需要删除的学习资料主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysLearningMaterialsByIds(Long[] ids) {
+        return sysLearningMaterialsMapper.deleteBatchIds(Arrays.asList((ids)));
+    }
+
+    /**
+     * 删除学习资料信息
+     *
+     * @param id 学习资料主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysLearningMaterialsById(Long id) {
+        return sysLearningMaterialsMapper.deleteById(id);
+    }
+}

+ 25 - 11
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java

@@ -1,7 +1,9 @@
 package com.xunmei.system.service.impl;
 
 import java.util.List;
-        import com.xunmei.common.core.utils.DateUtils;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.xunmei.common.core.utils.DateUtils;
 import com.xunmei.common.core.utils.StringUtils;
 import com.xunmei.system.api.domain.SysDept;
 import com.xunmei.system.api.domain.SysOrg;
@@ -32,27 +34,26 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
         org.setDeleted(0L);
         Page<SysOrg> page;
         //分页
-        if (org.getPageNum()!=null&&org.getPageSize()!=null)
-        {
+        if (org.getPageNum() != null && org.getPageSize() != null) {
             page = new Page<>(org.getPageNum(), org.getPageSize());
-        }else{
+        } else {
             page = new Page<>();
         }
         //查询条件
         QueryWrapper<SysOrg> query = new QueryWrapper<>(org);
         //下穿
-        if (org.getCheckSub()){
+        if (org.getCheckSub()) {
             List<Long> ids = this.selectCheckSubOrgIdList(org.getParentId());
             //清空前端传递的org_id
             org.setParentId(null);
             //添加in条件
-            query.in("id",ids);
+            query.in("id", ids);
 
         }
 
         //模糊查询
-        if (StringUtils.isNotNull(org.getName())){
-            query.like("name",org.getName());
+        if (StringUtils.isNotNull(org.getName())) {
+            query.like("name", org.getName());
             org.setName(null);
         }
         //获取数据
@@ -66,6 +67,7 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
         return tableDataInfo;
 
     }
+
     @Override
     public List<Long> selectCheckSubOrgIdList(Long orgId) {
         return sysOrgMapper.selectCheckSubOrgIdList(orgId);
@@ -101,8 +103,8 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
      */
     @Override
     public int insertSysOrg(SysOrg sysOrg) {
-                sysOrg.setCreateTime(DateUtils.getNowDate());
-            return sysOrgMapper.insertSysOrg(sysOrg);
+        sysOrg.setCreateTime(DateUtils.getNowDate());
+        return sysOrgMapper.insertSysOrg(sysOrg);
     }
 
     /**
@@ -113,7 +115,7 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
      */
     @Override
     public int updateSysOrg(SysOrg sysOrg) {
-                sysOrg.setUpdateTime(DateUtils.getNowDate());
+        sysOrg.setUpdateTime(DateUtils.getNowDate());
         return sysOrgMapper.updateSysOrg(sysOrg);
     }
 
@@ -138,4 +140,16 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
     public int deleteSysOrgById(Long id) {
         return sysOrgMapper.deleteSysOrgById(id);
     }
+
+    @Override
+    public String selectPathById(Long orgId) {
+        LambdaQueryWrapper<SysOrg> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(SysOrg::getId, orgId);
+        wrapper.select(SysOrg::getPath);
+        SysOrg sysOrg = sysOrgMapper.selectOne(wrapper);
+        if (sysOrg != null) {
+            return sysOrg.getPath();
+        }
+        throw new RuntimeException("未找到机构信息");
+    }
 }

+ 215 - 0
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysLearningMaterialsMapper.xml

@@ -0,0 +1,215 @@
+<?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.xunmei.system.mapper.SysLearningMaterialsMapper">
+
+    <resultMap type="com.xunmei.system.domain.SysLearningMaterials" id="SysLearningMaterialsResult">
+        <result property="id" column="id"/>
+        <result property="title" column="title"/>
+        <result property="content" column="content"/>
+        <result property="knowledgeId" column="knowledge_id"/>
+        <result property="orgId" column="org_id"/>
+        <result property="orgName" column="org_name"/>
+        <result property="orgPath" column="org_path"/>
+        <result property="isOpen" column="is_open"/>
+        <result property="file" column="file"/>
+        <result property="deleted" column="deleted"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="updateTime"/>
+    </resultMap>
+
+    <sql id="selectSysLearningMaterialsVo">
+        select id,
+               title,
+               content,
+               knowledge_id,
+               org_id,
+               org_name,
+               org_path,
+               is_open,
+               file,
+               remark,
+               deleted,
+               create_by,
+               create_time,
+               update_by,
+               updateTime
+        from sys_learning_materials
+    </sql>
+
+    <select id="selectSysLearningMaterialsList" parameterType="com.xunmei.system.domain.SysLearningMaterials"
+            resultMap="SysLearningMaterialsResult">
+        <include refid="selectSysLearningMaterialsVo"/>
+        <where>
+            <if test="title != null  and title != ''">
+                and title like concat('%', #{title}, '%')
+            </if>
+            <if test="content != null  and content != ''">
+                and title like concat('%', #{title}, '%')
+            </if>
+            <if test="knowledgeId != null ">
+                and knowledge_id = #{knowledgeId}
+            </if>
+            <if test="orgId != null ">
+                and org_id = #{orgId}
+            </if>
+            <if test="orgName != null  and orgName != ''">
+                and org_name like concat('%', #{orgName}, '%')
+            </if>
+            <if test="orgPath != null  and orgPath != ''">
+                and org_path = #{orgPath}
+            </if>
+            <if test="isOpen != null ">
+                and is_open = #{isOpen}
+            </if>
+            <if test="file != null  and file != ''">
+                and file = #{file}
+            </if>
+            <if test="deleted != null ">
+                and deleted = #{deleted}
+            </if>
+            <if test="updateTime != null ">
+                and updateTime = #{updateTime}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectSysLearningMaterialsById" parameterType="Long"
+            resultMap="SysLearningMaterialsResult">
+        <include refid="selectSysLearningMaterialsVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertSysLearningMaterials" parameterType="com.xunmei.system.domain.SysLearningMaterials">
+        insert into sys_learning_materials
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,
+            </if>
+            <if test="title != null">title,
+            </if>
+            <if test="content != null">content,
+            </if>
+            <if test="knowledgeId != null">knowledge_id,
+            </if>
+            <if test="orgId != null">org_id,
+            </if>
+            <if test="orgName != null">org_name,
+            </if>
+            <if test="orgPath != null">org_path,
+            </if>
+            <if test="isOpen != null">is_open,
+            </if>
+            <if test="file != null">file,
+            </if>
+            <if test="remark != null">remark,
+            </if>
+            <if test="deleted != null">deleted,
+            </if>
+            <if test="createBy != null">create_by,
+            </if>
+            <if test="createTime != null">create_time,
+            </if>
+            <if test="updateBy != null">update_by,
+            </if>
+            <if test="updateTime != null">updateTime,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},
+            </if>
+            <if test="title != null">#{title},
+            </if>
+            <if test="content != null">#{content},
+            </if>
+            <if test="knowledgeId != null">#{knowledgeId},
+            </if>
+            <if test="orgId != null">#{orgId},
+            </if>
+            <if test="orgName != null">#{orgName},
+            </if>
+            <if test="orgPath != null">#{orgPath},
+            </if>
+            <if test="isOpen != null">#{isOpen},
+            </if>
+            <if test="file != null">#{file},
+            </if>
+            <if test="remark != null">#{remark},
+            </if>
+            <if test="deleted != null">#{deleted},
+            </if>
+            <if test="createBy != null">#{createBy},
+            </if>
+            <if test="createTime != null">#{createTime},
+            </if>
+            <if test="updateBy != null">#{updateBy},
+            </if>
+            <if test="updateTime != null">#{updateTime},
+            </if>
+        </trim>
+    </insert>
+
+    <update id="updateSysLearningMaterials" parameterType="com.xunmei.system.domain.SysLearningMaterials">
+        update sys_learning_materials
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="title != null">title =
+                #{title},
+            </if>
+            <if test="content != null">content =
+                #{content},
+            </if>
+            <if test="knowledgeId != null">knowledge_id =
+                #{knowledgeId},
+            </if>
+            <if test="orgId != null">org_id =
+                #{orgId},
+            </if>
+            <if test="orgName != null">org_name =
+                #{orgName},
+            </if>
+            <if test="orgPath != null">org_path =
+                #{orgPath},
+            </if>
+            <if test="isOpen != null">is_open =
+                #{isOpen},
+            </if>
+            <if test="file != null">file =
+                #{file},
+            </if>
+            <if test="remark != null">remark =
+                #{remark},
+            </if>
+            <if test="deleted != null">deleted =
+                #{deleted},
+            </if>
+            <if test="createBy != null">create_by =
+                #{createBy},
+            </if>
+            <if test="createTime != null">create_time =
+                #{createTime},
+            </if>
+            <if test="updateBy != null">update_by =
+                #{updateBy},
+            </if>
+            <if test="updateTime != null">updateTime =
+                #{updateTime},
+            </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteSysLearningMaterialsById" parameterType="Long">
+        delete
+        from sys_learning_materials
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteSysLearningMaterialsByIds" parameterType="String">
+        delete from sys_learning_materials where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>