Commit 52d3ffde authored by lcl's avatar lcl

u

parent c9375b94
package com.dsk.web.controller.business;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.domain.entity.BusinessContacts;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.system.service.IBusinessContactsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 项目联系人Controller
*
* @author lxl
* @date 2023-05-17
*/
@RestController
@RequestMapping("/business/contacts")
public class BusinessContactsController extends BaseController
{
@Autowired
private IBusinessContactsService businessContactsService;
/**
* 分页查询项目联系人列表
*/
// @PreAuthorize("@ss.hasPermi('system:contacts:list')")
@GetMapping("/list")
public TableDataInfo list(BusinessContacts businessContacts)
{
startPage();
List<BusinessContacts> list = businessContactsService.selectBusinessContactsList(businessContacts);
return getDataTable(list);
}
/**
* 新增项目联系人
*/
// @PreAuthorize("@ss.hasPermi('system:contacts:add')")
// @Log(title = "项目联系人", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody BusinessContacts businessContacts)
{
return toAjax(businessContactsService.insertBusinessContacts(businessContacts));
}
/**
* 修改项目联系人
*/
// @PreAuthorize("@ss.hasPermi('system:contacts:edit')")
// @Log(title = "项目联系人", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public AjaxResult edit(@RequestBody BusinessContacts businessContacts)
{
return toAjax(businessContactsService.updateBusinessContacts(businessContacts));
}
// /**
// * 导出项目联系人列表
// */
// @PreAuthorize("@ss.hasPermi('system:contacts:export')")
// @Log(title = "项目联系人", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, BusinessContacts businessContacts)
// {
// List<BusinessContacts> list = businessContactsService.selectBusinessContactsList(businessContacts);
// ExcelUtil<BusinessContacts> util = new ExcelUtil<BusinessContacts>(BusinessContacts.class);
// util.exportExcel(response, list, "项目联系人数据");
// }
// /**
// * 获取项目联系人详细信息
// */
// @PreAuthorize("@ss.hasPermi('system:contacts:query')")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") Long id)
// {
// return success(businessContactsService.selectBusinessContactsById(id));
// }
// /**
// * 删除项目联系人
// */
// @PreAuthorize("@ss.hasPermi('system:contacts:remove')")
// @Log(title = "项目联系人", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable Long[] ids)
// {
// return toAjax(businessContactsService.deleteBusinessContactsByIds(ids));
// }
}
package com.dsk.web.controller.business;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.business.dto.BusinessSearchDto;
import com.dsk.system.service.IBusinessOverviewService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -20,4 +24,11 @@ public class BusinessOverviewController extends BaseController {
@Autowired
private IBusinessOverviewService baseService;
/**
* 项目统计
*/
@GetMapping("/statistics")
public AjaxResult statistics(){
return AjaxResult.success(baseService.statistics(new BusinessSearchDto(SecurityUtils.getUserId())));
}
}
package com.dsk.web.controller.customer;
import com.dsk.common.annotation.RepeatSubmit;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.system.domain.customer.CustomerDecisionChain;
import com.dsk.system.domain.customer.dto.CustomerDecisionChainSearchDto;
import com.dsk.system.service.ICustomerDecisionChainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/**
* 客户决策链条
* @author lcl
* @create 2023/5/16
*/
@RestController
@RequestMapping("/customer/decision/chain")
public class CustomerDecisionChainController extends BaseController {
@Autowired
private ICustomerDecisionChainService baseService;
/**
* 获取客户决策链条列表
*/
// @PreAuthorize("@ss.hasPermi('customer:decision:chain:list')")
@GetMapping("/list")
public TableDataInfo selectPageList(CustomerDecisionChainSearchDto dto){
startPage();
return getDataTable(baseService.selectList(dto));
}
/**
* 添加客户决策链条
*/
// @PreAuthorize("@ss.hasPermi('customer:decision:chain:add')")
@PostMapping()
@RepeatSubmit()
public AjaxResult add(@RequestBody CustomerDecisionChain customerDecisionChain){
return AjaxResult.success(baseService.insert(customerDecisionChain));
}
/**
* 编辑客户决策链条
*/
// @PreAuthorize("@ss.hasPermi('customer:decision:chain:edit')")
@PutMapping()
@RepeatSubmit()
public AjaxResult edit(@RequestBody CustomerDecisionChain customerDecisionChain){
return AjaxResult.success(baseService.update(customerDecisionChain));
}
/**
* 删除客户决策链条
*/
// @PreAuthorize("@ss.hasPermi('customer:decision:chain:del')")
@DeleteMapping("/{id}")
@RepeatSubmit()
public AjaxResult del(@PathVariable("id") Long id){
return AjaxResult.success(baseService.deleteById(id));
}
}
package com.dsk.common.core.domain.entity;
import com.dsk.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 项目联系人对象 business_contacts
*
* @author lxl
* @date 2023-05-17
*/
public class BusinessContacts
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Integer id;
/** 项目id */
@Excel(name = "项目id")
private Integer businessId;
/** 姓名 */
@Excel(name = "姓名")
private String name;
/** 角色 */
@Excel(name = "角色")
private String role;
/** 公司/机关 */
@Excel(name = "公司/机关")
private String office;
/** 职位 */
@Excel(name = "职位")
private String position;
/** 联系电话 */
@Excel(name = "联系电话")
private String phone;
/** 维护人员 */
@Excel(name = "维护人员")
private String accendant;
/** 性别(1.男 2.女 0.未知) */
@Excel(name = "性别")
private Integer sex;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setBusinessId(Integer businessId)
{
this.businessId = businessId;
}
public Integer getBusinessId()
{
return businessId;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setRole(String role)
{
this.role = role;
}
public String getRole()
{
return role;
}
public void setOffice(String office)
{
this.office = office;
}
public String getOffice()
{
return office;
}
public void setPosition(String position)
{
this.position = position;
}
public String getPosition()
{
return position;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setAccendant(String accendant)
{
this.accendant = accendant;
}
public String getAccendant()
{
return accendant;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("businessId", getBusinessId())
.append("name", getName())
.append("role", getRole())
.append("office", getOffice())
.append("position", getPosition())
.append("phone", getPhone())
.append("accendant", getAccendant())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("sex", getSex())
.toString();
}
}
package com.dsk.system.domain.business.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @author lcl
* @create 2023/8/14
*/
@Data
@NoArgsConstructor
public class BusinessSearchDto implements Serializable {
/**
* 状态
*/
private Integer status;
/**
* 用户id
*/
private Long userId;
/**
* 数据权限
*/
private Map<String,Object> params;
public Map<String, Object> getParams()
{
if (params == null)
{
params = new HashMap<>();
}
return params;
}
public BusinessSearchDto(Long userId){
this.userId = userId;
}
}
package com.dsk.system.domain.customer;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* 客户决策链条(CustomerDecisionChain)实体类
*
* @author makejava
* @since 2023-05-16 15:33:45
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("customer_decision_chain")
public class CustomerDecisionChain implements Serializable {
private static final long serialVersionUID = 990085082282249053L;
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**
* 客户id
*/
private String customerId;
/**
* 姓名
*/
private String name;
/**
* 角色
*/
private String role;
/**
* 公司/机关(工作单位)
*/
private String workUnit;
/**
* 职位
*/
private String position;
/**
* 联系方式
*/
private String contactInformation;
/**
* 备注
*/
private String remark;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
* 更新人
*/
private String updateBy;
private Long updateId;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
}
......@@ -97,6 +97,13 @@ public class JskCombineSearchDto implements Serializable {
* 每页条数
*/
private Integer pageSize;
/**
* 排序字段
*/
private String orderName;
/**
* 排序类型 ASC DESC
*/
private String orderType;
}
package com.dsk.system.mapper;
import com.dsk.common.core.domain.entity.BusinessContacts;
import java.util.List;
/**
* 项目联系人Mapper接口
*
* @author lxl
* @date 2023-05-17
*/
public interface BusinessContactsMapper
{
/**
* 查询项目联系人
*
* @param id 项目联系人主键
* @return 项目联系人
*/
public BusinessContacts selectBusinessContactsById(Long id);
/**
* 查询项目联系人列表
*
* @param businessContacts 项目联系人
* @return 项目联系人集合
*/
public List<BusinessContacts> selectBusinessContactsList(BusinessContacts businessContacts);
/**
* 新增项目联系人
*
* @param businessContacts 项目联系人
* @return 结果
*/
public int insertBusinessContacts(BusinessContacts businessContacts);
/**
* 修改项目联系人
*
* @param businessContacts 项目联系人
* @return 结果
*/
public int updateBusinessContacts(BusinessContacts businessContacts);
/**
* 删除项目联系人
*
* @param id 项目联系人主键
* @return 结果
*/
public int deleteBusinessContactsById(Long id);
/**
* 批量删除项目联系人
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBusinessContactsByIds(Long[] ids);
}
//package com.dsk.system.mapper;
//
//import com.dsk.common.core.domain.entity.BusinessContacts;
//
//import java.util.List;
//
///**
// * 项目联系人Mapper接口
// *
// * @author lxl
// * @date 2023-05-17
// */
//public interface BusinessContactsMapper
//{
// /**
// * 查询项目联系人
// *
// * @param id 项目联系人主键
// * @return 项目联系人
// */
// public BusinessContacts selectBusinessContactsById(Long id);
//
// /**
// * 查询项目联系人列表
// *
// * @param businessContacts 项目联系人
// * @return 项目联系人集合
// */
// public List<BusinessContacts> selectBusinessContactsList(BusinessContacts businessContacts);
//
// /**
// * 新增项目联系人
// *
// * @param businessContacts 项目联系人
// * @return 结果
// */
// public int insertBusinessContacts(BusinessContacts businessContacts);
//
// /**
// * 修改项目联系人
// *
// * @param businessContacts 项目联系人
// * @return 结果
// */
// public int updateBusinessContacts(BusinessContacts businessContacts);
//
// /**
// * 删除项目联系人
// *
// * @param id 项目联系人主键
// * @return 结果
// */
// public int deleteBusinessContactsById(Long id);
//
// /**
// * 批量删除项目联系人
// *
// * @param ids 需要删除的数据主键集合
// * @return 结果
// */
// public int deleteBusinessContactsByIds(Long[] ids);
//}
package com.dsk.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.common.annotation.DataScope;
import com.dsk.common.core.domain.entity.BusinessInfo;
import com.dsk.system.domain.business.dto.BusinessListDto;
import com.dsk.system.domain.business.dto.BusinessSearchDto;
import com.dsk.system.domain.business.vo.BusinessLikeProjectNameListVo;
import com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto;
import com.dsk.system.domain.customer.vo.CustomerBusinessListVo;
......@@ -108,4 +110,6 @@ public interface BusinessInfoMapper extends BaseMapper<BusinessInfo> {
List<CustomerBusinessListVo> selectCustomerBusinessList(CustomerBusinessSearchDto dto);
int selectCountByStatus(BusinessSearchDto dto);
}
......@@ -2,7 +2,6 @@ package com.dsk.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.common.core.domain.entity.BusinessRelateCompany;
import com.dsk.system.domain.customer.CustomerDecisionChain;
import java.util.List;
......
package com.dsk.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.system.domain.customer.CustomerDecisionChain;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户决策链条(CustomerDecisionChain)表数据库访问层
*
* @author makejava
* @since 2023-05-16 15:33:46
*/
@Mapper
public interface CustomerDecisionChainMapper extends BaseMapper<CustomerDecisionChain> {
}
//package com.dsk.system.mapper;
//
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//import com.dsk.system.domain.customer.CustomerDecisionChain;
//import org.apache.ibatis.annotations.Mapper;
//
//
///**
// * 客户决策链条(CustomerDecisionChain)表数据库访问层
// *
// * @author makejava
// * @since 2023-05-16 15:33:46
// */
//@Mapper
//public interface CustomerDecisionChainMapper extends BaseMapper<CustomerDecisionChain> {
//
//}
//
package com.dsk.system.service;
import com.dsk.common.core.domain.entity.BusinessContacts;
import java.util.List;
/**
* 项目联系人Service接口
*
* @date 2023-05-17
*/
public interface IBusinessContactsService
{
/**
* 查询项目联系人
*
* @param id 项目联系人主键
* @return 项目联系人
*/
public BusinessContacts selectBusinessContactsById(Long id);
/**
* 查询项目联系人列表
*
* @param businessContacts 项目联系人
* @return 项目联系人集合
*/
public List<BusinessContacts> selectBusinessContactsList(BusinessContacts businessContacts);
/**
* 新增项目联系人
*
* @param businessContacts 项目联系人
* @return 结果
*/
public int insertBusinessContacts(BusinessContacts businessContacts);
/**
* 修改项目联系人
*
* @param businessContacts 项目联系人
* @return 结果
*/
public int updateBusinessContacts(BusinessContacts businessContacts);
/**
* 批量删除项目联系人
*
* @param ids 需要删除的项目联系人主键集合
* @return 结果
*/
public int deleteBusinessContactsByIds(Long[] ids);
/**
* 删除项目联系人信息
*
* @param id 项目联系人主键
* @return 结果
*/
public int deleteBusinessContactsById(Long id);
}
package com.dsk.system.service;
import com.dsk.system.domain.business.dto.BusinessSearchDto;
import java.util.Map;
/**
* @author lcl
* @create 2023/8/14
*/
public interface IBusinessOverviewService {
Map<String, Object> statistics(BusinessSearchDto dto);
}
package com.dsk.system.service;
import com.dsk.system.domain.customer.CustomerDecisionChain;
import com.dsk.system.domain.customer.dto.CustomerDecisionChainSearchDto;
import java.util.List;
/**
* 客户决策链条(CustomerDecisionChain)表服务接口
*
* @author makejava
* @since 2023-05-16 15:33:45
*/
public interface ICustomerDecisionChainService {
/**
* 查询数据列表
*/
List<CustomerDecisionChain> selectList(CustomerDecisionChainSearchDto dto);
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
CustomerDecisionChain selectById(Long id);
/**
* 新增数据
*
* @param customerDecisionChain 实例对象
* @return 实例对象
*/
boolean insert(CustomerDecisionChain customerDecisionChain);
/**
* 修改数据
*
* @param customerDecisionChain 实例对象
* @return 实例对象
*/
boolean update(CustomerDecisionChain customerDecisionChain);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
}
package com.dsk.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.dsk.common.core.domain.entity.BusinessContacts;
import com.dsk.common.core.domain.model.LoginUser;
import com.dsk.common.exception.base.BaseException;
import com.dsk.common.utils.CheckUtils;
import com.dsk.common.utils.DateUtils;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.mapper.BusinessContactsMapper;
import com.dsk.system.service.IBusinessContactsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 项目联系人Service业务层处理
*
* @author lxl
* @date 2023-05-17
*/
@Service
public class BusinessContactsServiceImpl implements IBusinessContactsService
{
@Autowired
private BusinessContactsMapper businessContactsMapper;
/**
* 查询项目联系人
*
* @param id 项目联系人主键
* @return 项目联系人
*/
@Override
public BusinessContacts selectBusinessContactsById(Long id)
{
return businessContactsMapper.selectBusinessContactsById(id);
}
/**
* 查询项目联系人列表
*
* @param businessContacts 项目联系人
* @return 项目联系人
*/
@Override
public List<BusinessContacts> selectBusinessContactsList(BusinessContacts businessContacts)
{
return businessContactsMapper.selectBusinessContactsList(businessContacts);
}
/**
* 新增项目联系人
*
* @param businessContacts 项目联系人
* @return 结果
*/
@Override
@Transactional
public int insertBusinessContacts(BusinessContacts businessContacts)
{
if(!CheckUtils.isPhone(businessContacts.getPhone())) throw new BaseException("500","请输入正确的电话号码");
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isEmpty(loginUser)) throw new BaseException("请登录");
//维护人员为当前登录用户
businessContacts.setAccendant(loginUser.getUser().getNickName());
return businessContactsMapper.insertBusinessContacts(businessContacts);
}
/**
* 修改项目联系人
*
* @param businessContacts 项目联系人
* @return 结果
*/
@Override
@Transactional
public int updateBusinessContacts(BusinessContacts businessContacts)
{
if(!CheckUtils.isPhone(businessContacts.getPhone())) throw new BaseException("500","请输入正确的电话号码");
businessContacts.setUpdateTime(DateUtils.getNowDate());
return businessContactsMapper.updateBusinessContacts(businessContacts);
}
/**
* 批量删除项目联系人
*
* @param ids 需要删除的项目联系人主键
* @return 结果
*/
@Override
public int deleteBusinessContactsByIds(Long[] ids)
{
return businessContactsMapper.deleteBusinessContactsByIds(ids);
}
/**
* 删除项目联系人信息
*
* @param id 项目联系人主键
* @return 结果
*/
@Override
public int deleteBusinessContactsById(Long id)
{
return businessContactsMapper.deleteBusinessContactsById(id);
}
}
package com.dsk.system.service.impl;
import com.dsk.common.annotation.DataScope;
import com.dsk.common.core.domain.BaseEntity;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.business.dto.BusinessSearchDto;
import com.dsk.system.mapper.BusinessInfoMapper;
import com.dsk.system.service.IBusinessOverviewService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
* @author lcl
* @create 2023/8/14
*/
@Service
public class BusinessOverviewServiceImpl implements IBusinessOverviewService {
@Resource
private BusinessInfoMapper businessInfoMapper;
@Override
@DataScope(userAlias = "u",deptAlias = "d")
public Map<String, Object> statistics(BusinessSearchDto dto) {
Map<String, Object> resultMap = new HashMap<>();
//总
resultMap.put("totalCount",businessInfoMapper.selectCountByStatus(dto));
//储备
dto.setStatus(0);
resultMap.put("reserveCount",businessInfoMapper.selectCountByStatus(dto));
//跟进
dto.setStatus(1);
resultMap.put("followUpCount",businessInfoMapper.selectCountByStatus(dto));
//中标(已合作)
dto.setStatus(2);
resultMap.put("bidCount",businessInfoMapper.selectCountByStatus(dto));
return resultMap;
}
}
package com.dsk.system.service.impl;
import cn.hutool.core.bean.BeanException;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.customer.CustomerDecisionChain;
import com.dsk.system.domain.customer.dto.CustomerDecisionChainSearchDto;
import com.dsk.system.mapper.CustomerDecisionChainMapper;
import com.dsk.system.service.ICustomerDecisionChainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.List;
/**
* 客户决策链条(CustomerDecisionChain)表服务实现类
*
* @author makejava
* @since 2023-05-16 15:33:45
*/
@Slf4j
@Service
public class CustomerDecisionChainServiceImpl implements ICustomerDecisionChainService {
@Resource
private CustomerDecisionChainMapper baseMapper;
@Override
public List<CustomerDecisionChain> selectList(CustomerDecisionChainSearchDto dto) {
return baseMapper.selectList(Wrappers.<CustomerDecisionChain>lambdaQuery()
.eq(CustomerDecisionChain::getCustomerId, dto.getCustomerId())
.orderByDesc(CustomerDecisionChain::getCreateTime));
}
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public CustomerDecisionChain selectById(Long id) {
return baseMapper.selectById(id);
}
/**
* 新增数据
*
* @param customerDecisionChain 实例对象
* @return 实例对象
*/
@Override
public boolean insert(CustomerDecisionChain customerDecisionChain) {
verifyParameter(customerDecisionChain);
return baseMapper.insert(customerDecisionChain) > 0;
}
/**
* 修改数据
*
* @param customerDecisionChain 实例对象
* @return 实例对象
*/
@Override
public boolean update(CustomerDecisionChain customerDecisionChain) {
if (ObjectUtils.isEmpty(customerDecisionChain.getId())) throw new BeanException("id不能为空!");
verifyParameter(customerDecisionChain);
return baseMapper.updateById(customerDecisionChain) > 0;
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return baseMapper.deleteById(id) > 0;
}
/**
* 参数验证
*
* @param customerDecisionChain
*/
private void verifyParameter(CustomerDecisionChain customerDecisionChain) {
if (ObjectUtils.isEmpty(customerDecisionChain.getCustomerId())) throw new BeanException("客户id不能为空!");
customerDecisionChain.setUpdateId(SecurityUtils.getUserId());
customerDecisionChain.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
}
}
<?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.dsk.system.mapper.BusinessContactsMapper">
<resultMap type="com.dsk.common.core.domain.entity.BusinessContacts" id="BusinessContactsResult">
<result property="id" column="id"/>
<result property="businessId" column="business_id"/>
<result property="name" column="name"/>
<result property="role" column="role"/>
<result property="office" column="office"/>
<result property="position" column="position"/>
<result property="phone" column="phone"/>
<result property="sex" column="sex"/>
<result property="accendant" column="accendant"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectBusinessContactsVo">
select id,
business_id,
name,
role,
office,
position,
phone,
accendant,
sex,
create_time,
update_time
from business_contacts
</sql>
<select id="selectBusinessContactsList" parameterType="com.dsk.common.core.domain.entity.BusinessContacts" resultMap="BusinessContactsResult">
<include refid="selectBusinessContactsVo"/>
<where>
<if test="businessId != null ">and business_id = #{businessId}</if>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="role != null and role != ''">and role = #{role}</if>
<if test="office != null and office != ''">and office = #{office}</if>
<if test="position != null and position != ''">and position = #{position}</if>
<if test="phone != null and phone != ''">and phone = #{phone}</if>
<if test="accendant != null and accendant != ''">and accendant = #{accendant}</if>
<if test="createTime != null ">and create_time = #{createTime}</if>
<if test="sex != null ">and sex = #{sex}</if>
</where>
order by update_time desc,id desc
</select>
<select id="selectBusinessContactsById" parameterType="Long" resultMap="BusinessContactsResult">
<include refid="selectBusinessContactsVo"/>
where id = #{id}
</select>
<insert id="insertBusinessContacts" parameterType="com.dsk.common.core.domain.entity.BusinessContacts" useGeneratedKeys="true" keyProperty="id">
insert into business_contacts
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="businessId != null">business_id,</if>
<if test="name != null">name,</if>
<if test="role != null">role,</if>
<if test="office != null">office,</if>
<if test="position != null">position,</if>
<if test="phone != null">phone,</if>
<if test="accendant != null">accendant,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="sex != null">sex,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="businessId != null">#{businessId},</if>
<if test="name != null">#{name},</if>
<if test="role != null">#{role},</if>
<if test="office != null">#{office},</if>
<if test="position != null">#{position},</if>
<if test="phone != null">#{phone},</if>
<if test="accendant != null">#{accendant},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="sex != null">#{sex},</if>
</trim>
</insert>
<update id="updateBusinessContacts" parameterType="com.dsk.common.core.domain.entity.BusinessContacts">
update business_contacts
<trim prefix="SET" suffixOverrides=",">
<if test="businessId != null">business_id = #{businessId},</if>
<if test="name != null">name = #{name},</if>
<if test="role != null">role = #{role},</if>
<if test="office != null">office = #{office},</if>
<if test="position != null">position = #{position},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="accendant != null">accendant = #{accendant},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="sex != null">sex = #{sex},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBusinessContactsById" parameterType="Long">
delete
from business_contacts
where id = #{id}
</delete>
<delete id="deleteBusinessContactsByIds" parameterType="String">
delete from business_contacts where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -373,4 +373,16 @@
and u.user_id = #{userId}
<if test="companyName != null and companyName != '' "> and ct.company_name =#{companyName}</if>
</select>
<select id="selectCountByStatus" resultType="java.lang.Integer">
select
count(bi.id)
from business_info bi
join business_user bu on bu.business_id = bi.id
left join sys_user u on bu.user_id = u.user_id
left join sys_dept d on u.dept_id = d.dept_id
where (bu.user_id = #{userId} or bi.is_private = 1)
<if test="status != null"> and bi.status = #{status}</if>
${params.dataScope}
</select>
</mapper>
<?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.dsk.system.mapper.CustomerDecisionChainMapper">
<resultMap type="com.dsk.system.domain.customer.CustomerDecisionChain" id="CustomerDecisionChainMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="customerId" column="customer_id" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="role" column="role" jdbcType="VARCHAR"/>
<result property="workUnit" column="work_unit" jdbcType="VARCHAR"/>
<result property="position" column="position" jdbcType="VARCHAR"/>
<result property="contactInformation" column="contact_information" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateId" column="update_id" jdbcType="INTEGER"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
</mapper>
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