客户管理功能
This commit is contained in:
parent
71e27fc539
commit
37cb4ca715
@ -0,0 +1,129 @@
|
|||||||
|
package com.ktg.mes.md.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ktg.common.constant.UserConstants;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ktg.common.annotation.Log;
|
||||||
|
import com.ktg.common.core.controller.BaseController;
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
|
import com.ktg.common.enums.BusinessType;
|
||||||
|
import com.ktg.mes.md.domain.MdClient;
|
||||||
|
import com.ktg.mes.md.service.IMdClientService;
|
||||||
|
import com.ktg.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ktg.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户Controller
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/md/client")
|
||||||
|
public class MdClientController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IMdClientService mdClientService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询客户列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:client:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(MdClient mdClient)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<MdClient> list = mdClientService.selectMdClientList(mdClient);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出客户列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:client:export')")
|
||||||
|
@Log(title = "客户", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, MdClient mdClient)
|
||||||
|
{
|
||||||
|
List<MdClient> list = mdClientService.selectMdClientList(mdClient);
|
||||||
|
ExcelUtil<MdClient> util = new ExcelUtil<MdClient>(MdClient.class);
|
||||||
|
util.exportExcel(response, list, "客户数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客户详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:client:query')")
|
||||||
|
@GetMapping(value = "/{clientId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("clientId") Long clientId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(mdClientService.selectMdClientByClientId(clientId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增客户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:client:add')")
|
||||||
|
@Log(title = "客户", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody MdClient mdClient)
|
||||||
|
{
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientCodeUnique(mdClient))){
|
||||||
|
return AjaxResult.error("客户编码已存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNameUnique(mdClient))){
|
||||||
|
return AjaxResult.error("客户名称已存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNickUnique(mdClient))){
|
||||||
|
return AjaxResult.error("客户简称已存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAjax(mdClientService.insertMdClient(mdClient));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改客户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:client:edit')")
|
||||||
|
@Log(title = "客户", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody MdClient mdClient)
|
||||||
|
{
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientCodeUnique(mdClient))){
|
||||||
|
return AjaxResult.error("客户编码已存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNameUnique(mdClient))){
|
||||||
|
return AjaxResult.error("客户名称已存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdClientService.checkClientNickUnique(mdClient))){
|
||||||
|
return AjaxResult.error("客户简称已存在!");
|
||||||
|
}
|
||||||
|
return toAjax(mdClientService.updateMdClient(mdClient));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除客户
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:client:remove')")
|
||||||
|
@Log(title = "客户", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{clientIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] clientIds)
|
||||||
|
{
|
||||||
|
return toAjax(mdClientService.deleteMdClientByClientIds(clientIds));
|
||||||
|
}
|
||||||
|
}
|
||||||
361
ktg-mes/src/main/java/com/ktg/mes/md/domain/MdClient.java
Normal file
361
ktg-mes/src/main/java/com/ktg/mes/md/domain/MdClient.java
Normal file
@ -0,0 +1,361 @@
|
|||||||
|
package com.ktg.mes.md.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ktg.common.annotation.Excel;
|
||||||
|
import com.ktg.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户对象 md_client
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
public class MdClient extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 客户ID */
|
||||||
|
private Long clientId;
|
||||||
|
|
||||||
|
/** 客户编码 */
|
||||||
|
@Excel(name = "客户编码")
|
||||||
|
private String clientCode;
|
||||||
|
|
||||||
|
/** 客户名称 */
|
||||||
|
@Excel(name = "客户名称")
|
||||||
|
private String clientName;
|
||||||
|
|
||||||
|
/** 客户简称 */
|
||||||
|
@Excel(name = "客户简称")
|
||||||
|
private String clientNick;
|
||||||
|
|
||||||
|
/** 客户英文名称 */
|
||||||
|
@Excel(name = "客户英文名称")
|
||||||
|
private String clientEn;
|
||||||
|
|
||||||
|
/** 客户简介 */
|
||||||
|
@Excel(name = "客户简介")
|
||||||
|
private String clientDes;
|
||||||
|
|
||||||
|
/** 客户LOGO地址 */
|
||||||
|
@Excel(name = "客户LOGO地址")
|
||||||
|
private String clientLogo;
|
||||||
|
|
||||||
|
/** 客户类型 */
|
||||||
|
@Excel(name = "客户类型")
|
||||||
|
private String clientType;
|
||||||
|
|
||||||
|
/** 客户地址 */
|
||||||
|
@Excel(name = "客户地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/** 客户官网地址 */
|
||||||
|
@Excel(name = "客户官网地址")
|
||||||
|
private String website;
|
||||||
|
|
||||||
|
/** 客户邮箱地址 */
|
||||||
|
@Excel(name = "客户邮箱地址")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/** 客户电话 */
|
||||||
|
@Excel(name = "客户电话")
|
||||||
|
private String tel;
|
||||||
|
|
||||||
|
/** 联系人1 */
|
||||||
|
@Excel(name = "联系人1")
|
||||||
|
private String contact1;
|
||||||
|
|
||||||
|
/** 联系人1-电话 */
|
||||||
|
@Excel(name = "联系人1-电话")
|
||||||
|
private String contact1Tel;
|
||||||
|
|
||||||
|
/** 联系人1-邮箱 */
|
||||||
|
@Excel(name = "联系人1-邮箱")
|
||||||
|
private String contact1Email;
|
||||||
|
|
||||||
|
/** 联系人2 */
|
||||||
|
@Excel(name = "联系人2")
|
||||||
|
private String contact2;
|
||||||
|
|
||||||
|
/** 联系人2-电话 */
|
||||||
|
@Excel(name = "联系人2-电话")
|
||||||
|
private String contact2Tel;
|
||||||
|
|
||||||
|
/** 联系人2-邮箱 */
|
||||||
|
@Excel(name = "联系人2-邮箱")
|
||||||
|
private String contact2Email;
|
||||||
|
|
||||||
|
/** 统一社会信用代码 */
|
||||||
|
@Excel(name = "统一社会信用代码")
|
||||||
|
private String creditCode;
|
||||||
|
|
||||||
|
/** 是否启用 */
|
||||||
|
@Excel(name = "是否启用")
|
||||||
|
private String enableFlag;
|
||||||
|
|
||||||
|
/** 预留字段1 */
|
||||||
|
@Excel(name = "预留字段1")
|
||||||
|
private String attr1;
|
||||||
|
|
||||||
|
/** 预留字段2 */
|
||||||
|
private String attr2;
|
||||||
|
|
||||||
|
/** 预留字段3 */
|
||||||
|
private Long attr3;
|
||||||
|
|
||||||
|
/** 预留字段4 */
|
||||||
|
private Long attr4;
|
||||||
|
|
||||||
|
public void setClientId(Long clientId)
|
||||||
|
{
|
||||||
|
this.clientId = clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getClientId()
|
||||||
|
{
|
||||||
|
return clientId;
|
||||||
|
}
|
||||||
|
public void setClientCode(String clientCode)
|
||||||
|
{
|
||||||
|
this.clientCode = clientCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientCode()
|
||||||
|
{
|
||||||
|
return clientCode;
|
||||||
|
}
|
||||||
|
public void setClientName(String clientName)
|
||||||
|
{
|
||||||
|
this.clientName = clientName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientName()
|
||||||
|
{
|
||||||
|
return clientName;
|
||||||
|
}
|
||||||
|
public void setClientNick(String clientNick)
|
||||||
|
{
|
||||||
|
this.clientNick = clientNick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientNick()
|
||||||
|
{
|
||||||
|
return clientNick;
|
||||||
|
}
|
||||||
|
public void setClientEn(String clientEn)
|
||||||
|
{
|
||||||
|
this.clientEn = clientEn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientEn()
|
||||||
|
{
|
||||||
|
return clientEn;
|
||||||
|
}
|
||||||
|
public void setClientDes(String clientDes)
|
||||||
|
{
|
||||||
|
this.clientDes = clientDes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientDes()
|
||||||
|
{
|
||||||
|
return clientDes;
|
||||||
|
}
|
||||||
|
public void setClientLogo(String clientLogo)
|
||||||
|
{
|
||||||
|
this.clientLogo = clientLogo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientLogo()
|
||||||
|
{
|
||||||
|
return clientLogo;
|
||||||
|
}
|
||||||
|
public void setClientType(String clientType)
|
||||||
|
{
|
||||||
|
this.clientType = clientType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientType()
|
||||||
|
{
|
||||||
|
return clientType;
|
||||||
|
}
|
||||||
|
public void setAddress(String address)
|
||||||
|
{
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress()
|
||||||
|
{
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
public void setWebsite(String website)
|
||||||
|
{
|
||||||
|
this.website = website;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWebsite()
|
||||||
|
{
|
||||||
|
return website;
|
||||||
|
}
|
||||||
|
public void setEmail(String email)
|
||||||
|
{
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail()
|
||||||
|
{
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
public void setTel(String tel)
|
||||||
|
{
|
||||||
|
this.tel = tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTel()
|
||||||
|
{
|
||||||
|
return tel;
|
||||||
|
}
|
||||||
|
public void setContact1(String contact1)
|
||||||
|
{
|
||||||
|
this.contact1 = contact1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContact1()
|
||||||
|
{
|
||||||
|
return contact1;
|
||||||
|
}
|
||||||
|
public void setContact1Tel(String contact1Tel)
|
||||||
|
{
|
||||||
|
this.contact1Tel = contact1Tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContact1Tel()
|
||||||
|
{
|
||||||
|
return contact1Tel;
|
||||||
|
}
|
||||||
|
public void setContact1Email(String contact1Email)
|
||||||
|
{
|
||||||
|
this.contact1Email = contact1Email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContact1Email()
|
||||||
|
{
|
||||||
|
return contact1Email;
|
||||||
|
}
|
||||||
|
public void setContact2(String contact2)
|
||||||
|
{
|
||||||
|
this.contact2 = contact2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContact2()
|
||||||
|
{
|
||||||
|
return contact2;
|
||||||
|
}
|
||||||
|
public void setContact2Tel(String contact2Tel)
|
||||||
|
{
|
||||||
|
this.contact2Tel = contact2Tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContact2Tel()
|
||||||
|
{
|
||||||
|
return contact2Tel;
|
||||||
|
}
|
||||||
|
public void setContact2Email(String contact2Email)
|
||||||
|
{
|
||||||
|
this.contact2Email = contact2Email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContact2Email()
|
||||||
|
{
|
||||||
|
return contact2Email;
|
||||||
|
}
|
||||||
|
public void setCreditCode(String creditCode)
|
||||||
|
{
|
||||||
|
this.creditCode = creditCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreditCode()
|
||||||
|
{
|
||||||
|
return creditCode;
|
||||||
|
}
|
||||||
|
public void setEnableFlag(String enableFlag)
|
||||||
|
{
|
||||||
|
this.enableFlag = enableFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnableFlag()
|
||||||
|
{
|
||||||
|
return enableFlag;
|
||||||
|
}
|
||||||
|
public void setAttr1(String attr1)
|
||||||
|
{
|
||||||
|
this.attr1 = attr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttr1()
|
||||||
|
{
|
||||||
|
return attr1;
|
||||||
|
}
|
||||||
|
public void setAttr2(String attr2)
|
||||||
|
{
|
||||||
|
this.attr2 = attr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttr2()
|
||||||
|
{
|
||||||
|
return attr2;
|
||||||
|
}
|
||||||
|
public void setAttr3(Long attr3)
|
||||||
|
{
|
||||||
|
this.attr3 = attr3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAttr3()
|
||||||
|
{
|
||||||
|
return attr3;
|
||||||
|
}
|
||||||
|
public void setAttr4(Long attr4)
|
||||||
|
{
|
||||||
|
this.attr4 = attr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAttr4()
|
||||||
|
{
|
||||||
|
return attr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("clientId", getClientId())
|
||||||
|
.append("clientCode", getClientCode())
|
||||||
|
.append("clientName", getClientName())
|
||||||
|
.append("clientNick", getClientNick())
|
||||||
|
.append("clientEn", getClientEn())
|
||||||
|
.append("clientDes", getClientDes())
|
||||||
|
.append("clientLogo", getClientLogo())
|
||||||
|
.append("clientType", getClientType())
|
||||||
|
.append("address", getAddress())
|
||||||
|
.append("website", getWebsite())
|
||||||
|
.append("email", getEmail())
|
||||||
|
.append("tel", getTel())
|
||||||
|
.append("contact1", getContact1())
|
||||||
|
.append("contact1Tel", getContact1Tel())
|
||||||
|
.append("contact1Email", getContact1Email())
|
||||||
|
.append("contact2", getContact2())
|
||||||
|
.append("contact2Tel", getContact2Tel())
|
||||||
|
.append("contact2Email", getContact2Email())
|
||||||
|
.append("creditCode", getCreditCode())
|
||||||
|
.append("enableFlag", getEnableFlag())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("attr1", getAttr1())
|
||||||
|
.append("attr2", getAttr2())
|
||||||
|
.append("attr3", getAttr3())
|
||||||
|
.append("attr4", getAttr4())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package com.ktg.mes.md.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ktg.mes.md.domain.MdClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户Mapper接口
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
public interface MdClientMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询客户
|
||||||
|
*
|
||||||
|
* @param clientId 客户主键
|
||||||
|
* @return 客户
|
||||||
|
*/
|
||||||
|
public MdClient selectMdClientByClientId(Long clientId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询客户列表
|
||||||
|
*
|
||||||
|
* @param mdClient 客户
|
||||||
|
* @return 客户集合
|
||||||
|
*/
|
||||||
|
public List<MdClient> selectMdClientList(MdClient mdClient);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查客户编码是否重复
|
||||||
|
* @param mdClient
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public MdClient checkClientCodeUnique(MdClient mdClient);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查客户名称是否重复
|
||||||
|
* @param mdClient
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public MdClient checkClientNameUnique(MdClient mdClient);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查客户简称是否重复
|
||||||
|
* @param mdClient
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public MdClient checkClientNickUnique(MdClient mdClient);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增客户
|
||||||
|
*
|
||||||
|
* @param mdClient 客户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertMdClient(MdClient mdClient);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改客户
|
||||||
|
*
|
||||||
|
* @param mdClient 客户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateMdClient(MdClient mdClient);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除客户
|
||||||
|
*
|
||||||
|
* @param clientId 客户主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteMdClientByClientId(Long clientId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除客户
|
||||||
|
*
|
||||||
|
* @param clientIds 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteMdClientByClientIds(Long[] clientIds);
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
package com.ktg.mes.md.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ktg.mes.md.domain.MdClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户Service接口
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
public interface IMdClientService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询客户
|
||||||
|
*
|
||||||
|
* @param clientId 客户主键
|
||||||
|
* @return 客户
|
||||||
|
*/
|
||||||
|
public MdClient selectMdClientByClientId(Long clientId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询客户列表
|
||||||
|
*
|
||||||
|
* @param mdClient 客户
|
||||||
|
* @return 客户集合
|
||||||
|
*/
|
||||||
|
public List<MdClient> selectMdClientList(MdClient mdClient);
|
||||||
|
|
||||||
|
public String checkClientCodeUnique(MdClient mdClient);
|
||||||
|
|
||||||
|
public String checkClientNameUnique(MdClient mdClient);
|
||||||
|
|
||||||
|
public String checkClientNickUnique(MdClient mdClient);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增客户
|
||||||
|
*
|
||||||
|
* @param mdClient 客户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertMdClient(MdClient mdClient);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改客户
|
||||||
|
*
|
||||||
|
* @param mdClient 客户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateMdClient(MdClient mdClient);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除客户
|
||||||
|
*
|
||||||
|
* @param clientIds 需要删除的客户主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteMdClientByClientIds(Long[] clientIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除客户信息
|
||||||
|
*
|
||||||
|
* @param clientId 客户主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteMdClientByClientId(Long clientId);
|
||||||
|
}
|
||||||
@ -0,0 +1,130 @@
|
|||||||
|
package com.ktg.mes.md.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ktg.common.constant.UserConstants;
|
||||||
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import org.apache.catalina.User;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ktg.mes.md.mapper.MdClientMapper;
|
||||||
|
import com.ktg.mes.md.domain.MdClient;
|
||||||
|
import com.ktg.mes.md.service.IMdClientService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户Service业务层处理
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MdClientServiceImpl implements IMdClientService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private MdClientMapper mdClientMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询客户
|
||||||
|
*
|
||||||
|
* @param clientId 客户主键
|
||||||
|
* @return 客户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public MdClient selectMdClientByClientId(Long clientId)
|
||||||
|
{
|
||||||
|
return mdClientMapper.selectMdClientByClientId(clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询客户列表
|
||||||
|
*
|
||||||
|
* @param mdClient 客户
|
||||||
|
* @return 客户
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<MdClient> selectMdClientList(MdClient mdClient)
|
||||||
|
{
|
||||||
|
return mdClientMapper.selectMdClientList(mdClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkClientCodeUnique(MdClient mdClient) {
|
||||||
|
MdClient client = mdClientMapper.checkClientCodeUnique(mdClient);
|
||||||
|
Long clientId = mdClient.getClientId()==null?-1L:mdClient.getClientId();
|
||||||
|
if(StringUtils.isNotNull(client) && client.getClientId().longValue() !=clientId.longValue()){
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkClientNameUnique(MdClient mdClient) {
|
||||||
|
MdClient client = mdClientMapper.checkClientNameUnique(mdClient);
|
||||||
|
Long clientId = mdClient.getClientId()==null?-1L:mdClient.getClientId();
|
||||||
|
if(StringUtils.isNotNull(client) && client.getClientId().longValue() !=clientId.longValue()){
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkClientNickUnique(MdClient mdClient) {
|
||||||
|
MdClient client = mdClientMapper.checkClientNickUnique(mdClient);
|
||||||
|
Long clientId = mdClient.getClientId()==null?-1L:mdClient.getClientId();
|
||||||
|
if(StringUtils.isNotNull(client) && client.getClientId().longValue() !=clientId.longValue()){
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增客户
|
||||||
|
*
|
||||||
|
* @param mdClient 客户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertMdClient(MdClient mdClient)
|
||||||
|
{
|
||||||
|
mdClient.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return mdClientMapper.insertMdClient(mdClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改客户
|
||||||
|
*
|
||||||
|
* @param mdClient 客户
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateMdClient(MdClient mdClient)
|
||||||
|
{
|
||||||
|
mdClient.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return mdClientMapper.updateMdClient(mdClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除客户
|
||||||
|
*
|
||||||
|
* @param clientIds 需要删除的客户主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteMdClientByClientIds(Long[] clientIds)
|
||||||
|
{
|
||||||
|
return mdClientMapper.deleteMdClientByClientIds(clientIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除客户信息
|
||||||
|
*
|
||||||
|
* @param clientId 客户主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteMdClientByClientId(Long clientId)
|
||||||
|
{
|
||||||
|
return mdClientMapper.deleteMdClientByClientId(clientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
197
ktg-mes/src/main/resources/mapper/md/MdClientMapper.xml
Normal file
197
ktg-mes/src/main/resources/mapper/md/MdClientMapper.xml
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
<?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.ktg.mes.md.mapper.MdClientMapper">
|
||||||
|
|
||||||
|
<resultMap type="MdClient" id="MdClientResult">
|
||||||
|
<result property="clientId" column="client_id" />
|
||||||
|
<result property="clientCode" column="client_code" />
|
||||||
|
<result property="clientName" column="client_name" />
|
||||||
|
<result property="clientNick" column="client_nick" />
|
||||||
|
<result property="clientEn" column="client_en" />
|
||||||
|
<result property="clientDes" column="client_des" />
|
||||||
|
<result property="clientLogo" column="client_logo" />
|
||||||
|
<result property="clientType" column="client_type" />
|
||||||
|
<result property="address" column="address" />
|
||||||
|
<result property="website" column="website" />
|
||||||
|
<result property="email" column="email" />
|
||||||
|
<result property="tel" column="tel" />
|
||||||
|
<result property="contact1" column="contact1" />
|
||||||
|
<result property="contact1Tel" column="contact1_tel" />
|
||||||
|
<result property="contact1Email" column="contact1_email" />
|
||||||
|
<result property="contact2" column="contact2" />
|
||||||
|
<result property="contact2Tel" column="contact2_tel" />
|
||||||
|
<result property="contact2Email" column="contact2_email" />
|
||||||
|
<result property="creditCode" column="credit_code" />
|
||||||
|
<result property="enableFlag" column="enable_flag" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="attr1" column="attr1" />
|
||||||
|
<result property="attr2" column="attr2" />
|
||||||
|
<result property="attr3" column="attr3" />
|
||||||
|
<result property="attr4" column="attr4" />
|
||||||
|
<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="selectMdClientVo">
|
||||||
|
select client_id, client_code, client_name, client_nick, client_en, client_des, client_logo, client_type, address, website, email, tel, contact1, contact1_tel, contact1_email, contact2, contact2_tel, contact2_email, credit_code, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_client
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectMdClientList" parameterType="MdClient" resultMap="MdClientResult">
|
||||||
|
<include refid="selectMdClientVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="clientCode != null and clientCode != ''"> and client_code = #{clientCode}</if>
|
||||||
|
<if test="clientName != null and clientName != ''"> and client_name like concat('%', #{clientName}, '%')</if>
|
||||||
|
<if test="clientNick != null and clientNick != ''"> and client_nick = #{clientNick}</if>
|
||||||
|
<if test="clientEn != null and clientEn != ''"> and client_en = #{clientEn}</if>
|
||||||
|
<if test="clientDes != null and clientDes != ''"> and client_des = #{clientDes}</if>
|
||||||
|
<if test="clientLogo != null and clientLogo != ''"> and client_logo = #{clientLogo}</if>
|
||||||
|
<if test="clientType != null and clientType != ''"> and client_type = #{clientType}</if>
|
||||||
|
<if test="address != null and address != ''"> and address = #{address}</if>
|
||||||
|
<if test="website != null and website != ''"> and website = #{website}</if>
|
||||||
|
<if test="email != null and email != ''"> and email = #{email}</if>
|
||||||
|
<if test="tel != null and tel != ''"> and tel = #{tel}</if>
|
||||||
|
<if test="contact1 != null and contact1 != ''"> and contact1 = #{contact1}</if>
|
||||||
|
<if test="contact1Tel != null and contact1Tel != ''"> and contact1_tel = #{contact1Tel}</if>
|
||||||
|
<if test="contact1Email != null and contact1Email != ''"> and contact1_email = #{contact1Email}</if>
|
||||||
|
<if test="contact2 != null and contact2 != ''"> and contact2 = #{contact2}</if>
|
||||||
|
<if test="contact2Tel != null and contact2Tel != ''"> and contact2_tel = #{contact2Tel}</if>
|
||||||
|
<if test="contact2Email != null and contact2Email != ''"> and contact2_email = #{contact2Email}</if>
|
||||||
|
<if test="creditCode != null and creditCode != ''"> and credit_code = #{creditCode}</if>
|
||||||
|
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMdClientByClientId" parameterType="Long" resultMap="MdClientResult">
|
||||||
|
<include refid="selectMdClientVo"/>
|
||||||
|
where client_id = #{clientId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkClientCodeUnique" parameterType="MdClient" resultMap="MdClientResult">
|
||||||
|
<include refid="selectMdClientVo"/>
|
||||||
|
where client_code = #{clientCode} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkClientNameUnique" parameterType="MdClient" resultMap="MdClientResult">
|
||||||
|
<include refid="selectMdClientVo"/>
|
||||||
|
where client_name = #{clientName} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkClientNickUnique" parameterType="MdClient" resultMap="MdClientResult">
|
||||||
|
<include refid="selectMdClientVo"/>
|
||||||
|
where client_nick = #{clientNick} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertMdClient" parameterType="MdClient" useGeneratedKeys="true" keyProperty="clientId">
|
||||||
|
insert into md_client
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="clientCode != null and clientCode != ''">client_code,</if>
|
||||||
|
<if test="clientName != null and clientName != ''">client_name,</if>
|
||||||
|
<if test="clientNick != null">client_nick,</if>
|
||||||
|
<if test="clientEn != null">client_en,</if>
|
||||||
|
<if test="clientDes != null">client_des,</if>
|
||||||
|
<if test="clientLogo != null">client_logo,</if>
|
||||||
|
<if test="clientType != null">client_type,</if>
|
||||||
|
<if test="address != null">address,</if>
|
||||||
|
<if test="website != null">website,</if>
|
||||||
|
<if test="email != null">email,</if>
|
||||||
|
<if test="tel != null">tel,</if>
|
||||||
|
<if test="contact1 != null">contact1,</if>
|
||||||
|
<if test="contact1Tel != null">contact1_tel,</if>
|
||||||
|
<if test="contact1Email != null">contact1_email,</if>
|
||||||
|
<if test="contact2 != null">contact2,</if>
|
||||||
|
<if test="contact2Tel != null">contact2_tel,</if>
|
||||||
|
<if test="contact2Email != null">contact2_email,</if>
|
||||||
|
<if test="creditCode != null">credit_code,</if>
|
||||||
|
<if test="enableFlag != null and enableFlag != ''">enable_flag,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="attr1 != null">attr1,</if>
|
||||||
|
<if test="attr2 != null">attr2,</if>
|
||||||
|
<if test="attr3 != null">attr3,</if>
|
||||||
|
<if test="attr4 != null">attr4,</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="clientCode != null and clientCode != ''">#{clientCode},</if>
|
||||||
|
<if test="clientName != null and clientName != ''">#{clientName},</if>
|
||||||
|
<if test="clientNick != null">#{clientNick},</if>
|
||||||
|
<if test="clientEn != null">#{clientEn},</if>
|
||||||
|
<if test="clientDes != null">#{clientDes},</if>
|
||||||
|
<if test="clientLogo != null">#{clientLogo},</if>
|
||||||
|
<if test="clientType != null">#{clientType},</if>
|
||||||
|
<if test="address != null">#{address},</if>
|
||||||
|
<if test="website != null">#{website},</if>
|
||||||
|
<if test="email != null">#{email},</if>
|
||||||
|
<if test="tel != null">#{tel},</if>
|
||||||
|
<if test="contact1 != null">#{contact1},</if>
|
||||||
|
<if test="contact1Tel != null">#{contact1Tel},</if>
|
||||||
|
<if test="contact1Email != null">#{contact1Email},</if>
|
||||||
|
<if test="contact2 != null">#{contact2},</if>
|
||||||
|
<if test="contact2Tel != null">#{contact2Tel},</if>
|
||||||
|
<if test="contact2Email != null">#{contact2Email},</if>
|
||||||
|
<if test="creditCode != null">#{creditCode},</if>
|
||||||
|
<if test="enableFlag != null and enableFlag != ''">#{enableFlag},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="attr1 != null">#{attr1},</if>
|
||||||
|
<if test="attr2 != null">#{attr2},</if>
|
||||||
|
<if test="attr3 != null">#{attr3},</if>
|
||||||
|
<if test="attr4 != null">#{attr4},</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="updateMdClient" parameterType="MdClient">
|
||||||
|
update md_client
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="clientCode != null and clientCode != ''">client_code = #{clientCode},</if>
|
||||||
|
<if test="clientName != null and clientName != ''">client_name = #{clientName},</if>
|
||||||
|
<if test="clientNick != null">client_nick = #{clientNick},</if>
|
||||||
|
<if test="clientEn != null">client_en = #{clientEn},</if>
|
||||||
|
<if test="clientDes != null">client_des = #{clientDes},</if>
|
||||||
|
<if test="clientLogo != null">client_logo = #{clientLogo},</if>
|
||||||
|
<if test="clientType != null">client_type = #{clientType},</if>
|
||||||
|
<if test="address != null">address = #{address},</if>
|
||||||
|
<if test="website != null">website = #{website},</if>
|
||||||
|
<if test="email != null">email = #{email},</if>
|
||||||
|
<if test="tel != null">tel = #{tel},</if>
|
||||||
|
<if test="contact1 != null">contact1 = #{contact1},</if>
|
||||||
|
<if test="contact1Tel != null">contact1_tel = #{contact1Tel},</if>
|
||||||
|
<if test="contact1Email != null">contact1_email = #{contact1Email},</if>
|
||||||
|
<if test="contact2 != null">contact2 = #{contact2},</if>
|
||||||
|
<if test="contact2Tel != null">contact2_tel = #{contact2Tel},</if>
|
||||||
|
<if test="contact2Email != null">contact2_email = #{contact2Email},</if>
|
||||||
|
<if test="creditCode != null">credit_code = #{creditCode},</if>
|
||||||
|
<if test="enableFlag != null and enableFlag != ''">enable_flag = #{enableFlag},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
||||||
|
<if test="attr2 != null">attr2 = #{attr2},</if>
|
||||||
|
<if test="attr3 != null">attr3 = #{attr3},</if>
|
||||||
|
<if test="attr4 != null">attr4 = #{attr4},</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 client_id = #{clientId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteMdClientByClientId" parameterType="Long">
|
||||||
|
delete from md_client where client_id = #{clientId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteMdClientByClientIds" parameterType="String">
|
||||||
|
delete from md_client where client_id in
|
||||||
|
<foreach item="clientId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{clientId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user