소스 검색

新增学习记录表

lamphua 1 개월 전
부모
커밋
e0dcf01123

+ 97
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcStudyController.java 파일 보기

@@ -0,0 +1,97 @@
1
+package com.ruoyi.web.controller.oa;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.web.bind.annotation.GetMapping;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.PutMapping;
9
+import org.springframework.web.bind.annotation.DeleteMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import com.ruoyi.common.annotation.Log;
15
+import com.ruoyi.common.core.controller.BaseController;
16
+import com.ruoyi.common.core.domain.AjaxResult;
17
+import com.ruoyi.common.enums.BusinessType;
18
+import com.ruoyi.oa.domain.CmcStudy;
19
+import com.ruoyi.oa.service.ICmcStudyService;
20
+import com.ruoyi.common.utils.poi.ExcelUtil;
21
+import com.ruoyi.common.core.page.TableDataInfo;
22
+
23
+/**
24
+ * 学习记录Controller
25
+ * 
26
+ * @author cmc
27
+ * @date 2025-03-06
28
+ */
29
+@RestController
30
+@RequestMapping("/oa/study")
31
+public class CmcStudyController extends BaseController
32
+{
33
+    @Autowired
34
+    private ICmcStudyService cmcStudyService;
35
+
36
+    /**
37
+     * 查询学习记录列表
38
+     */
39
+    @GetMapping("/list")
40
+    public TableDataInfo list(CmcStudy cmcStudy)
41
+    {
42
+        startPage();
43
+        List<CmcStudy> list = cmcStudyService.selectCmcStudyList(cmcStudy);
44
+        return getDataTable(list);
45
+    }
46
+
47
+    /**
48
+     * 导出学习记录列表
49
+     */
50
+    @Log(title = "学习记录", businessType = BusinessType.EXPORT)
51
+    @PostMapping("/export")
52
+    public void export(HttpServletResponse response, CmcStudy cmcStudy)
53
+    {
54
+        List<CmcStudy> list = cmcStudyService.selectCmcStudyList(cmcStudy);
55
+        ExcelUtil<CmcStudy> util = new ExcelUtil<CmcStudy>(CmcStudy.class);
56
+        util.exportExcel(response, list, "学习记录数据");
57
+    }
58
+
59
+    /**
60
+     * 获取学习记录详细信息
61
+     */
62
+    @GetMapping(value = "/{studyId}")
63
+    public AjaxResult getInfo(@PathVariable("studyId") Integer studyId)
64
+    {
65
+        return success(cmcStudyService.selectCmcStudyByStudyId(studyId));
66
+    }
67
+
68
+    /**
69
+     * 新增学习记录
70
+     */
71
+    @Log(title = "学习记录", businessType = BusinessType.INSERT)
72
+    @PostMapping
73
+    public AjaxResult add(@RequestBody CmcStudy cmcStudy)
74
+    {
75
+        return toAjax(cmcStudyService.insertCmcStudy(cmcStudy));
76
+    }
77
+
78
+    /**
79
+     * 修改学习记录
80
+     */
81
+    @Log(title = "学习记录", businessType = BusinessType.UPDATE)
82
+    @PutMapping
83
+    public AjaxResult edit(@RequestBody CmcStudy cmcStudy)
84
+    {
85
+        return toAjax(cmcStudyService.updateCmcStudy(cmcStudy));
86
+    }
87
+
88
+    /**
89
+     * 删除学习记录
90
+     */
91
+    @Log(title = "学习记录", businessType = BusinessType.DELETE)
92
+	@DeleteMapping("/{studyIds}")
93
+    public AjaxResult remove(@PathVariable Integer[] studyIds)
94
+    {
95
+        return toAjax(cmcStudyService.deleteCmcStudyByStudyIds(studyIds));
96
+    }
97
+}

+ 151
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcStudy.java 파일 보기

