Commit 34336823 authored by lixinglin's avatar lixinglin

线索管理

parent 0d4218e0
package com.ruoyi.system.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.ThreadInfo;
import com.ruoyi.system.service.IThreadInfoService;
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.*;
import java.util.List;
/**
* 线索信息Controller
*
* @author ruoyi
* @date 2023-11-27
*/
@Controller
@RequestMapping("/thread_info/info")
public class ThreadInfoController extends BaseController {
private String prefix = "thread_info";
@Autowired
private IThreadInfoService threadInfoService;
@RequiresPermissions("system:info:view")
@GetMapping()
public String info() {
return prefix + "/info";
}
/**
* 查询线索信息列表
*/
@RequiresPermissions("system:info:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ThreadInfo threadInfo) {
startPage();
List<ThreadInfo> list = threadInfoService.selectThreadInfoList(threadInfo);
return getDataTable(list);
}
/**
* 导出线索信息列表
*/
@RequiresPermissions("system:info:export")
@Log(title = "线索信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ThreadInfo threadInfo) {
List<ThreadInfo> list = threadInfoService.selectThreadInfoList(threadInfo);
ExcelUtil<ThreadInfo> util = new ExcelUtil<ThreadInfo>(ThreadInfo.class);
return util.exportExcel(list, "线索信息数据");
}
/**
* 新增线索信息
*/
@GetMapping("/add")
public String add() {
return prefix + "/add";
}
/**
* 新增保存线索信息
*/
@RequiresPermissions("system:info:add")
@Log(title = "线索信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ThreadInfo threadInfo) {
return toAjax(threadInfoService.insertThreadInfo(threadInfo));
}
/**
* 修改线索信息
*/
@RequiresPermissions("system:info:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
ThreadInfo threadInfo = threadInfoService.selectThreadInfoById(id);
mmap.put("threadInfo", threadInfo);
return prefix + "/edit";
}
/**
* 修改保存线索信息
*/
@RequiresPermissions("system:info:edit")
@Log(title = "线索信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ThreadInfo threadInfo) {
return toAjax(threadInfoService.updateThreadInfo(threadInfo));
}
/**
* 删除线索信息
*/
@RequiresPermissions("system:info:remove")
@Log(title = "线索信息", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids) {
return toAjax(threadInfoService.deleteThreadInfoByIds(ids));
}
}
package com.ruoyi.system.domain;
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;
/**
* 线索信息对象 thread_info
*
* @author ruoyi
* @date 2023-11-27
*/
public class ThreadInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 手机号 */
@Excel(name = "手机号")
private String phone;
/** 地址 */
@Excel(name = "地址")
private String address;
/** 数据来源 1:立业云平台 */
@Excel(name = "数据来源 1:立业云平台")
private String dataSource;
/** 需求类型 字典表维护 1:土地 2:载体 3:其他 */
@Excel(name = "需求类型 字典表维护 1:土地 2:载体 3:其他")
private String needType;
/** 乐观锁 */
@Excel(name = "乐观锁")
private Long version;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setDataSource(String dataSource)
{
this.dataSource = dataSource;
}
public String getDataSource()
{
return dataSource;
}
public void setNeedType(String needType)
{
this.needType = needType;
}
public String getNeedType()
{
return needType;
}
public void setVersion(Long version)
{
this.version = version;
}
public Long getVersion()
{
return version;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("phone", getPhone())
.append("address", getAddress())
.append("dataSource", getDataSource())
.append("needType", getNeedType())
.append("remark", getRemark())
.append("version", getVersion())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.ThreadInfo;
import java.util.List;
/**
* 线索信息Mapper接口
*
* @author ruoyi
* @date 2023-11-27
*/
public interface ThreadInfoMapper
{
/**
* 查询线索信息
*
* @param id 线索信息主键
* @return 线索信息
*/
public ThreadInfo selectThreadInfoById(Long id);
/**
* 查询线索信息列表
*
* @param threadInfo 线索信息
* @return 线索信息集合
*/
public List<ThreadInfo> selectThreadInfoList(ThreadInfo threadInfo);
/**
* 新增线索信息
*
* @param threadInfo 线索信息
* @return 结果
*/
public int insertThreadInfo(ThreadInfo threadInfo);
/**
* 修改线索信息
*
* @param threadInfo 线索信息
* @return 结果
*/
public int updateThreadInfo(ThreadInfo threadInfo);
/**
* 删除线索信息
*
* @param id 线索信息主键
* @return 结果
*/
public int deleteThreadInfoById(Long id);
/**
* 批量删除线索信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteThreadInfoByIds(String[] ids);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.ThreadInfo;
/**
* 线索信息Service接口
*
* @author ruoyi
* @date 2023-11-27
*/
public interface IThreadInfoService
{
/**
* 查询线索信息
*
* @param id 线索信息主键
* @return 线索信息
*/
public ThreadInfo selectThreadInfoById(Long id);
/**
* 查询线索信息列表
*
* @param threadInfo 线索信息
* @return 线索信息集合
*/
public List<ThreadInfo> selectThreadInfoList(ThreadInfo threadInfo);
/**
* 新增线索信息
*
* @param threadInfo 线索信息
* @return 结果
*/
public int insertThreadInfo(ThreadInfo threadInfo);
/**
* 修改线索信息
*
* @param threadInfo 线索信息
* @return 结果
*/
public int updateThreadInfo(ThreadInfo threadInfo);
/**
* 批量删除线索信息
*
* @param ids 需要删除的线索信息主键集合
* @return 结果
*/
public int deleteThreadInfoByIds(String ids);
/**
* 删除线索信息信息
*
* @param id 线索信息主键
* @return 结果
*/
public int deleteThreadInfoById(Long id);
}
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.ThreadInfo;
import com.ruoyi.system.mapper.ThreadInfoMapper;
import com.ruoyi.system.service.IThreadInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 线索信息Service业务层处理
*
* @author ruoyi
* @date 2023-11-27
*/
@Service
public class ThreadInfoServiceImpl implements IThreadInfoService
{
@Autowired
private ThreadInfoMapper threadInfoMapper;
/**
* 查询线索信息
*
* @param id 线索信息主键
* @return 线索信息
*/
@Override
public ThreadInfo selectThreadInfoById(Long id)
{
return threadInfoMapper.selectThreadInfoById(id);
}
/**
* 查询线索信息列表
*
* @param threadInfo 线索信息
* @return 线索信息
*/
@Override
public List<ThreadInfo> selectThreadInfoList(ThreadInfo threadInfo)
{
return threadInfoMapper.selectThreadInfoList(threadInfo);
}
/**
* 新增线索信息
*
* @param threadInfo 线索信息
* @return 结果
*/
@Override
public int insertThreadInfo(ThreadInfo threadInfo)
{
threadInfo.setCreateTime(DateUtils.getNowDate());
return threadInfoMapper.insertThreadInfo(threadInfo);
}
/**
* 修改线索信息
*
* @param threadInfo 线索信息
* @return 结果
*/
@Override
public int updateThreadInfo(ThreadInfo threadInfo)
{
threadInfo.setUpdateTime(DateUtils.getNowDate());
return threadInfoMapper.updateThreadInfo(threadInfo);
}
/**
* 批量删除线索信息
*
* @param ids 需要删除的线索信息主键
* @return 结果
*/
@Override
public int deleteThreadInfoByIds(String ids)
{
return threadInfoMapper.deleteThreadInfoByIds(Convert.toStrArray(ids));
}
/**
* 删除线索信息信息
*
* @param id 线索信息主键
* @return 结果
*/
@Override
public int deleteThreadInfoById(Long id)
{
return threadInfoMapper.deleteThreadInfoById(id);
}
}
<?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.ThreadInfoMapper">
<resultMap type="ThreadInfo" id="ThreadInfoResult">
<result property="id" column="id" />
<result property="phone" column="phone" />
<result property="address" column="address" />
<result property="dataSource" column="data_source" />
<result property="needType" column="need_type" />
<result property="remark" column="remark" />
<result property="version" column="version" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectThreadInfoVo">
select id, phone, address, data_source, need_type, remark, version, create_by, create_time, update_by, update_time from thread_info
</sql>
<select id="selectThreadInfoList" parameterType="ThreadInfo" resultMap="ThreadInfoResult">
<include refid="selectThreadInfoVo"/>
<where>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="dataSource != null and dataSource != ''"> and data_source = #{dataSource}</if>
<if test="needType != null and needType != ''"> and need_type = #{needType}</if>
<if test="version != null "> and version = #{version}</if>
</where>
</select>
<select id="selectThreadInfoById" parameterType="Long" resultMap="ThreadInfoResult">
<include refid="selectThreadInfoVo"/>
where id = #{id}
</select>
<insert id="insertThreadInfo" parameterType="ThreadInfo" useGeneratedKeys="true" keyProperty="id">
insert into thread_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="phone != null">phone,</if>
<if test="address != null">address,</if>
<if test="dataSource != null">data_source,</if>
<if test="needType != null">need_type,</if>
<if test="remark != null">remark,</if>
<if test="version != null">version,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phone != null">#{phone},</if>
<if test="address != null">#{address},</if>
<if test="dataSource != null">#{dataSource},</if>
<if test="needType != null">#{needType},</if>
<if test="remark != null">#{remark},</if>
<if test="version != null">#{version},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateThreadInfo" parameterType="ThreadInfo">
update thread_info
<trim prefix="SET" suffixOverrides=",">
<if test="phone != null">phone = #{phone},</if>
<if test="address != null">address = #{address},</if>
<if test="dataSource != null">data_source = #{dataSource},</if>
<if test="needType != null">need_type = #{needType},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="version != null">version = #{version},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteThreadInfoById" parameterType="Long">
delete from thread_info where id = #{id}
</delete>
<delete id="deleteThreadInfoByIds" parameterType="String">
delete from thread_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增线索信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-info-add">
<div class="form-group">
<label class="col-sm-3 control-label">手机号:</label>
<div class="col-sm-8">
<input name="phone" 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">数据来源 1:立业云平台:</label>
<div class="col-sm-8">
<input name="dataSource" 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="remark" 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="version" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/info"
$("#form-info-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-info-add').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改线索信息')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-info-edit" th:object="${threadInfo}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">手机号:</label>
<div class="col-sm-8">
<input name="phone" th:field="*{phone}" 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">数据来源 1:立业云平台:</label>
<div class="col-sm-8">
<input name="dataSource" th:field="*{dataSource}" 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="remark" th:field="*{remark}" 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="version" th:field="*{version}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/info";
$("#form-info-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-info-edit').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!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="phone"/>
</li>
<li>
<label>地址:</label>
<input type="text" name="address"/>
</li>
<li>
<label>数据来源:</label>
<select id="dataSource" name="dataSource" class="form-control m-b"
th:with="type=${@dict.getType('lyy_channel_source')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>需求类型:</label>
<select id="needType" name="needType" class="form-control m-b"
th:with="type=${@dict.getType('lyy_thread_info_needtype')}">
<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:info:add">-->
<!-- <i class="fa fa-plus"></i> 添加-->
<!-- </a>-->
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:info:edit">-->
<!-- <i class="fa fa-edit"></i> 修改-->
<!-- </a>-->
<!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:info:remove">-->
<!-- <i class="fa fa-remove"></i> 删除-->
<!-- </a>-->
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:info: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:info:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:info:remove')}]];
var prefix = ctx + "thread_info/info";
var needTypes = [[${@dict.getType('lyy_thread_info_needtype')}]];
var datasources = [[${@dict.getType('lyy_channel_source')}]];
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "线索信息",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键id',
visible: false
},
{
field: 'phone',
title: '手机号'
},
{
field: 'address',
title: '地址'
},
{
field: 'dataSource',
title: '数据来源',
formatter: function(value, row, index) {
return $.table.selectDictLabel(datasources, value);
}
},
{
field: 'needType',
title: '需求类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(needTypes, value);
}
},
{
field: 'remark',
title: '备注'
}
// ,
// {
// field: 'version',
// 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.id + '\')"><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.id + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
// }
]
};
$.table.init(options);
});
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment