模板管理
This commit is contained in:
+59
@@ -0,0 +1,59 @@
|
||||
package com.ruoyi.web.controller.wisdomarbitrate;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
|
||||
import com.ruoyi.wisdomarbitrate.service.ITemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/template")
|
||||
public class TemplateController extends BaseController {
|
||||
@Autowired
|
||||
private ITemplateService templateService;
|
||||
/**
|
||||
* 新增模板
|
||||
* @param templateManual
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/insert")
|
||||
public AjaxResult insertTemplate(@RequestBody TemplateManual templateManual){
|
||||
return templateService.insertTemplate(templateManual);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
public AjaxResult deleteTemplate(Long id){
|
||||
return templateService.deleteTemplate(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模板
|
||||
* @param templateManual
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public AjaxResult updateTemplate(@RequestBody TemplateManual templateManual){
|
||||
return templateService.updateTemplate(templateManual);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询模板
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list( TemplateManual templateManual) {
|
||||
startPage();
|
||||
List<TemplateManual> list = templateService.selectTemplate(templateManual);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.wisdomarbitrate.domain;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TemplateManual {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 模板名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 模板内容,用{}作为占位符动态替换其内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 模板类型,1-裁决内容,2-调解协议,3-金融消费纠纷基本情况
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.wisdomarbitrate.mapper;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TemplateManualMapper {
|
||||
|
||||
int insertTemplateManual(TemplateManual templateManual);
|
||||
|
||||
int updateTemplateManual(TemplateManual templateManual);
|
||||
|
||||
List<TemplateManual> selectTemplateManual(TemplateManual templateManual);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ITemplateService {
|
||||
AjaxResult insertTemplate(TemplateManual templateManual);
|
||||
|
||||
AjaxResult deleteTemplate(Long id);
|
||||
|
||||
AjaxResult updateTemplate(TemplateManual templateManual);
|
||||
|
||||
List<TemplateManual> selectTemplate(TemplateManual templateManual);
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.TemplateManualMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.ITemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class TemplateServiceImpl implements ITemplateService {
|
||||
@Autowired
|
||||
private TemplateManualMapper templateManualMapper;
|
||||
@Override
|
||||
public AjaxResult insertTemplate(TemplateManual templateManual) {
|
||||
int i = templateManualMapper.insertTemplateManual(templateManual);
|
||||
if (i>0){
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult deleteTemplate(Long id) {
|
||||
TemplateManual templateManual = new TemplateManual();
|
||||
templateManual.setId(id);
|
||||
templateManual.setDelFlag(2);
|
||||
int i = templateManualMapper.updateTemplateManual(templateManual);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateTemplate(TemplateManual templateManual) {
|
||||
int i = templateManualMapper.updateTemplateManual(templateManual);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TemplateManual> selectTemplate(TemplateManual templateManual) {
|
||||
return templateManualMapper.selectTemplateManual(templateManual);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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.wisdomarbitrate.mapper.TemplateManualMapper">
|
||||
<resultMap type="TemplateManual" id="TemplateManualResult">
|
||||
<id property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="content" column="content" />
|
||||
<result property="type" column="type" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
<insert id="insertTemplateManual" parameterType="TemplateManual" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into template_manual(
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="content != null and content != '' ">content,</if>
|
||||
<if test="type != null ">type,</if>
|
||||
del_flag
|
||||
)values(
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="content != null and content != '' ">#{content},</if>
|
||||
<if test="type != null ">#{type},</if>
|
||||
0
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateTemplateManual" parameterType="TemplateManual">
|
||||
update template_manual
|
||||
<set>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="content != null and content != '' ">content = #{content},</if>
|
||||
<if test="type != null ">type = #{type},</if>
|
||||
<if test="delFlag != null ">del_flag = #{delFlag},</if>
|
||||
</set>
|
||||
<where>
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</update>
|
||||
<select id="selectTemplateManual" parameterType="TemplateManual" resultMap="TemplateManualResult">
|
||||
SELECT id, name ,content , type
|
||||
FROM template_manual
|
||||
<where>
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
<if test="content != null and content != ''">
|
||||
AND content = #{content}
|
||||
</if>
|
||||
<if test="type != null ">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
AND del_flag =0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user