This commit is contained in:
王泽斌 2021-04-06 14:44:23 +08:00
parent d9824bdebb
commit 5f0a45d3bb
9 changed files with 1143 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.WkCrmLeads;
import com.ruoyi.system.service.IWkCrmLeadsService;
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/leads")
public class WkCrmLeadsController extends BaseController
{
private String prefix = "system/leads";
@Autowired
private IWkCrmLeadsService wkCrmLeadsService;
@RequiresPermissions("system:leads:view")
@GetMapping()
public String leads()
{
return prefix + "/leads";
}
/**
* 查询线索列表
*/
@RequiresPermissions("system:leads:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(WkCrmLeads wkCrmLeads)
{
startPage();
List<WkCrmLeads> list = wkCrmLeadsService.selectWkCrmLeadsList(wkCrmLeads);
return getDataTable(list);
}
/**
* 导出线索列表
*/
@RequiresPermissions("system:leads:export")
@Log(title = "线索", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(WkCrmLeads wkCrmLeads)
{
List<WkCrmLeads> list = wkCrmLeadsService.selectWkCrmLeadsList(wkCrmLeads);
ExcelUtil<WkCrmLeads> util = new ExcelUtil<WkCrmLeads>(WkCrmLeads.class);
return util.exportExcel(list, "leads");
}
/**
* 新增线索
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存线索
*/
@RequiresPermissions("system:leads:add")
@Log(title = "线索", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(WkCrmLeads wkCrmLeads)
{
return toAjax(wkCrmLeadsService.insertWkCrmLeads(wkCrmLeads));
}
/**
* 修改线索
*/
@GetMapping("/edit/{leadsId}")
public String edit(@PathVariable("leadsId") Long leadsId, ModelMap mmap)
{
WkCrmLeads wkCrmLeads = wkCrmLeadsService.selectWkCrmLeadsById(leadsId);
mmap.put("wkCrmLeads", wkCrmLeads);
return prefix + "/edit";
}
/**
* 修改保存线索
*/
@RequiresPermissions("system:leads:edit")
@Log(title = "线索", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(WkCrmLeads wkCrmLeads)
{
return toAjax(wkCrmLeadsService.updateWkCrmLeads(wkCrmLeads));
}
/**
* 删除线索
*/
@RequiresPermissions("system:leads:remove")
@Log(title = "线索", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(wkCrmLeadsService.deleteWkCrmLeadsByIds(ids));
}
}

View File

@ -0,0 +1,155 @@
<!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" />
<th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-leads-add">
<div class="form-group">
<label class="col-sm-3 control-label">跟进状态 0未跟进1已跟进</label>
<div class="col-sm-8">
<input name="followup" 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="leadsName" 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="nextTime" 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="telephone" 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="mobile" 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="email" 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="address" 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 is-required">创建人ID</label>
<div class="col-sm-8">
<input name="createUserId" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">负责人ID</label>
<div class="col-sm-8">
<input name="ownerUserId" 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="lastTime" 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 type="hidden" class="form-control" name="lastContent">
<div class="summernote" id="lastContent"></div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: summernote-js" />
<script th:inline="javascript">
var prefix = ctx + "system/leads"
$("#form-leads-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-leads-add').serialize());
}
}
$("input[name='nextTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='lastTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(function() {
$('.summernote').summernote({
lang: 'zh-CN',
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,160 @@
<!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" />
<th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-leads-edit" th:object="${wkCrmLeads}">
<input name="leadsId" th:field="*{leadsId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">跟进状态 0未跟进1已跟进</label>
<div class="col-sm-8">
<input name="followup" th:field="*{followup}" 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="leadsName" th:field="*{leadsName}" 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="nextTime" th:value="${#dates.format(wkCrmLeads.nextTime, '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="telephone" th:field="*{telephone}" 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="mobile" th:field="*{mobile}" 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="email" th:field="*{email}" 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="address" th:field="*{address}" 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 is-required">创建人ID</label>
<div class="col-sm-8">
<input name="createUserId" th:field="*{createUserId}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">负责人ID</label>
<div class="col-sm-8">
<input name="ownerUserId" th:field="*{ownerUserId}" 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="lastTime" th:value="${#dates.format(wkCrmLeads.lastTime, '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 type="hidden" class="form-control" th:field="*{lastContent}">
<div class="summernote" id="lastContent"></div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: summernote-js" />
<script th:inline="javascript">
var prefix = ctx + "system/leads";
$("#form-leads-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-leads-edit').serialize());
}
}
$("input[name='nextTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='lastTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(function() {
$('.summernote').each(function(i) {
$('#' + this.id).summernote({
lang: 'zh-CN',
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
var content = $("input[name='" + this.id + "']").val();
$('#' + this.id).summernote('code', content);
})
});
</script>
</body>
</html>

View File

@ -0,0 +1,166 @@
<!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>跟进状态 0未跟进1已跟进</label>
<input type="text" name="followup"/>
</li>
<li>
<label>线索名称:</label>
<input type="text" name="leadsName"/>
</li>
<li>
<label>下次联系时间:</label>
<input type="text" class="time-input" placeholder="请选择下次联系时间" name="nextTime"/>
</li>
<li>
<label>电话:</label>
<input type="text" name="telephone"/>
</li>
<li>
<label>手机号:</label>
<input type="text" name="mobile"/>
</li>
<li>
<label>邮箱:</label>
<input type="text" name="email"/>
</li>
<li>
<label>地址:</label>
<input type="text" name="address"/>
</li>
<li>
<label>创建人ID</label>
<input type="text" name="createUserId"/>
</li>
<li>
<label>负责人ID</label>
<input type="text" name="ownerUserId"/>
</li>
<li>
<label>最后跟进时间:</label>
<input type="text" class="time-input" placeholder="请选择最后跟进时间" name="lastTime"/>
</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:leads:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:leads:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:leads:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:leads: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:leads:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:leads:remove')}]];
var prefix = ctx + "system/leads";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "线索",
columns: [{
checkbox: true
},
{
field: 'leadsId',
title: '',
visible: false
},
{
field: 'followup',
title: '跟进状态 0未跟进1已跟进'
},
{
field: 'leadsName',
title: '线索名称'
},
{
field: 'nextTime',
title: '下次联系时间'
},
{
field: 'telephone',
title: '电话'
},
{
field: 'mobile',
title: '手机号'
},
{
field: 'email',
title: '邮箱'
},
{
field: 'address',
title: '地址'
},
{
field: 'remark',
title: '备注'
},
{
field: 'createUserId',
title: '创建人ID'
},
{
field: 'ownerUserId',
title: '负责人ID'
},
{
field: 'lastTime',
title: '最后跟进时间'
},
{
field: 'lastContent',
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.leadsId + '\')"><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.leadsId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,198 @@
package com.ruoyi.system.domain;
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_leads
*
* @author ruoyi
* @date 2021-04-06
*/
public class WkCrmLeads extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long leadsId;
/** 跟进状态 0未跟进1已跟进 */
@Excel(name = "跟进状态 0未跟进1已跟进")
private Long followup;
/** 线索名称 */
@Excel(name = "线索名称")
private String leadsName;
/** 下次联系时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "下次联系时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date nextTime;
/** 电话 */
@Excel(name = "电话")
private String telephone;
/** 手机号 */
@Excel(name = "手机号")
private String mobile;
/** 邮箱 */
@Excel(name = "邮箱")
private String email;
/** 地址 */
@Excel(name = "地址")
private String address;
/** 创建人ID */
@Excel(name = "创建人ID")
private Long createUserId;
/** 负责人ID */
@Excel(name = "负责人ID")
private Long ownerUserId;
/** 最后跟进时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后跟进时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastTime;
/** 最后一条跟进记录 */
@Excel(name = "最后一条跟进记录")
private String lastContent;
public void setLeadsId(Long leadsId)
{
this.leadsId = leadsId;
}
public Long getLeadsId()
{
return leadsId;
}
public void setFollowup(Long followup)
{
this.followup = followup;
}
public Long getFollowup()
{
return followup;
}
public void setLeadsName(String leadsName)
{
this.leadsName = leadsName;
}
public String getLeadsName()
{
return leadsName;
}
public void setNextTime(Date nextTime)
{
this.nextTime = nextTime;
}
public Date getNextTime()
{
return nextTime;
}
public void setTelephone(String telephone)
{
this.telephone = telephone;
}
public String getTelephone()
{
return telephone;
}
public void setMobile(String mobile)
{
this.mobile = mobile;
}
public String getMobile()
{
return mobile;
}
public void setEmail(String email)
{
this.email = email;
}
public String getEmail()
{
return email;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setCreateUserId(Long createUserId)
{
this.createUserId = createUserId;
}
public Long getCreateUserId()
{
return createUserId;
}
public void setOwnerUserId(Long ownerUserId)
{
this.ownerUserId = ownerUserId;
}
public Long getOwnerUserId()
{
return ownerUserId;
}
public void setLastTime(Date lastTime)
{
this.lastTime = lastTime;
}
public Date getLastTime()
{
return lastTime;
}
public void setLastContent(String lastContent)
{
this.lastContent = lastContent;
}
public String getLastContent()
{
return lastContent;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("leadsId", getLeadsId())
.append("followup", getFollowup())
.append("leadsName", getLeadsName())
.append("nextTime", getNextTime())
.append("telephone", getTelephone())
.append("mobile", getMobile())
.append("email", getEmail())
.append("address", getAddress())
.append("remark", getRemark())
.append("createUserId", getCreateUserId())
.append("ownerUserId", getOwnerUserId())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("lastTime", getLastTime())
.append("lastContent", getLastContent())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.WkCrmLeads;
/**
* 线索Mapper接口
*
* @author ruoyi
* @date 2021-04-06
*/
public interface WkCrmLeadsMapper
{
/**
* 查询线索
*
* @param leadsId 线索ID
* @return 线索
*/
public WkCrmLeads selectWkCrmLeadsById(Long leadsId);
/**
* 查询线索列表
*
* @param wkCrmLeads 线索
* @return 线索集合
*/
public List<WkCrmLeads> selectWkCrmLeadsList(WkCrmLeads wkCrmLeads);
/**
* 新增线索
*
* @param wkCrmLeads 线索
* @return 结果
*/
public int insertWkCrmLeads(WkCrmLeads wkCrmLeads);
/**
* 修改线索
*
* @param wkCrmLeads 线索
* @return 结果
*/
public int updateWkCrmLeads(WkCrmLeads wkCrmLeads);
/**
* 删除线索
*
* @param leadsId 线索ID
* @return 结果
*/
public int deleteWkCrmLeadsById(Long leadsId);
/**
* 批量删除线索
*
* @param leadsIds 需要删除的数据ID
* @return 结果
*/
public int deleteWkCrmLeadsByIds(String[] leadsIds);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.WkCrmLeads;
/**
* 线索Service接口
*
* @author ruoyi
* @date 2021-04-06
*/
public interface IWkCrmLeadsService
{
/**
* 查询线索
*
* @param leadsId 线索ID
* @return 线索
*/
public WkCrmLeads selectWkCrmLeadsById(Long leadsId);
/**
* 查询线索列表
*
* @param wkCrmLeads 线索
* @return 线索集合
*/
public List<WkCrmLeads> selectWkCrmLeadsList(WkCrmLeads wkCrmLeads);
/**
* 新增线索
*
* @param wkCrmLeads 线索
* @return 结果
*/
public int insertWkCrmLeads(WkCrmLeads wkCrmLeads);
/**
* 修改线索
*
* @param wkCrmLeads 线索
* @return 结果
*/
public int updateWkCrmLeads(WkCrmLeads wkCrmLeads);
/**
* 批量删除线索
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteWkCrmLeadsByIds(String ids);
/**
* 删除线索信息
*
* @param leadsId 线索ID
* @return 结果
*/
public int deleteWkCrmLeadsById(Long leadsId);
}

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.WkCrmLeadsMapper;
import com.ruoyi.system.domain.WkCrmLeads;
import com.ruoyi.system.service.IWkCrmLeadsService;
import com.ruoyi.common.core.text.Convert;
/**
* 线索Service业务层处理
*
* @author ruoyi
* @date 2021-04-06
*/
@Service
public class WkCrmLeadsServiceImpl implements IWkCrmLeadsService
{
@Autowired
private WkCrmLeadsMapper wkCrmLeadsMapper;
/**
* 查询线索
*
* @param leadsId 线索ID
* @return 线索
*/
@Override
public WkCrmLeads selectWkCrmLeadsById(Long leadsId)
{
return wkCrmLeadsMapper.selectWkCrmLeadsById(leadsId);
}
/**
* 查询线索列表
*
* @param wkCrmLeads 线索
* @return 线索
*/
@Override
public List<WkCrmLeads> selectWkCrmLeadsList(WkCrmLeads wkCrmLeads)
{
return wkCrmLeadsMapper.selectWkCrmLeadsList(wkCrmLeads);
}
/**
* 新增线索
*
* @param wkCrmLeads 线索
* @return 结果
*/
@Override
public int insertWkCrmLeads(WkCrmLeads wkCrmLeads)
{
wkCrmLeads.setCreateTime(DateUtils.getNowDate());
return wkCrmLeadsMapper.insertWkCrmLeads(wkCrmLeads);
}
/**
* 修改线索
*
* @param wkCrmLeads 线索
* @return 结果
*/
@Override
public int updateWkCrmLeads(WkCrmLeads wkCrmLeads)
{
wkCrmLeads.setUpdateTime(DateUtils.getNowDate());
return wkCrmLeadsMapper.updateWkCrmLeads(wkCrmLeads);
}
/**
* 删除线索对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteWkCrmLeadsByIds(String ids)
{
return wkCrmLeadsMapper.deleteWkCrmLeadsByIds(Convert.toStrArray(ids));
}
/**
* 删除线索信息
*
* @param leadsId 线索ID
* @return 结果
*/
@Override
public int deleteWkCrmLeadsById(Long leadsId)
{
return wkCrmLeadsMapper.deleteWkCrmLeadsById(leadsId);
}
}

View File

@ -0,0 +1,119 @@
<?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.WkCrmLeadsMapper">
<resultMap type="WkCrmLeads" id="WkCrmLeadsResult">
<result property="leadsId" column="leads_id" />
<result property="followup" column="followup" />
<result property="leadsName" column="leads_name" />
<result property="nextTime" column="next_time" />
<result property="telephone" column="telephone" />
<result property="mobile" column="mobile" />
<result property="email" column="email" />
<result property="address" column="address" />
<result property="remark" column="remark" />
<result property="createUserId" column="create_user_id" />
<result property="ownerUserId" column="owner_user_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="lastTime" column="last_time" />
<result property="lastContent" column="last_content" />
</resultMap>
<sql id="selectWkCrmLeadsVo">
select leads_id, followup, leads_name, next_time, telephone, mobile, email, address, remark, create_user_id, owner_user_id, create_time, update_time, last_time, last_content from wk_crm_leads
</sql>
<select id="selectWkCrmLeadsList" parameterType="WkCrmLeads" resultMap="WkCrmLeadsResult">
<include refid="selectWkCrmLeadsVo"/>
<where>
<if test="followup != null "> and followup = #{followup}</if>
<if test="leadsName != null and leadsName != ''"> and leads_name like concat('%', #{leadsName}, '%')</if>
<if test="nextTime != null "> and next_time = #{nextTime}</if>
<if test="telephone != null and telephone != ''"> and telephone = #{telephone}</if>
<if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
<if test="email != null and email != ''"> and email = #{email}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="createUserId != null "> and create_user_id = #{createUserId}</if>
<if test="ownerUserId != null "> and owner_user_id = #{ownerUserId}</if>
<if test="lastTime != null "> and last_time = #{lastTime}</if>
<if test="lastContent != null and lastContent != ''"> and last_content = #{lastContent}</if>
</where>
</select>
<select id="selectWkCrmLeadsById" parameterType="Long" resultMap="WkCrmLeadsResult">
<include refid="selectWkCrmLeadsVo"/>
where leads_id = #{leadsId}
</select>
<insert id="insertWkCrmLeads" parameterType="WkCrmLeads" useGeneratedKeys="true" keyProperty="leadsId">
insert into wk_crm_leads
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="followup != null">followup,</if>
<if test="leadsName != null">leads_name,</if>
<if test="nextTime != null">next_time,</if>
<if test="telephone != null">telephone,</if>
<if test="mobile != null">mobile,</if>
<if test="email != null">email,</if>
<if test="address != null">address,</if>
<if test="remark != null">remark,</if>
<if test="createUserId != null">create_user_id,</if>
<if test="ownerUserId != null">owner_user_id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="lastTime != null">last_time,</if>
<if test="lastContent != null">last_content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="followup != null">#{followup},</if>
<if test="leadsName != null">#{leadsName},</if>
<if test="nextTime != null">#{nextTime},</if>
<if test="telephone != null">#{telephone},</if>
<if test="mobile != null">#{mobile},</if>
<if test="email != null">#{email},</if>
<if test="address != null">#{address},</if>
<if test="remark != null">#{remark},</if>
<if test="createUserId != null">#{createUserId},</if>
<if test="ownerUserId != null">#{ownerUserId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="lastTime != null">#{lastTime},</if>
<if test="lastContent != null">#{lastContent},</if>
</trim>
</insert>
<update id="updateWkCrmLeads" parameterType="WkCrmLeads">
update wk_crm_leads
<trim prefix="SET" suffixOverrides=",">
<if test="followup != null">followup = #{followup},</if>
<if test="leadsName != null">leads_name = #{leadsName},</if>
<if test="nextTime != null">next_time = #{nextTime},</if>
<if test="telephone != null">telephone = #{telephone},</if>
<if test="mobile != null">mobile = #{mobile},</if>
<if test="email != null">email = #{email},</if>
<if test="address != null">address = #{address},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createUserId != null">create_user_id = #{createUserId},</if>
<if test="ownerUserId != null">owner_user_id = #{ownerUserId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="lastTime != null">last_time = #{lastTime},</if>
<if test="lastContent != null">last_content = #{lastContent},</if>
</trim>
where leads_id = #{leadsId}
</update>
<delete id="deleteWkCrmLeadsById" parameterType="Long">
delete from wk_crm_leads where leads_id = #{leadsId}
</delete>
<delete id="deleteWkCrmLeadsByIds" parameterType="String">
delete from wk_crm_leads where leads_id in
<foreach item="leadsId" collection="array" open="(" separator="," close=")">
#{leadsId}
</foreach>
</delete>
</mapper>