合同模板

This commit is contained in:
丁瑞超 2020-11-03 16:14:54 +08:00
parent 668d5db6a9
commit c0d081c9c4
9 changed files with 87 additions and 44 deletions

View File

@ -1,6 +1,9 @@
package com.ruoyi.web.controller.front; package com.ruoyi.web.controller.front;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.front.service.IContractTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -34,10 +37,14 @@ public class ContractTemplateController extends BaseController
@Autowired @Autowired
private IContractTemplateService contractTemplateService; private IContractTemplateService contractTemplateService;
@Autowired
private IContractTypeService contractTypeService;
@RequiresPermissions("front:contract_template:view") @RequiresPermissions("front:contract_template:view")
@GetMapping() @GetMapping()
public String template() public String template(ModelMap mmap)
{ {
mmap.put("contractTypes", contractTypeService.getNormalContractTypeList());
return prefix + "/template"; return prefix + "/template";
} }
@ -72,8 +79,9 @@ public class ContractTemplateController extends BaseController
* 新增合同模板 * 新增合同模板
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add() public String add(ModelMap mmap)
{ {
mmap.put("contractTypes", contractTypeService.getNormalContractTypeList());
return prefix + "/add"; return prefix + "/add";
} }
@ -97,6 +105,7 @@ public class ContractTemplateController extends BaseController
{ {
ContractTemplate contractTemplate = contractTemplateService.selectContractTemplateById(id); ContractTemplate contractTemplate = contractTemplateService.selectContractTemplateById(id);
mmap.put("contractTemplate", contractTemplate); mmap.put("contractTemplate", contractTemplate);
mmap.put("contractTypes", contractTypeService.getNormalContractTypeList());
return prefix + "/edit"; return prefix + "/edit";
} }

View File

@ -91,4 +91,19 @@ public class Constants
* 资源映射路径 前缀 * 资源映射路径 前缀
*/ */
public static final String RESOURCE_PREFIX = "/profile"; public static final String RESOURCE_PREFIX = "/profile";
/**
* 正常.
*/
public static final String NORMAL = "0";
/**
* 停用
*/
public static final String DISABLE = "1";
/**
* 未删除
*/
public static final String NO_DELETE = "0";
} }

View File

@ -58,4 +58,12 @@ public interface IContractTypeService
* @return 结果 * @return 结果
*/ */
public int deleteContractTypeById(Long id); public int deleteContractTypeById(Long id);
/**
* 查询 正常的合同分类列表
*
* @return 合同分类
*/
public List<ContractType> getNormalContractTypeList();
} }

View File