@@ -0,0 +1,151 @@
1
+package com.ruoyi.oa.domain;
2
+
3
+import java.util.Date;
4
+import com.fasterxml.jackson.annotation.JsonFormat;
5
+import com.ruoyi.common.core.domain.entity.SysDept;
6
+import com.ruoyi.common.core.domain.entity.SysUser;
7
+import org.apache.commons.lang3.builder.ToStringBuilder;
8
+import org.apache.commons.lang3.builder.ToStringStyle;
9
+import com.ruoyi.common.annotation.Excel;
10
+import com.ruoyi.common.core.domain.BaseEntity;
11
+
12
+/**
13
+ * 学习记录对象 cmc_study
14
+ * 
15
+ * @author cmc
16
+ * @date 2025-03-06
17
+ */
18
+public class CmcStudy extends BaseEntity
19
+{
20
+    private static final long serialVersionUID = 1L;
21
+
22
+    /** 学习id */
23
+    private Integer studyId;
24
+
25
+    /** 学习资料id */
26
+    private Integer resourceId;
27
+    @Excel(name = "学习资料标题")
28
+    private String title;
29
+    private CmcResource resource;
30
+
31
+    /** 用户id */
32
+    private Long userId;
33
+    @Excel(name = "姓名")
34
+    private String nickName;
35
+    private SysUser user;
36
+
37
+    /** 部门 */
38
+    @Excel(name = "部门")
39
+    private String deptName;
40
+    private SysDept dept;
41
+
42
+    /** 上次位置(视频文本百分比) */
43
+    @Excel(name = "上次位置", readConverterExp = "视=频文本百分比")
44
+    private String lastPoint;
45
+
46
+    /** 上次时间 */
47
+    @JsonFormat(pattern = "yyyy-MM-dd")
48
+    @Excel(name = "上次时间", width = 30, dateFormat = "yyyy-MM-dd")
49
+    private Date lastTime;
50
+
51
+    /** 可获学时 */
52
+    @Excel(name = "可获学时")
53
+    private Double getHours;
54
+
55
+    public void setStudyId(Integer studyId) 
56
+    {
57
+        this.studyId = studyId;
58
+    }
59
+
60
+    public Integer getStudyId() 
61
+    {
62
+        return studyId;
63
+    }
64
+    public void setResourceId(Integer resourceId) 
65
+    {
66
+        this.resourceId = resourceId;
67
+    }
68
+
69
+    public Integer getResourceId() 
70
+    {
71
+        return resourceId;
72
+    }
73
+    public void setUserId(Long userId) 
74
+    {
75
+        this.userId = userId;
76
+    }
77
+
78
+    public Long getUserId() 
79
+    {
80
+        return userId;
81
+    }
82
+    public void setLastPoint(String lastPoint) 
83
+    {
84
+        this.lastPoint = lastPoint;
85
+    }
86
+
87
+    public String getLastPoint() 
88
+    {
89
+        return lastPoint;
90
+    }
91
+    public void setLastTime(Date lastTime) 
92
+    {
93
+        this.lastTime = lastTime;
94
+    }
95
+
96
+    public Date getLastTime() 
97
+    {
98
+        return lastTime;
99
+    }
100
+    public void setGetHours(Double getHours) 
101
+    {
102
+        this.getHours = getHours;
103
+    }
104
+
105
+    public Double getGetHours() 
106
+    {
107
+        return getHours;
108
+    }
109
+    public void setResource(CmcResource resource)
110
+    {
111
+        this.resource = resource;
112
+        this.title = resource == null ? "" : resource.getTitle();
113
+    }
114
+
115
+    public CmcResource getResource()
116
+    {
117
+        return resource;
118
+    }
119
+    public void setUser(SysUser user)
120
+    {
121
+        this.user = user;
122
+        this.nickName = user == null ? "" : user.getNickName();
123
+    }
124
+
125
+    public SysUser getUser()
126
+    {
127
+        return user;
128
+    }
129
+    public void setDept(SysDept dept)
130
+    {
131
+        this.dept = dept;
132
+        this.deptName = dept == null ? "" : dept.getDeptName();
133
+    }
134
+
135
+    public SysDept getDept()
136
+    {
137
+        return dept;
138
+    }
139
+
140
+    @Override
141
+    public String toString() {
142
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
143
+            .append("studyId", getStudyId())
144
+            .append("resourceId", getResourceId())
145
+            .append("userId", getUserId())
146
+            .append("lastPoint", getLastPoint())
147
+            .append("lastTime", getLastTime())
148
+            .append("getHours", getGetHours())
149
+            .toString();
150
+    }
151
+}

+ 61
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/mapper/CmcStudyMapper.java 파일 보기

