This commit is contained in:
贾译升 2021-04-06 09:38:34 +08:00
parent 06af310b07
commit 221af65531
9 changed files with 1258 additions and 0 deletions

View File

@ -0,0 +1,126 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WkCrmContract;
import com.ruoyi.system.service.IWkCrmContractService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 合同Controller
*
* @author ruoyi
* @date 2021-04-06
*/
@Controller
@RequestMapping("/system/contract")
public class WkCrmContractController extends BaseController
{
private String prefix = "system/contract";
@Autowired
private IWkCrmContractService wkCrmContractService;
@RequiresPermissions("system:contract:view")
@GetMapping()
public String contract()
{
return prefix + "/contract";
}
/**
* 查询合同列表
*/
@RequiresPermissions("system:contract:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(WkCrmContract wkCrmContract)
{
startPage();
List<WkCrmContract> list = wkCrmContractService.selectWkCrmContractList(wkCrmContract);
return getDataTable(list);
}
/**
* 导出合同列表
*/
@RequiresPermissions("system:contract:export")
@Log(title = "合同", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(WkCrmContract wkCrmContract)
{
List<WkCrmContract> list = wkCrmContractService.selectWkCrmContractList(wkCrmContract);
ExcelUtil<WkCrmContract> util = new ExcelUtil<WkCrmContract>(WkCrmContract.class);
return util.exportExcel(list, "contract");
}
/**
* 新增合同
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存合同
*/
@RequiresPermissions("system:contract:add")
@Log(title = "合同", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(WkCrmContract wkCrmContract)
{
return toAjax(wkCrmContractService.insertWkCrmContract(wkCrmContract));
}
/**
* 修改合同
*/
@GetMapping("/edit/{contractId}")
public String edit(@PathVariable("contractId") Integer contractId, ModelMap mmap)
{
WkCrmContract wkCrmContract = wkCrmContractService.selectWkCrmContractById(contractId);
mmap.put("wkCrmContract", wkCrmContract);
return prefix + "/edit";
}
/**
* 修改保存合同
*/
@RequiresPermissions("system:contract:edit")
@Log(title = "合同", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(WkCrmContract wkCrmContract)
{
return toAjax(wkCrmContractService.updateWkCrmContract(wkCrmContract));
}
/**
* 删除合同
*/
@RequiresPermissions("system:contract:remove")
@Log(title = "合同", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(wkCrmContractService.deleteWkCrmContractByIds(ids));
}
}

View File

@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增合同')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-contract-add">
<div class="form-group">
<label class="col-sm-3 control-label">合同编号:</label>
<div class="col-sm-8">
<input name="num" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同名称:</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="customerId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同金额:</label>
<div class="col-sm-8">
<input name="money" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">下单日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="orderDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">开始时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="startTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">结束时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="endTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户签约人:</label>
<div class="col-sm-8">
<input name="contactsId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">公司签约人:</label>
<div class="col-sm-8">
<input name="companyUserId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同类型:</label>
<div class="col-sm-8">
<select name="types" class="form-control m-b" th:with="type=${@dict.getType('bj_types')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">审核状态:</label>
<div class="col-sm-8">
<select name="checkStatus" class="form-control m-b" th:with="type=${@dict.getType('bj_common_status')}" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/contract"
$("#form-contract-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-contract-add').serialize());
}
}
$("input[name='orderDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='startTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='endTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,181 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('合同列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>合同名称:</label>
<input type="text" name="name"/>
</li>
<li>
<label>客户名称:</label>
<input type="text" name="customerId"/>
</li>
<li>
<label>合同类型:</label>
<select name="types" th:with="type=${@dict.getType('bj_types')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:contract:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:contract:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:contract:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:contract:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:contract:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:contract:remove')}]];
var typesDatas = [[${@dict.getType('bj_types')}]];
var checkStatusDatas = [[${@dict.getType('bj_common_status')}]];
var prefix = ctx + "system/contract";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "合同",
columns: [{
checkbox: true
},
{
field: 'contractId',
title: '合同ID',
visible: false
},
{
field: 'num',
title: '合同编号'
},
{
field: 'name',
title: '合同名称'
},
{
field: 'customerId',
title: '客户名称'
},
{
field: 'money',
title: '合同金额'
},
{
field: 'orderDate',
title: '下单日期'
},
{
field: 'startTime',
title: '开始时间'
},
{
field: 'endTime',
title: '结束时间'
},
{
field: 'contactsId',
title: '客户签约人'
},
{
field: 'companyUserId',
title: '公司签约人'
},
{
field: 'remark',
title: '备注'
},
{
field: 'types',
title: '合同类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(typesDatas, value);
}
},
{
field: 'checkStatus',
title: '审核状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(checkStatusDatas, value);
}
},
{
field: 'receivedMoney',
title: '已收款金额'
},
{
field: 'unreceivedMoney',
title: '未收款金额'
},
{
field: 'oldContractId',
title: '最后跟进人'
},
{
field: 'lastTime',
title: '最后跟进时间'
},
{
field: 'ownerUserId',
title: '负责人'
},
{
field: 'updateTime',
title: '更新时间'
},
{
field: 'createTime',
title: '创建时间'
},
{
field: 'createUserId',
title: '创建人'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.contractId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.contractId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,131 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改合同')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-contract-edit" th:object="${wkCrmContract}">
<input name="contractId" th:field="*{contractId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">合同编号:</label>
<div class="col-sm-8">
<input name="num" th:field="*{num}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同名称:</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="customerId" th:field="*{customerId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同金额:</label>
<div class="col-sm-8">
<input name="money" th:field="*{money}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">下单日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="orderDate" th:value="${#dates.format(wkCrmContract.orderDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">开始时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="startTime" th:value="${#dates.format(wkCrmContract.startTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">结束时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="endTime" th:value="${#dates.format(wkCrmContract.endTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户签约人:</label>
<div class="col-sm-8">
<input name="contactsId" th:field="*{contactsId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">公司签约人:</label>
<div class="col-sm-8">
<input name="companyUserId" th:field="*{companyUserId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同类型:</label>
<div class="col-sm-8">
<select name="types" class="form-control m-b" th:with="type=${@dict.getType('bj_types')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{types}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">审核状态:</label>
<div class="col-sm-8">
<select name="checkStatus" class="form-control m-b" th:with="type=${@dict.getType('bj_common_status')}" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{checkStatus}"></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/contract";
$("#form-contract-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-contract-edit').serialize());
}
}
$("input[name='orderDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='startTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='endTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,324 @@
package com.ruoyi.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 合同对象 wk_crm_contract
*
* @author ruoyi
* @date 2021-04-06
*/
public class WkCrmContract extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 合同ID */
private Integer contractId;
/** 合同编号 */
@Excel(name = "合同编号")
private String num;
/** 合同名称 */
@Excel(name = "合同名称")
private String name;
/** 客户名称 */
@Excel(name = "客户名称")
private Integer customerId;
/** 合同金额 */
@Excel(name = "合同金额")
private BigDecimal money;
/** 下单日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date orderDate;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 客户签约人联系人id */
@Excel(name = "客户签约人", readConverterExp = "联=系人id")
private Long contactsId;
/** 公司签约人 */
@Excel(name = "公司签约人")
private String companyUserId;
/** 合同类型 */
@Excel(name = "合同类型")
private String types;
/** 审核状态 */
@Excel(name = "审核状态")
private Integer checkStatus;
/** 已收款金额 */
@Excel(name = "已收款金额")
private Double receivedMoney;
/** 未收款金额 */
@Excel(name = "未收款金额")
private Double unreceivedMoney;
/** 最后跟进人 */
@Excel(name = "最后跟进人")
private Integer oldContractId;
/** 最后跟进时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后跟进时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastTime;
/** 负责人 */
@Excel(name = "负责人")
private Long ownerUserId;
/** 创建人 */
@Excel(name = "创建人")
private Integer createUserId;
/** 审核记录 */
private Integer examineRecordId;
/** 产品总金额 */
private Double totalPrice;
/** 付款方式 */
private String paymentType;
public void setContractId(Integer contractId)
{
this.contractId = contractId;
}
public Integer getContractId()
{
return contractId;
}
public void setNum(String num)
{
this.num = num;
}
public String getNum()
{
return num;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setCustomerId(Integer customerId)
{
this.customerId = customerId;
}
public Integer getCustomerId()
{
return customerId;
}
public void setMoney(BigDecimal money)
{
this.money = money;
}
public BigDecimal getMoney()
{
return money;
}
public void setOrderDate(Date orderDate)
{
this.orderDate = orderDate;
}
public Date getOrderDate()
{
return orderDate;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setContactsId(Long contactsId)
{
this.contactsId = contactsId;
}
public Long getContactsId()
{
return contactsId;
}
public void setCompanyUserId(String companyUserId)
{
this.companyUserId = companyUserId;
}
public String getCompanyUserId()
{
return companyUserId;
}
public void setTypes(String types)
{
this.types = types;
}
public String getTypes()
{
return types;
}
public void setCheckStatus(Integer checkStatus)
{
this.checkStatus = checkStatus;
}
public Integer getCheckStatus()
{
return checkStatus;
}
public void setReceivedMoney(Double receivedMoney)
{
this.receivedMoney = receivedMoney;
}
public Double getReceivedMoney()
{
return receivedMoney;
}
public void setUnreceivedMoney(Double unreceivedMoney)
{
this.unreceivedMoney = unreceivedMoney;
}
public Double getUnreceivedMoney()
{
return unreceivedMoney;
}
public void setOldContractId(Integer oldContractId)
{
this.oldContractId = oldContractId;
}
public Integer getOldContractId()
{
return oldContractId;
}
public void setLastTime(Date lastTime)
{
this.lastTime = lastTime;
}
public Date getLastTime()
{
return lastTime;
}
public void setOwnerUserId(Long ownerUserId)
{
this.ownerUserId = ownerUserId;
}
public Long getOwnerUserId()
{
return ownerUserId;
}
public void setCreateUserId(Integer createUserId)
{
this.createUserId = createUserId;
}
public Integer getCreateUserId()
{
return createUserId;
}
public void setExamineRecordId(Integer examineRecordId)
{
this.examineRecordId = examineRecordId;
}
public Integer getExamineRecordId()
{
return examineRecordId;
}
public void setTotalPrice(Double totalPrice)
{
this.totalPrice = totalPrice;
}
public Double getTotalPrice()
{
return totalPrice;
}
public void setPaymentType(String paymentType)
{
this.paymentType = paymentType;
}
public String getPaymentType()
{
return paymentType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("contractId", getContractId())
.append("num", getNum())
.append("name", getName())
.append("customerId", getCustomerId())
.append("money", getMoney())
.append("orderDate", getOrderDate())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("contactsId", getContactsId())
.append("companyUserId", getCompanyUserId())
.append("remark", getRemark())
.append("types", getTypes())
.append("checkStatus", getCheckStatus())
.append("receivedMoney", getReceivedMoney())
.append("unreceivedMoney", getUnreceivedMoney())
.append("oldContractId", getOldContractId())
.append("lastTime", getLastTime())
.append("ownerUserId", getOwnerUserId())
.append("updateTime", getUpdateTime())
.append("createTime", getCreateTime())
.append("createUserId", getCreateUserId())
.append("examineRecordId", getExamineRecordId())
.append("totalPrice", getTotalPrice())
.append("paymentType", getPaymentType())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.WkCrmContract;
/**
* 合同Mapper接口
*
* @author ruoyi
* @date 2021-04-06
*/
public interface WkCrmContractMapper
{
/**
* 查询合同
*
* @param contractId 合同ID
* @return 合同
*/
public WkCrmContract selectWkCrmContractById(Integer contractId);
/**
* 查询合同列表
*
* @param wkCrmContract 合同
* @return 合同集合
*/
public List<WkCrmContract> selectWkCrmContractList(WkCrmContract wkCrmContract);
/**
* 新增合同
*
* @param wkCrmContract 合同
* @return 结果
*/
public int insertWkCrmContract(WkCrmContract wkCrmContract);
/**
* 修改合同
*
* @param wkCrmContract 合同
* @return 结果
*/
public int updateWkCrmContract(WkCrmContract wkCrmContract);
/**
* 删除合同
*
* @param contractId 合同ID
* @return 结果
*/
public int deleteWkCrmContractById(Integer contractId);
/**
* 批量删除合同
*
* @param contractIds 需要删除的数据ID
* @return 结果
*/
public int deleteWkCrmContractByIds(String[] contractIds);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.WkCrmContract;
/**
* 合同Service接口
*
* @author ruoyi
* @date 2021-04-06
*/
public interface IWkCrmContractService
{
/**
* 查询合同
*
* @param contractId 合同ID
* @return 合同
*/
public WkCrmContract selectWkCrmContractById(Integer contractId);
/**
* 查询合同列表
*
* @param wkCrmContract 合同
* @return 合同集合
*/
public List<WkCrmContract> selectWkCrmContractList(WkCrmContract wkCrmContract);
/**
* 新增合同
*
* @param wkCrmContract 合同
* @return 结果
*/
public int insertWkCrmContract(WkCrmContract wkCrmContract);
/**
* 修改合同
*
* @param wkCrmContract 合同
* @return 结果
*/
public int updateWkCrmContract(WkCrmContract wkCrmContract);
/**
* 批量删除合同
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteWkCrmContractByIds(String ids);
/**
* 删除合同信息
*
* @param contractId 合同ID
* @return 结果
*/
public int deleteWkCrmContractById(Integer contractId);
}

View File

@ -0,0 +1,97 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.WkCrmContractMapper;
import com.ruoyi.system.domain.WkCrmContract;
import com.ruoyi.system.service.IWkCrmContractService;
import com.ruoyi.common.core.text.Convert;
/**
* 合同Service业务层处理
*
* @author ruoyi
* @date 2021-04-06
*/
@Service
public class WkCrmContractServiceImpl implements IWkCrmContractService
{
@Autowired
private WkCrmContractMapper wkCrmContractMapper;
/**
* 查询合同
*
* @param contractId 合同ID
* @return 合同
*/
@Override
public WkCrmContract selectWkCrmContractById(Integer contractId)
{
return wkCrmContractMapper.selectWkCrmContractById(contractId);
}
/**
* 查询合同列表
*
* @param wkCrmContract 合同
* @return 合同
*/
@Override
public List<WkCrmContract> selectWkCrmContractList(WkCrmContract wkCrmContract)
{
return wkCrmContractMapper.selectWkCrmContractList(wkCrmContract);
}
/**
* 新增合同
*
* @param wkCrmContract 合同
* @return 结果
*/
@Override
public int insertWkCrmContract(WkCrmContract wkCrmContract)
{
wkCrmContract.setCreateTime(DateUtils.getNowDate());
return wkCrmContractMapper.insertWkCrmContract(wkCrmContract);
}
/**
* 修改合同
*
* @param wkCrmContract 合同
* @return 结果
*/
@Override
public int updateWkCrmContract(WkCrmContract wkCrmContract)
{
wkCrmContract.setUpdateTime(DateUtils.getNowDate());
return wkCrmContractMapper.updateWkCrmContract(wkCrmContract);
}
/**
* 删除合同对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteWkCrmContractByIds(String ids)
{
return wkCrmContractMapper.deleteWkCrmContractByIds(Convert.toStrArray(ids));
}
/**
* 删除合同信息
*
* @param contractId 合同ID
* @return 结果
*/
@Override
public int deleteWkCrmContractById(Integer contractId)
{
return wkCrmContractMapper.deleteWkCrmContractById(contractId);
}
}

View File

@ -0,0 +1,147 @@
<?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.system.mapper.WkCrmContractMapper">
<resultMap type="WkCrmContract" id="WkCrmContractResult">
<result property="contractId" column="contract_id" />
<result property="num" column="num" />
<result property="name" column="name" />
<result property="customerId" column="customer_id" />
<result property="money" column="money" />
<result property="orderDate" column="order_date" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="contactsId" column="contacts_id" />
<result property="companyUserId" column="company_user_id" />
<result property="remark" column="remark" />
<result property="types" column="types" />
<result property="checkStatus" column="check_status" />
<result property="receivedMoney" column="received_money" />
<result property="unreceivedMoney" column="unreceived_money" />
<result property="oldContractId" column="old_contract_id" />
<result property="lastTime" column="last_time" />
<result property="ownerUserId" column="owner_user_id" />
<result property="updateTime" column="update_time" />
<result property="createTime" column="create_time" />
<result property="createUserId" column="create_user_id" />
<result property="examineRecordId" column="examine_record_id" />
<result property="totalPrice" column="total_price" />
<result property="paymentType" column="payment_type" />
</resultMap>
<sql id="selectWkCrmContractVo">
select contract_id, num, name, customer_id, money, order_date, start_time, end_time, contacts_id, company_user_id, remark, types, check_status, received_money, unreceived_money, old_contract_id, last_time, owner_user_id, update_time, create_time, create_user_id, examine_record_id, total_price, payment_type from wk_crm_contract
</sql>
<select id="selectWkCrmContractList" parameterType="WkCrmContract" resultMap="WkCrmContractResult">
<include refid="selectWkCrmContractVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="types != null and types != ''"> and types = #{types}</if>
</where>
</select>
<select id="selectWkCrmContractById" parameterType="Integer" resultMap="WkCrmContractResult">
<include refid="selectWkCrmContractVo"/>
where contract_id = #{contractId}
</select>
<insert id="insertWkCrmContract" parameterType="WkCrmContract" useGeneratedKeys="true" keyProperty="contractId">
insert into wk_crm_contract
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="num != null">num,</if>
<if test="name != null">name,</if>
<if test="customerId != null">customer_id,</if>
<if test="money != null">money,</if>
<if test="orderDate != null">order_date,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="contactsId != null">contacts_id,</if>
<if test="companyUserId != null">company_user_id,</if>
<if test="remark != null">remark,</if>
<if test="types != null">types,</if>
<if test="checkStatus != null">check_status,</if>
<if test="receivedMoney != null">received_money,</if>
<if test="unreceivedMoney != null">unreceived_money,</if>
<if test="oldContractId != null">old_contract_id,</if>
<if test="lastTime != null">last_time,</if>
<if test="ownerUserId != null">owner_user_id,</if>
<if test="updateTime != null">update_time,</if>
<if test="createTime != null">create_time,</if>
<if test="createUserId != null">create_user_id,</if>
<if test="examineRecordId != null">examine_record_id,</if>
<if test="totalPrice != null">total_price,</if>
<if test="paymentType != null">payment_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="num != null">#{num},</if>
<if test="name != null">#{name},</if>
<if test="customerId != null">#{customerId},</if>
<if test="money != null">#{money},</if>
<if test="orderDate != null">#{orderDate},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="contactsId != null">#{contactsId},</if>
<if test="companyUserId != null">#{companyUserId},</if>
<if test="remark != null">#{remark},</if>
<if test="types != null">#{types},</if>
<if test="checkStatus != null">#{checkStatus},</if>
<if test="receivedMoney != null">#{receivedMoney},</if>
<if test="unreceivedMoney != null">#{unreceivedMoney},</if>
<if test="oldContractId != null">#{oldContractId},</if>
<if test="lastTime != null">#{lastTime},</if>
<if test="ownerUserId != null">#{ownerUserId},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUserId != null">#{createUserId},</if>
<if test="examineRecordId != null">#{examineRecordId},</if>
<if test="totalPrice != null">#{totalPrice},</if>
<if test="paymentType != null">#{paymentType},</if>
</trim>
</insert>
<update id="updateWkCrmContract" parameterType="WkCrmContract">
update wk_crm_contract
<trim prefix="SET" suffixOverrides=",">
<if test="num != null">num = #{num},</if>
<if test="name != null">name = #{name},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="money != null">money = #{money},</if>
<if test="orderDate != null">order_date = #{orderDate},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="contactsId != null">contacts_id = #{contactsId},</if>
<if test="companyUserId != null">company_user_id = #{companyUserId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="types != null">types = #{types},</if>
<if test="checkStatus != null">check_status = #{checkStatus},</if>
<if test="receivedMoney != null">received_money = #{receivedMoney},</if>
<if test="unreceivedMoney != null">unreceived_money = #{unreceivedMoney},</if>
<if test="oldContractId != null">old_contract_id = #{oldContractId},</if>
<if test="lastTime != null">last_time = #{lastTime},</if>
<if test="ownerUserId != null">owner_user_id = #{ownerUserId},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUserId != null">create_user_id = #{createUserId},</if>
<if test="examineRecordId != null">examine_record_id = #{examineRecordId},</if>
<if test="totalPrice != null">total_price = #{totalPrice},</if>
<if test="paymentType != null">payment_type = #{paymentType},</if>
</trim>
where contract_id = #{contractId}
</update>
<delete id="deleteWkCrmContractById" parameterType="Integer">
delete from wk_crm_contract where contract_id = #{contractId}
</delete>
<delete id="deleteWkCrmContractByIds" parameterType="String">
delete from wk_crm_contract where contract_id in
<foreach item="contractId" collection="array" open="(" separator="," close=")">
#{contractId}
</foreach>
</delete>
</mapper>