@ -1,6 +1,9 @@
package com.ruoyi.front.service.impl; package com.ruoyi.front.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,6 +24,18 @@ public class ContractTypeServiceImpl implements IContractTypeService
@Autowired @Autowired
private ContractTypeMapper contractTypeMapper; private ContractTypeMapper contractTypeMapper;
/**
* 查询 正常的合同分类列表
*
* @return 合同分类
*/
@Override
public List<ContractType> getNormalContractTypeList() {
ContractType contractType = new ContractType();
contractType.setDelFlag(Constants.NO_DELETE);
return this.selectContractTypeList(contractType);
}
/** /**
* 查询合同分类 * 查询合同分类
* *

View File

@ -27,8 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectClasssicCasesList" parameterType="ClasssicCases" resultMap="ClasssicCasesResult"> <select id="selectClasssicCasesList" parameterType="ClasssicCases" resultMap="ClasssicCasesResult">
<include refid="selectClasssicCasesVo"/> <include refid="selectClasssicCasesVo"/>
<where> <where>
<if test="title != null and title != ''"> and title = #{title}</if> <if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="introduction != null and introduction != ''"> and introduction = #{introduction}</if> <if test="introduction != null and introduction != ''"> and introduction like concat('%', #{introduction}, '%')</if>
<if test="content != null and content != ''"> and content = #{content}</if> <if test="content != null and content != ''"> and content = #{content}</if>
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''"> and type = #{type}</if>
<if test="hits != null "> and hits = #{hits}</if> <if test="hits != null "> and hits = #{hits}</if>

View File

@ -29,9 +29,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectContractTemplateVo"/> <include refid="selectContractTemplateVo"/>
<where> <where>
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''"> and type = #{type}</if>
<if test="title != null and title != ''"> and title = #{title}</if> <if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="introduction != null and introduction != ''"> and introduction = #{introduction}</if> <if test="introduction != null and introduction != ''"> and introduction = #{introduction}</if>
<if test="content != null and content != ''"> and content = #{content}</if> <if test="content != null and content != ''"> and content like concat('%', #{content}, '%') </if>
<if test="hits != null "> and hits = #{hits}</if> <if test="hits != null "> and hits = #{hits}</if>
<if test="enclosureUrl != null and enclosureUrl != ''"> and enclosure_url = #{enclosureUrl}</if> <if test="enclosureUrl != null and enclosureUrl != ''"> and enclosure_url = #{enclosureUrl}</if>
<if test="status != null and status != ''"> and status = #{status}</if> <if test="status != null and status != ''"> and status = #{status}</if>

View File

@ -8,12 +8,11 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-template-add"> <form class="form-horizontal m" id="form-template-add">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">合同分类id(contract_type表主键id)</label> <label class="col-sm-3 control-label is-required">合同分类:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="type" class="form-control m-b" required> <select name="type" class="form-control m-b" required>
<option value="">所有</option> <option th:each="type : ${contractTypes}" th:text="${type.name}" th:value="${type.id}"></option>
</select> </select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -36,28 +35,22 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">点击量</label> <label class="col-sm-3 control-label is-required">附件</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="hits" class="form-control" type="text"> <input id="filePath" name="filePath" class="form-control" type="file">
</div> <input id="enclosureUrl" name="enclosureUrl" type="text" hidden>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">附件下载:</label>
<div class="col-sm-8">
<textarea name="enclosureUrl" class="form-control" required></textarea>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">状态:</label> <label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="radio-box"> <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
<input type="radio" name="status" value=""> <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="status" th:text="未知"></label> <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div> </div>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">
<label class="col-sm-3 control-label">删除标志:</label> <label class="col-sm-3 control-label">删除标志:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="delFlag" class="form-control" type="text"> <input name="delFlag" class="form-control" type="text">
@ -68,7 +61,7 @@
<div class="col-sm-8"> <div class="col-sm-8">
<input name="remark" class="form-control" type="text"> <input name="remark" class="form-control" type="text">
</div> </div>
</div> </div>-->
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
@ -81,6 +74,8 @@
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
//同步上传图片并且将上传图片返回的地址赋值到pictureUrl对应的隐藏域上
uploadFile(false, "enclosureUrl");
$.operate.save(prefix + "/add", $('#form-template-add').serialize()); $.operate.save(prefix + "/add", $('#form-template-add').serialize());
} }
} }

View File

@ -9,12 +9,11 @@
<form class="form-horizontal m" id="form-template-edit" th:object="${contractTemplate}"> <form class="form-horizontal m" id="form-template-edit" th:object="${contractTemplate}">
<input name="id" th:field="*{id}" type="hidden"> <input name="id" th:field="*{id}" type="hidden">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">合同分类id(contract_type表主键id)</label> <label class="col-sm-3 control-label is-required">合同分类:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="type" class="form-control m-b" required> <select name="type" th:field="*{type}" class="form-control m-b" required>
<option value="">所有</option> <option th:each="contractType : ${contractTypes}" th:text="${contractType.name}" th:value="${contractType.id}"></option>
</select> </select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -36,26 +35,26 @@
<div class="summernote" id="content"></div> <div class="summernote" id="content"></div>
</div> </div>
</div> </div>
<div class="form-group"> <!--<div class="form-group">
<label class="col-sm-3 control-label">点击量:</label> <label class="col-sm-3 control-label">点击量:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="hits" th:field="*{hits}" class="form-control" type="text"> <input name="hits" th:field="*{hits}" class="form-control" type="text">
</div> </div>
</div> </div>-->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">附件下载</label> <label class="col-sm-3 control-label is-required">附件:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<textarea name="enclosureUrl" class="form-control" required>[[*{enclosureUrl}]]</textarea> <input id="filePath" name="filePath" class="form-control" type="file">
<input id="enclosureUrl" name="enclosureUrl" type="text" hidden>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">状态:</label> <label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="radio-box"> <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
<input type="radio" name="status" value=""> <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="status" th:text="未知"></label> <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div> </div>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -76,6 +75,8 @@
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
//同步上传图片并且将上传图片返回的地址赋值到pictureUrl对应的隐藏域上
uploadFile(false, "enclosureUrl");
$.operate.save(prefix + "/edit", $('#form-template-edit').serialize()); $.operate.save(prefix + "/edit", $('#form-template-edit').serialize());
} }
} }

View File

@ -11,29 +11,29 @@
<div class="select-list"> <div class="select-list">
<ul> <ul>
<li> <li>
<label>合同分类id(contract_type表主键id)</label> <label>合同分类:</label>
<select name="type"> <select name="type" class="form-control m-b">
<option value="">所有</option> <option value="">所有</option>
<option value="-1">代码生成请选择字典属性</option> <option th:each="contractType : ${contractTypes}" th:text="${contractType.name}" th:value="${contractType.id}"></option>
</select> </select>
</li> </li>
<li> <li>
<label>标题:</label> <label>标题:</label>
<input type="text" name="title"/> <input type="text" name="title"/>
</li> </li>
<li> <!--<li>
<label>简介:</label> <label>简介:</label>
<input type="text" name="introduction"/> <input type="text" name="introduction"/>
</li> </li>
<li> <li>
<label>点击量:</label> <label>点击量:</label>
<input type="text" name="hits"/> <input type="text" name="hits"/>
</li> </li>-->
<li> <li>
<label>状态:</label> <label>状态:</label>
<select name="status"> <select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option> <option value="">所有</option>
<option value="-1">代码生成请选择字典属性</option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select> </select>
</li> </li>
<li> <li>
@ -46,7 +46,7 @@
</div> </div>
<div class="btn-group-sm" id="toolbar" role="group"> <div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="front:contractTemplate:add"> <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="front:contractTemplate:add">
<i class="fa fa-plus"></i> 添加 <i class="fa fa-plus"></i> 添加
</a> </a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="front:contractTemplate:edit"> <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="front:contractTemplate:edit">