This commit is contained in:
xuhubin 2020-11-03 16:16:53 +08:00
commit b469984794
9 changed files with 88 additions and 45 deletions

View File

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

View File

@ -91,4 +91,19 @@ public class Constants
* 资源映射路径 前缀
*/
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 结果
*/
public int deleteContractTypeById(Long id);
/**
* 查询 正常的合同分类列表
*
* @return 合同分类
*/
public List<ContractType> getNormalContractTypeList();
}

View File

@ -1,6 +1,9 @@
package com.ruoyi.front.service.impl;
import java.util.List;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -21,6 +24,18 @@ public class ContractTypeServiceImpl implements IContractTypeService
@Autowired
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">
<include refid="selectClasssicCasesVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="introduction != null and introduction != ''"> and introduction = #{introduction}</if>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</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="type != null and type != ''"> and type = #{type}</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"/>
<where>
<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="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="enclosureUrl != null and enclosureUrl != ''"> and enclosure_url = #{enclosureUrl}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectContractTemplateVo"/>
where id = #{id}
</select>
sh
<insert id="insertContractTemplate" parameterType="ContractTemplate" useGeneratedKeys="true" keyProperty="id">
insert into contract_template
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

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

View File

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