Преглед на файлове

Merge branch 'hjb' of SH-Arbitrate/Arbitrate-Backend into dev

hejinbo преди 2 години
родител
ревизия
cc5c4ab49a

+ 59
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/TemplateController.java Целия файл

@@ -0,0 +1,59 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import com.ruoyi.common.core.controller.BaseController;
4
+import com.ruoyi.common.core.domain.AjaxResult;
5
+import com.ruoyi.common.core.page.TableDataInfo;
6
+import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
7
+import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
8
+import com.ruoyi.wisdomarbitrate.service.ITemplateService;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.web.bind.annotation.*;
11
+
12
+import java.util.List;
13
+
14
+@RestController
15
+@RequestMapping("/template")
16
+public class TemplateController extends BaseController {
17
+    @Autowired
18
+    private ITemplateService templateService;
19
+    /**
20
+     * 新增模板
21
+     * @param templateManual
22
+     * @return
23
+     */
24
+    @PostMapping("/insert")
25
+    public AjaxResult insertTemplate(@RequestBody TemplateManual templateManual){
26
+        return templateService.insertTemplate(templateManual);
27
+    }
28
+
29
+    /**
30
+     * 删除模板
31
+     * @param id
32
+     * @return
33
+     */
34
+    @DeleteMapping("/delete")
35
+    public AjaxResult deleteTemplate(Long id){
36
+        return templateService.deleteTemplate(id);
37
+    }
38
+
39
+    /**
40
+     * 修改模板
41
+     * @param templateManual
42
+     * @return
43
+     */
44
+    @PutMapping("/update")
45
+    public AjaxResult updateTemplate(@RequestBody TemplateManual templateManual){
46
+        return templateService.updateTemplate(templateManual);
47
+    }
48
+
49
+    /**
50
+     * 查询模板
51
+     */
52
+    @GetMapping("/list")
53
+    public TableDataInfo list( TemplateManual templateManual) {
54
+        startPage();
55
+        List<TemplateManual> list = templateService.selectTemplate(templateManual);
56
+        return getDataTable(list);
57
+    }
58
+
59
+}

+ 33
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/TemplateManual.java Целия файл

@@ -0,0 +1,33 @@
1
+package com.ruoyi.wisdomarbitrate.domain;
2
+
3
+import com.ruoyi.common.core.domain.BaseEntity;
4
+import lombok.Data;
5
+
6
+@Data
7
+public class TemplateManual  {
8
+    /**
9
+     * ID
10
+     */
11
+    private Long id;
12
+
13
+    /**
14
+     * 模板名称
15
+     */
16
+    private String name;
17
+
18
+    /**
19
+     * 模板内容,用{}作为占位符动态替换其内容
20
+     */
21
+    private String content;
22
+
23
+    /**
24
+     * 模板类型,1-裁决内容,2-调解协议,3-金融消费纠纷基本情况
25
+     */
26
+    private Integer type;
27
+
28
+    /**
29
+     * 删除标志(0代表存在 2代表删除)
30
+     */
31
+    private Integer delFlag;
32
+
33
+}

+ 16
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/TemplateManualMapper.java Целия файл

@@ -0,0 +1,16 @@
1
+package com.ruoyi.wisdomarbitrate.mapper;
2
+
3
+import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+import java.util.List;
7
+
8
+@Mapper
9
+public interface TemplateManualMapper {
10
+
11
+    int insertTemplateManual(TemplateManual templateManual);
12
+
13
+    int updateTemplateManual(TemplateManual templateManual);
14
+
15
+    List<TemplateManual> selectTemplateManual(TemplateManual templateManual);
16
+}

+ 16
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ITemplateService.java Целия файл

@@ -0,0 +1,16 @@
1
+package com.ruoyi.wisdomarbitrate.service;
2
+
3
+import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
5
+
6
+import java.util.List;
7
+
8
+public interface ITemplateService {
9
+    AjaxResult insertTemplate(TemplateManual templateManual);
10
+
11
+    AjaxResult deleteTemplate(Long id);
12
+
13
+    AjaxResult updateTemplate(TemplateManual templateManual);
14
+
15
+    List<TemplateManual> selectTemplate(TemplateManual templateManual);
16
+}

+ 50
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/TemplateServiceImpl.java Целия файл

