消费者分销申请

This commit is contained in:
kuang.yifei@iwhalecloud.com 2022-08-11 17:14:15 +08:00
parent 6742b6d51d
commit e65889f4bf
9 changed files with 769 additions and 0 deletions

View File

@ -0,0 +1,136 @@
package com.ghy.web.controller.customer;
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.*;
import com.ghy.common.annotation.Log;
import com.ghy.common.enums.BusinessType;
import com.ghy.customer.domain.CustomerPlace;
import com.ghy.customer.service.ICustomerPlaceService;
import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.utils.poi.ExcelUtil;
import com.ghy.common.core.page.TableDataInfo;
/**
* 分销申请Controller
*
* @author clunt
* @date 2022-08-11
*/
@Controller
@RequestMapping("/customer/place")
public class CustomerPlaceController extends BaseController
{
private String prefix = "customer/place";
@Autowired
private ICustomerPlaceService customerPlaceService;
@RequiresPermissions("customer:place:view")
@GetMapping()
public String place()
{
return prefix + "/place";
}
/**
* 查询分销申请列表
*/
@RequiresPermissions("customer:place:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(CustomerPlace customerPlace)
{
startPage();
List<CustomerPlace> list = customerPlaceService.selectCustomerPlaceList(customerPlace);
return getDataTable(list);
}
/**
* App查询分销申请列表
*/
@PostMapping("/app/list")
@ResponseBody
public TableDataInfo appList(@RequestBody CustomerPlace customerPlace)
{
startPage();
List<CustomerPlace> list = customerPlaceService.selectCustomerPlaceList(customerPlace);
return getDataTable(list);
}
/**
* 导出分销申请列表
*/
@RequiresPermissions("customer:place:export")
@Log(title = "分销申请", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(CustomerPlace customerPlace)
{
List<CustomerPlace> list = customerPlaceService.selectCustomerPlaceList(customerPlace);
ExcelUtil<CustomerPlace> util = new ExcelUtil<CustomerPlace>(CustomerPlace.class);
return util.exportExcel(list, "分销申请数据");
}
/**
* 新增分销申请
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存分销申请
*/
@RequiresPermissions("customer:place:add")
@Log(title = "分销申请", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(CustomerPlace customerPlace)
{
return toAjax(customerPlaceService.insertCustomerPlace(customerPlace));
}
/**
* 修改分销申请
*/
@RequiresPermissions("customer:place:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") String id, ModelMap mmap)
{
CustomerPlace customerPlace = customerPlaceService.selectCustomerPlaceById(id);
mmap.put("customerPlace", customerPlace);
return prefix + "/edit";
}
/**
* 修改保存分销申请
*/
@RequiresPermissions("customer:place:edit")
@Log(title = "分销申请", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(CustomerPlace customerPlace)
{
return toAjax(customerPlaceService.updateCustomerPlace(customerPlace));
}
/**
* 删除分销申请
*/
@RequiresPermissions("customer:place:remove")
@Log(title = "分销申请", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(customerPlaceService.deleteCustomerPlaceByIds(ids));
}
}

View File

@ -0,0 +1,55 @@
<!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-place-add">
<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">关联消费者id</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="phone" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">城市id</label>
<div class="col-sm-8">
<input name="city" 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>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "customer/place"
$("#form-place-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-place-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,56 @@
<!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-place-edit" th:object="${customerPlace}">
<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="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联消费者id</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="phone" th:field="*{phone}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">城市id</label>
<div class="col-sm-8">
<input name="city" th:field="*{city}" 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>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "customer/place";
$("#form-place-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-place-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,114 @@
<!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>关联消费者id</label>
<input type="text" name="customerId"/>
</li>
<li>
<label>注册手机号:</label>
<input type="text" name="phone"/>
</li>
<li>
<label>城市id</label>
<input type="text" name="city"/>
</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="customer:place:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="customer:place:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="customer:place:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="customer:place: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('customer:place:edit')}]];
var removeFlag = [[${@permission.hasPermi('customer:place:remove')}]];
var prefix = ctx + "customer/place";
$(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: 'name',
title: '名字'
},
{
field: 'customerId',
title: '关联消费者id'
},
{
field: 'phone',
title: '注册手机号'
},
{
field: 'city',
title: '城市id'
},
{
field: 'remark',
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>

View File

@ -0,0 +1,98 @@
package com.ghy.customer.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
/**
* 分销申请对象 customer_place
*
* @author clunt
* @date 2022-08-11
*/
public class CustomerPlace extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private String id;
/** 名字 */
@Excel(name = "名字")
private String name;
/** 关联消费者id */
@Excel(name = "关联消费者id")
private Long customerId;
/** 注册手机号 */
@Excel(name = "注册手机号")
private String phone;
/** 城市id */
@Excel(name = "城市id")
private Long city;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setCustomerId(Long customerId)
{
this.customerId = customerId;
}
public Long getCustomerId()
{
return customerId;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setCity(Long city)
{
this.city = city;
}
public Long getCity()
{
return city;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("customerId", getCustomerId())
.append("phone", getPhone())
.append("city", getCity())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ghy.customer.mapper;
import java.util.List;
import com.ghy.customer.domain.CustomerPlace;
/**
* 分销申请Mapper接口
*
* @author clunt
* @date 2022-08-11
*/
public interface CustomerPlaceMapper
{
/**
* 查询分销申请
*
* @param id 分销申请主键
* @return 分销申请
*/
public CustomerPlace selectCustomerPlaceById(String id);
/**
* 查询分销申请列表
*
* @param customerPlace 分销申请
* @return 分销申请集合
*/
public List<CustomerPlace> selectCustomerPlaceList(CustomerPlace customerPlace);
/**
* 新增分销申请
*
* @param customerPlace 分销申请
* @return 结果
*/
public int insertCustomerPlace(CustomerPlace customerPlace);
/**
* 修改分销申请
*
* @param customerPlace 分销申请
* @return 结果
*/
public int updateCustomerPlace(CustomerPlace customerPlace);
/**
* 删除分销申请
*
* @param id 分销申请主键
* @return 结果
*/
public int deleteCustomerPlaceById(String id);
/**
* 批量删除分销申请
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCustomerPlaceByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ghy.customer.service;
import java.util.List;
import com.ghy.customer.domain.CustomerPlace;
/**
* 分销申请Service接口
*
* @author clunt
* @date 2022-08-11
*/
public interface ICustomerPlaceService
{
/**
* 查询分销申请
*
* @param id 分销申请主键
* @return 分销申请
*/
public CustomerPlace selectCustomerPlaceById(String id);
/**
* 查询分销申请列表
*
* @param customerPlace 分销申请
* @return 分销申请集合
*/
public List<CustomerPlace> selectCustomerPlaceList(CustomerPlace customerPlace);
/**
* 新增分销申请
*
* @param customerPlace 分销申请
* @return 结果
*/
public int insertCustomerPlace(CustomerPlace customerPlace);
/**
* 修改分销申请
*
* @param customerPlace 分销申请
* @return 结果
*/
public int updateCustomerPlace(CustomerPlace customerPlace);
/**
* 批量删除分销申请
*
* @param ids 需要删除的分销申请主键集合
* @return 结果
*/
public int deleteCustomerPlaceByIds(String ids);
/**
* 删除分销申请信息
*
* @param id 分销申请主键
* @return 结果
*/
public int deleteCustomerPlaceById(String id);
}

View File

@ -0,0 +1,96 @@
package com.ghy.customer.service.impl;
import java.util.List;
import com.ghy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ghy.customer.mapper.CustomerPlaceMapper;
import com.ghy.customer.domain.CustomerPlace;
import com.ghy.customer.service.ICustomerPlaceService;
import com.ghy.common.core.text.Convert;
/**
* 分销申请Service业务层处理
*
* @author clunt
* @date 2022-08-11
*/
@Service
public class CustomerPlaceServiceImpl implements ICustomerPlaceService
{
@Autowired
private CustomerPlaceMapper customerPlaceMapper;
/**
* 查询分销申请
*
* @param id 分销申请主键
* @return 分销申请
*/
@Override
public CustomerPlace selectCustomerPlaceById(String id)
{
return customerPlaceMapper.selectCustomerPlaceById(id);
}
/**
* 查询分销申请列表
*
* @param customerPlace 分销申请
* @return 分销申请
*/
@Override
public List<CustomerPlace> selectCustomerPlaceList(CustomerPlace customerPlace)
{
return customerPlaceMapper.selectCustomerPlaceList(customerPlace);
}
/**
* 新增分销申请
*
* @param customerPlace 分销申请
* @return 结果
*/
@Override
public int insertCustomerPlace(CustomerPlace customerPlace)
{
customerPlace.setCreateTime(DateUtils.getNowDate());
return customerPlaceMapper.insertCustomerPlace(customerPlace);
}
/**
* 修改分销申请
*
* @param customerPlace 分销申请
* @return 结果
*/
@Override
public int updateCustomerPlace(CustomerPlace customerPlace)
{
customerPlace.setUpdateTime(DateUtils.getNowDate());
return customerPlaceMapper.updateCustomerPlace(customerPlace);
}
/**
* 批量删除分销申请
*
* @param ids 需要删除的分销申请主键
* @return 结果
*/
@Override
public int deleteCustomerPlaceByIds(String ids)
{
return customerPlaceMapper.deleteCustomerPlaceByIds(Convert.toStrArray(ids));
}
/**
* 删除分销申请信息
*
* @param id 分销申请主键
* @return 结果
*/
@Override
public int deleteCustomerPlaceById(String id)
{
return customerPlaceMapper.deleteCustomerPlaceById(id);
}
}

View File

@ -0,0 +1,92 @@
<?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.ghy.customer.mapper.CustomerPlaceMapper">
<resultMap type="com.ghy.customer.domain.CustomerPlace" id="CustomerPlaceResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="customerId" column="customer_id" />
<result property="phone" column="phone" />
<result property="city" column="city" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectCustomerPlaceVo">
select id, name, customer_id, phone, city, create_by, create_time, update_by, update_time, remark from customer_place
</sql>
<select id="selectCustomerPlaceList" parameterType="com.ghy.customer.domain.CustomerPlace" resultMap="CustomerPlaceResult">
<include refid="selectCustomerPlaceVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="city != null "> and city = #{city}</if>
</where>
</select>
<select id="selectCustomerPlaceById" parameterType="String" resultMap="CustomerPlaceResult">
<include refid="selectCustomerPlaceVo"/>
where id = #{id}
</select>
<insert id="insertCustomerPlace" parameterType="com.ghy.customer.domain.CustomerPlace" useGeneratedKeys="true" keyProperty="id">
insert into customer_place
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="customerId != null">customer_id,</if>
<if test="phone != null">phone,</if>
<if test="city != null">city,</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>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="customerId != null">#{customerId},</if>
<if test="phone != null">#{phone},</if>
<if test="city != null">#{city},</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>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateCustomerPlace" parameterType="com.ghy.customer.domain.CustomerPlace">
update customer_place
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="city != null">city = #{city},</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>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomerPlaceById" parameterType="String">
delete from customer_place where id = #{id}
</delete>
<delete id="deleteCustomerPlaceByIds" parameterType="String">
delete from customer_place where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>