@@ -0,0 +1,61 @@
1
+package com.ruoyi.oa.mapper;
2
+
3
+import java.util.List;
4
+import com.ruoyi.oa.domain.CmcStudy;
5
+
6
+/**
7
+ * 学习记录Mapper接口
8
+ * 
9
+ * @author cmc
10
+ * @date 2025-03-06
11
+ */
12
+public interface CmcStudyMapper 
13
+{
14
+    /**
15
+     * 查询学习记录
16
+     * 
17
+     * @param studyId 学习记录主键
18
+     * @return 学习记录
19
+     */
20
+    public CmcStudy selectCmcStudyByStudyId(Integer studyId);
21
+
22
+    /**
23
+     * 查询学习记录列表
24
+     * 
25
+     * @param cmcStudy 学习记录
26
+     * @return 学习记录集合
27
+     */
28
+    public List<CmcStudy> selectCmcStudyList(CmcStudy cmcStudy);
29
+
30
+    /**
31
+     * 新增学习记录
32
+     * 
33
+     * @param cmcStudy 学习记录
34
+     * @return 结果
35
+     */
36
+    public int insertCmcStudy(CmcStudy cmcStudy);
37
+
38
+    /**
39
+     * 修改学习记录
40
+     * 
41
+     * @param cmcStudy 学习记录
42
+     * @return 结果
43
+     */
44
+    public int updateCmcStudy(CmcStudy cmcStudy);
45
+
46
+    /**
47
+     * 删除学习记录
48
+     * 
49
+     * @param studyId 学习记录主键
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcStudyByStudyId(Integer studyId);
53
+
54
+    /**
55
+     * 批量删除学习记录
56
+     * 
57
+     * @param studyIds 需要删除的数据主键集合
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcStudyByStudyIds(Integer[] studyIds);
61
+}

+ 61
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/ICmcStudyService.java 파일 보기

@@ -0,0 +1,61 @@
1
+package com.ruoyi.oa.service;
2
+
3
+import java.util.List;
4
+import com.ruoyi.oa.domain.CmcStudy;
5
+
6
+/**
7
+ * 学习记录Service接口
8
+ * 
9
+ * @author cmc
10
+ * @date 2025-03-06
11
+ */
12
+public interface ICmcStudyService 
13
+{
14
+    /**
15
+     * 查询学习记录
16
+     * 
17
+     * @param studyId 学习记录主键
18
+     * @return 学习记录
19
+     */
20
+    public CmcStudy selectCmcStudyByStudyId(Integer studyId);
21
+
22
+    /**
23
+     * 查询学习记录列表
24
+     * 
25
+     * @param cmcStudy 学习记录
26
+     * @return 学习记录集合
27
+     */
28
+    public List<CmcStudy> selectCmcStudyList(CmcStudy cmcStudy);
29
+
30
+    /**
31
+     * 新增学习记录
32
+     * 
33
+     * @param cmcStudy 学习记录
34
+     * @return 结果
35
+     */
36
+    public int insertCmcStudy(CmcStudy cmcStudy);
37
+
38
+    /**
39
+     * 修改学习记录
40
+     * 
41
+     * @param cmcStudy 学习记录
42
+     * @return 结果
43
+     */
44
+    public int updateCmcStudy(CmcStudy cmcStudy);
45
+
46
+    /**
47
+     * 批量删除学习记录
48
+     * 
49
+     * @param studyIds 需要删除的学习记录主键集合
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcStudyByStudyIds(Integer[] studyIds);
53
+
54
+    /**
55
+     * 删除学习记录信息
56
+     * 
57
+     * @param studyId 学习记录主键
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcStudyByStudyId(Integer studyId);
61
+}

+ 93
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/impl/CmcStudyServiceImpl.java 파일 보기

@@ -0,0 +1,93 @@
1
+package com.ruoyi.oa.service.impl;
2
+
3
+import java.util.List;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.stereotype.Service;
6
+import com.ruoyi.oa.mapper.CmcStudyMapper;
7
+import com.ruoyi.oa.domain.CmcStudy;
8
+import com.ruoyi.oa.service.ICmcStudyService;
9
+
10
+/**
11
+ * 学习记录Service业务层处理
12
+ * 
13
+ * @author cmc
14
+ * @date 2025-03-06
15
+ */
16
+@Service
17
+public class CmcStudyServiceImpl implements ICmcStudyService 
18
+{
19
+    @Autowired
20
+    private CmcStudyMapper cmcStudyMapper;
21
+
22
+    /**
23
+     * 查询学习记录
24
+     * 
25
+     * @param studyId 学习记录主键
26
+     * @return 学习记录
27
+     */
28
+    @Override
29
+    public CmcStudy selectCmcStudyByStudyId(Integer studyId)
30
+    {
31
+        return cmcStudyMapper.selectCmcStudyByStudyId(studyId);
32
+    }
33
+
34
+    /**
35
+     * 查询学习记录列表
36
+     * 
37
+     * @param cmcStudy 学习记录
38
+     * @return 学习记录
39
+     */
40
+    @Override
41
+    public List<CmcStudy> selectCmcStudyList(CmcStudy cmcStudy)
42
+    {
43
+        return cmcStudyMapper.selectCmcStudyList(cmcStudy);
44
+    }
45
+
46
+    /**
47
+     * 新增学习记录
48
+     * 
49
+     * @param cmcStudy 学习记录
50
+     * @return 结果
51
+     */
52
+    @Override
53
+    public int insertCmcStudy(CmcStudy cmcStudy)
54
+    {
55
+        return cmcStudyMapper.insertCmcStudy(cmcStudy);
56
+    }
57
+
58
+    /**
59
+     * 修改学习记录
60
+     * 
61
+     * @param cmcStudy 学习记录
62
+     * @return 结果
63
+     */
64
+    @Override
65
+    public int updateCmcStudy(CmcStudy cmcStudy)
66
+    {
67
+        return cmcStudyMapper.updateCmcStudy(cmcStudy);
68
+    }
69
+
70
+    /**
71
+     * 批量删除学习记录
72
+     * 
73
+     * @param studyIds 需要删除的学习记录主键
74
+     * @return 结果
75
+     */
76
+    @Override
77
+    public int deleteCmcStudyByStudyIds(Integer[] studyIds)
78
+    {
79
+        return cmcStudyMapper.deleteCmcStudyByStudyIds(studyIds);
80
+    }
81
+
82
+    /**
83
+     * 删除学习记录信息
84
+     * 
85
+     * @param studyId 学习记录主键
86
+     * @return 结果
87
+     */
88
+    @Override
89
+    public int deleteCmcStudyByStudyId(Integer studyId)
90
+    {
91
+        return cmcStudyMapper.deleteCmcStudyByStudyId(studyId);
92
+    }
93
+}

+ 1
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcSettleMapper.xml 파일 보기

@@ -132,7 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
132 132
             <if test="projectNumber != null  and projectNumber != ''"> and p.project_number like concat('%', #{projectNumber}, '%')</if>
133 133
             <if test="undertakingDept != null  and undertakingDept != ''"> and find_in_set(#{undertakingDept}, p.undertaking_dept)</if>
134 134
             <if test="reportDept != null  and reportDept != ''"> and s.report_dept = #{reportDept}</if>
135
-            <if test="xmName != null"> and s.xm_name = #{xmName}</if>
135
+            <if test="xmName != null"> and s.xm_name like concat('%', #{xmName}, '%')</if>
136 136
             <if test="workloadReport != null  and workloadReport != ''"> and s.workload_report = #{workloadReport}</if>
137 137
             <if test="reporter != null "> and s.reporter = #{reporter}</if>
138 138
             <if test="reportTime != null "> and s.report_time = #{reportTime}</if>

+ 97
- 0
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcStudyMapper.xml 파일 보기

@@ -0,0 +1,97 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.ruoyi.oa.mapper.CmcStudyMapper">
6
+    
7
+    <resultMap type="CmcStudy" id="CmcStudyResult">
8
+        <result property="studyId"    column="study_id"    />
9
+        <result property="resourceId"    column="resource_id"    />
10
+        <result property="userId"    column="user_id"    />
11
+        <result property="lastPoint"    column="last_point"    />
12
+        <result property="lastTime"    column="last_time"    />
13
+        <result property="getHours"    column="get_hours"    />
14
+        <association property="user"    javaType="SysUser"         resultMap="userResult" />
15
+        <association property="dept"    javaType="SysDept"         resultMap="SysDeptResult" />
16
+        <association property="resource"    javaType="CmcResource"         resultMap="CmcResourceResult" />
17
+    </resultMap>
18
+
19
+    <resultMap type="SysUser" id="UserResult">
20
+        <result property="userId"    column="user_id"    />
21
+        <result property="nickName"    column="nick_name"    />
22
+    </resultMap>
23
+
24
+    <resultMap type="SysDept" id="SysDeptResult">
25
+        <result property="deptId"    column="dept_id"    />
26
+        <result property="deptName"    column="dept_name"    />
27
+    </resultMap>
28
+
29
+    <resultMap type="CmcResource" id="CmcResourceResult">
30
+        <result property="resourceId"    column="resource_id"    />
31
+        <result property="title"    column="title"    />
32
+    </resultMap>
33
+
34
+    <sql id="selectCmcStudyVo">
35
+        select s.study_id, s.resource_id, r.tile, s.user_id, u.nick_name, d.dept_name, s.last_point, s.last_time, s.get_hours from cmc_study as s
36
+        left join sys_user as u on u.user_id = s.user_id
37
+        left join sys_dept as d on d.dept_id = u.dept_id
38
+        left join cmc_resource as r on r.resource_id = s.resource_id
39
+    </sql>
40
+
41
+    <select id="selectCmcStudyList" parameterType="CmcStudy" resultMap="CmcStudyResult">
42
+        <include refid="selectCmcStudyVo"/>
43
+        <where>  
44
+            <if test="resourceId != null "> and s.resource_id = #{resourceId}</if>
45
+            <if test="userId != null "> and s.user_id = #{userId}</if>
46
+            <if test="lastPoint != null  and lastPoint != ''"> and s.last_point = #{lastPoint}</if>
47
+            <if test="lastTime != null "> and s.last_time = #{lastTime}</if>
48
+            <if test="getHours != null "> and s.get_hours = #{getHours}</if>
49
+        </where>
50
+    </select>
51
+    
52
+    <select id="selectCmcStudyByStudyId" parameterType="Integer" resultMap="CmcStudyResult">
53
+        <include refid="selectCmcStudyVo"/>
54
+        where study_id = #{studyId}
55
+    </select>
56
+        
57
+    <insert id="insertCmcStudy" parameterType="CmcStudy" useGeneratedKeys="true" keyProperty="studyId">
58
+        insert into cmc_study
59
+        <trim prefix="(" suffix=")" suffixOverrides=",">
60
+            <if test="resourceId != null">resource_id,</if>
61
+            <if test="userId != null">user_id,</if>
62
+            <if test="lastPoint != null">last_point,</if>
63
+            <if test="lastTime != null">last_time,</if>
64
+            <if test="getHours != null">get_hours,</if>
65
+         </trim>
66
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
67
+            <if test="resourceId != null">#{resourceId},</if>
68
+            <if test="userId != null">#{userId},</if>
69
+            <if test="lastPoint != null">#{lastPoint},</if>
70
+            <if test="lastTime != null">#{lastTime},</if>
71
+            <if test="getHours != null">#{getHours},</if>
72
+         </trim>
73
+    </insert>
74
+
75
+    <update id="updateCmcStudy" parameterType="CmcStudy">
76
+        update cmc_study
77
+        <trim prefix="SET" suffixOverrides=",">
78
+            <if test="resourceId != null">resource_id = #{resourceId},</if>
79
+            <if test="userId != null">user_id = #{userId},</if>
80
+            <if test="lastPoint != null">last_point = #{lastPoint},</if>
81
+            <if test="lastTime != null">last_time = #{lastTime},</if>
82
+            <if test="getHours != null">get_hours = #{getHours},</if>
83
+        </trim>
84
+        where study_id = #{studyId}
85
+    </update>
86
+
87
+    <delete id="deleteCmcStudyByStudyId" parameterType="Integer">
88
+        delete from cmc_study where study_id = #{studyId}
89
+    </delete>
90
+
91
+    <delete id="deleteCmcStudyByStudyIds" parameterType="String">
92
+        delete from cmc_study where study_id in 
93
+        <foreach item="studyId" collection="array" open="(" separator="," close=")">
94
+            #{studyId}
95
+        </foreach>
96
+    </delete>
97
+</mapper>

Loading…
취소
저장