@@ -0,0 +1,50 @@
1
+package com.ruoyi.wisdomarbitrate.service.impl;
2
+
3
+import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
5
+import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
6
+import com.ruoyi.wisdomarbitrate.mapper.TemplateManualMapper;
7
+import com.ruoyi.wisdomarbitrate.service.ITemplateService;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.List;
12
+@Service
13
+public class TemplateServiceImpl implements ITemplateService {
14
+    @Autowired
15
+    private TemplateManualMapper templateManualMapper;
16
+    @Override
17
+    public AjaxResult insertTemplate(TemplateManual templateManual) {
18
+       int i = templateManualMapper.insertTemplateManual(templateManual);
19
+       if (i>0){
20
+           return AjaxResult.success("新增成功");
21
+       }
22
+        return AjaxResult.error("新增失败");
23
+    }
24
+
25
+    @Override
26
+    public AjaxResult deleteTemplate(Long id) {
27
+        TemplateManual templateManual = new TemplateManual();
28
+        templateManual.setId(id);
29
+        templateManual.setDelFlag(2);
30
+        int i = templateManualMapper.updateTemplateManual(templateManual);
31
+        if (i > 0) {
32
+            return AjaxResult.success("删除成功");
33
+        }
34
+        return AjaxResult.error();
35
+    }
36
+
37
+    @Override
38
+    public AjaxResult updateTemplate(TemplateManual templateManual) {
39
+        int i = templateManualMapper.updateTemplateManual(templateManual);
40
+        if (i > 0) {
41
+            return AjaxResult.success("修改成功");
42
+        }
43
+        return AjaxResult.error();
44
+    }
45
+
46
+    @Override
47
+    public List<TemplateManual> selectTemplate(TemplateManual templateManual) {
48
+        return templateManualMapper.selectTemplateManual(templateManual);
49
+    }
50
+}

+ 62
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/TemplateManualMapper.xml Целия файл

@@ -0,0 +1,62 @@
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.wisdomarbitrate.mapper.TemplateManualMapper">
6
+    <resultMap type="TemplateManual" id="TemplateManualResult">
7
+        <id     property="id"       column="id"      />
8
+        <result property="name"     column="name"    />
9
+        <result property="content"        column="content"        />
10
+        <result property="type"  column="type"  />
11
+        <result property="delFlag"     column="del_flag"     />
12
+    </resultMap>
13
+    <insert id="insertTemplateManual" parameterType="TemplateManual" useGeneratedKeys="true" keyProperty="id">
14
+        insert into template_manual(
15
+        <if test="name != null and name != ''">name,</if>
16
+        <if test="content != null and content != '' ">content,</if>
17
+        <if test="type != null ">type,</if>
18
+        del_flag
19
+        )values(
20
+        <if test="name != null and name != ''">#{name},</if>
21
+        <if test="content != null and content != '' ">#{content},</if>
22
+        <if test="type != null ">#{type},</if>
23
+        0
24
+        )
25
+    </insert>
26
+
27
+    <update id="updateTemplateManual" parameterType="TemplateManual">
28
+        update template_manual
29
+        <set>
30
+            <if test="name != null and name != ''">name = #{name},</if>
31
+            <if test="content != null and content != '' ">content = #{content},</if>
32
+            <if test="type != null ">type = #{type},</if>
33
+            <if test="delFlag != null ">del_flag = #{delFlag},</if>
34
+        </set>
35
+        <where>
36
+            <if test="id != null">
37
+                AND id = #{id}
38
+            </if>
39
+
40
+        </where>
41
+    </update>
42
+    <select id="selectTemplateManual" parameterType="TemplateManual" resultMap="TemplateManualResult">
43
+        SELECT  id, name ,content , type
44
+        FROM  template_manual
45
+        <where>
46
+            <if test="id != null">
47
+                AND id = #{id}
48
+            </if>
49
+            <if test="name != null and name != ''">
50
+                AND name = #{name}
51
+            </if>
52
+            <if test="content != null  and content != ''">
53
+                AND content = #{content}
54
+            </if>
55
+            <if test="type != null ">
56
+                AND type = #{type}
57
+            </if>
58
+            AND  del_flag =0
59
+        </where>
60
+    </select>
61
+
62
+</mapper>