供应商管理功能
This commit is contained in:
parent
37cb4ca715
commit
72e16e602c
@ -0,0 +1,125 @@
|
|||||||
|
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.MdVendor;
|
||||||
|
import com.ktg.mes.md.service.IMdVendorService;
|
||||||
|
import com.ktg.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ktg.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商Controller
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/md/vendor")
|
||||||
|
public class MdVendorController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IMdVendorService mdVendorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询供应商列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:vendor:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(MdVendor mdVendor)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<MdVendor> list = mdVendorService.selectMdVendorList(mdVendor);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出供应商列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:vendor:export')")
|
||||||
|
@Log(title = "供应商", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, MdVendor mdVendor)
|
||||||
|
{
|
||||||
|
List<MdVendor> list = mdVendorService.selectMdVendorList(mdVendor);
|
||||||
|
ExcelUtil<MdVendor> util = new ExcelUtil<MdVendor>(MdVendor.class);
|
||||||
|
util.exportExcel(response, list, "供应商数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取供应商详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:vendor:query')")
|
||||||
|
@GetMapping(value = "/{vendorId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("vendorId") Long vendorId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(mdVendorService.selectMdVendorByVendorId(vendorId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增供应商
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:vendor:add')")
|
||||||
|
@Log(title = "供应商", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody MdVendor mdVendor)
|
||||||
|
{
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorCodeUnique(mdVendor))){
|
||||||
|
return AjaxResult.error("供应商编码已存在!");
|
||||||
|
}
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNameUnique(mdVendor))){
|
||||||
|
return AjaxResult.error("供应商名称已存在!");
|
||||||
|
}
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNickUnique(mdVendor))){
|
||||||
|
return AjaxResult.error("供应商简称已存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAjax(mdVendorService.insertMdVendor(mdVendor));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改供应商
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:vendor:edit')")
|
||||||
|
@Log(title = "供应商", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody MdVendor mdVendor)
|
||||||
|
{
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorCodeUnique(mdVendor))){
|
||||||
|
return AjaxResult.error("供应商编码已存在!");
|
||||||
|
}
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNameUnique(mdVendor))){
|
||||||
|
return AjaxResult.error("供应商名称已存在!");
|
||||||
|
}
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(mdVendorService.checkVendorNickUnique(mdVendor))){
|
||||||
|
return AjaxResult.error("供应商简称已存在!");
|
||||||
|
}
|
||||||
|
return toAjax(mdVendorService.updateMdVendor(mdVendor));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除供应商
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('md:vendor:remove')")
|
||||||
|
@Log(title = "供应商", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{vendorIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] vendorIds)
|
||||||
|
{
|
||||||
|
return toAjax(mdVendorService.deleteMdVendorByVendorIds(vendorIds));
|
||||||
|
}
|
||||||
|
}
|
374
ktg-mes/src/main/java/com/ktg/mes/md/domain/MdVendor.java
Normal file
374
ktg-mes/src/main/java/com/ktg/mes/md/domain/MdVendor.java
Normal file
@ -0,0 +1,374 @@
|
|||||||
|
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_vendor
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
public class MdVendor extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 供应商ID */
|
||||||
|
private Long vendorId;
|
||||||
|
|
||||||
|
/** 供应商编码 */
|
||||||
|
@Excel(name = "供应商编码")
|
||||||
|
private String vendorCode;
|
||||||
|
|
||||||
|
/** 供应商名称 */
|
||||||
|
@Excel(name = "供应商名称")
|
||||||
|
private String vendorName;
|
||||||
|
|
||||||
|
/** 供应商简称 */
|
||||||
|
@Excel(name = "供应商简称")
|
||||||
|
private String vendorNick;
|
||||||
|
|
||||||
|
/** 供应商英文名称 */
|
||||||
|
@Excel(name = "供应商英文名称")
|
||||||
|
private String vendorEn;
|
||||||
|
|
||||||
|
/** 供应商简介 */
|
||||||
|
@Excel(name = "供应商简介")
|
||||||
|
private String vendorDes;
|
||||||
|
|
||||||
|
/** 供应商LOGO地址 */
|
||||||
|
@Excel(name = "供应商LOGO地址")
|
||||||
|
private String vendorLogo;
|
||||||
|
|
||||||
|
/** 供应商等级 */
|
||||||
|
@Excel(name = "供应商等级")
|
||||||
|
private String vendorLevel;
|
||||||
|
|
||||||
|
/** 供应商评分 */
|
||||||
|
@Excel(name = "供应商评分")
|
||||||
|
private Long vendorScore;
|
||||||
|
|
||||||
|
/** 供应商地址 */
|
||||||
|
@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 */
|
||||||
|
private String attr1;
|
||||||
|
|
||||||
|
/** 预留字段2 */
|
||||||
|
private String attr2;
|
||||||
|
|
||||||
|
/** 预留字段3 */
|
||||||
|
private Long attr3;
|
||||||
|
|
||||||
|
/** 预留字段4 */
|
||||||
|
private Long attr4;
|
||||||
|
|
||||||
|
public void setVendorId(Long vendorId)
|
||||||
|
{
|
||||||
|
this.vendorId = vendorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVendorId()
|
||||||
|
{
|
||||||
|
return vendorId;
|
||||||
|
}
|
||||||
|
public void setVendorCode(String vendorCode)
|
||||||
|
{
|
||||||
|
this.vendorCode = vendorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVendorCode()
|
||||||
|
{
|
||||||
|
return vendorCode;
|
||||||
|
}
|
||||||
|
public void setVendorName(String vendorName)
|
||||||
|
{
|
||||||
|
this.vendorName = vendorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVendorName()
|
||||||
|
{
|
||||||
|
return vendorName;
|
||||||
|
}
|
||||||
|
public void setVendorNick(String vendorNick)
|
||||||
|
{
|
||||||
|
this.vendorNick = vendorNick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVendorNick()
|
||||||
|
{
|
||||||
|
return vendorNick;
|
||||||
|
}
|
||||||
|
public void setVendorEn(String vendorEn)
|
||||||
|
{
|
||||||
|
this.vendorEn = vendorEn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVendorEn()
|
||||||
|
{
|
||||||
|
return vendorEn;
|
||||||
|
}
|
||||||
|
public void setVendorDes(String vendorDes)
|
||||||
|
{
|
||||||
|
this.vendorDes = vendorDes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVendorDes()
|
||||||
|
{
|
||||||
|
return vendorDes;
|
||||||
|
}
|
||||||
|
public void setVendorLogo(String vendorLogo)
|
||||||
|
{
|
||||||
|
this.vendorLogo = vendorLogo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVendorLogo()
|
||||||
|
{
|
||||||
|
return vendorLogo;
|
||||||
|
}
|
||||||
|
public void setVendorLevel(String vendorLevel)
|
||||||
|
{
|
||||||
|
this.vendorLevel = vendorLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVendorLevel()
|
||||||
|
{
|
||||||
|
return vendorLevel;
|
||||||
|
}
|
||||||
|
public void setVendorScore(Long vendorScore)
|
||||||
|
{
|
||||||
|
this.vendorScore = vendorScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVendorScore()
|
||||||
|
{
|
||||||
|
return vendorScore;
|
||||||
|
}
|
||||||
|
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("vendorId", getVendorId())
|
||||||
|
.append("vendorCode", getVendorCode())
|
||||||
|
.append("vendorName", getVendorName())
|
||||||
|
.append("vendorNick", getVendorNick())
|
||||||
|
.append("vendorEn", getVendorEn())
|
||||||
|
.append("vendorDes", getVendorDes())
|
||||||
|
.append("vendorLogo", getVendorLogo())
|
||||||
|
.append("vendorLevel", getVendorLevel())
|
||||||
|
.append("vendorScore", getVendorScore())
|
||||||
|
.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,65 @@
|
|||||||
|
package com.ktg.mes.md.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ktg.mes.md.domain.MdVendor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商Mapper接口
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
public interface MdVendorMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询供应商
|
||||||
|
*
|
||||||
|
* @param vendorId 供应商主键
|
||||||
|
* @return 供应商
|
||||||
|
*/
|
||||||
|
public MdVendor selectMdVendorByVendorId(Long vendorId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询供应商列表
|
||||||
|
*
|
||||||
|
* @param mdVendor 供应商
|
||||||
|
* @return 供应商集合
|
||||||
|
*/
|
||||||
|
public List<MdVendor> selectMdVendorList(MdVendor mdVendor);
|
||||||
|
|
||||||
|
public MdVendor checkVendorCodeUnique(MdVendor mdVendor);
|
||||||
|
public MdVendor checkVendorNameUnique(MdVendor mdVendor);
|
||||||
|
public MdVendor checkVendorNickUnique(MdVendor mdVendor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增供应商
|
||||||
|
*
|
||||||
|
* @param mdVendor 供应商
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertMdVendor(MdVendor mdVendor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改供应商
|
||||||
|
*
|
||||||
|
* @param mdVendor 供应商
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateMdVendor(MdVendor mdVendor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除供应商
|
||||||
|
*
|
||||||
|
* @param vendorId 供应商主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteMdVendorByVendorId(Long vendorId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除供应商
|
||||||
|
*
|
||||||
|
* @param vendorIds 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteMdVendorByVendorIds(Long[] vendorIds);
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.ktg.mes.md.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ktg.mes.md.domain.MdVendor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商Service接口
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
public interface IMdVendorService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询供应商
|
||||||
|
*
|
||||||
|
* @param vendorId 供应商主键
|
||||||
|
* @return 供应商
|
||||||
|
*/
|
||||||
|
public MdVendor selectMdVendorByVendorId(Long vendorId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询供应商列表
|
||||||
|
*
|
||||||
|
* @param mdVendor 供应商
|
||||||
|
* @return 供应商集合
|
||||||
|
*/
|
||||||
|
public List<MdVendor> selectMdVendorList(MdVendor mdVendor);
|
||||||
|
|
||||||
|
public String checkVendorCodeUnique(MdVendor mdVendor);
|
||||||
|
public String checkVendorNameUnique(MdVendor mdVendor);
|
||||||
|
public String checkVendorNickUnique(MdVendor mdVendor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增供应商
|
||||||
|
*
|
||||||
|
* @param mdVendor 供应商
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertMdVendor(MdVendor mdVendor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改供应商
|
||||||
|
*
|
||||||
|
* @param mdVendor 供应商
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateMdVendor(MdVendor mdVendor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除供应商
|
||||||
|
*
|
||||||
|
* @param vendorIds 需要删除的供应商主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteMdVendorByVendorIds(Long[] vendorIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除供应商信息
|
||||||
|
*
|
||||||
|
* @param vendorId 供应商主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteMdVendorByVendorId(Long vendorId);
|
||||||
|
}
|
@ -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.MdVendorMapper;
|
||||||
|
import com.ktg.mes.md.domain.MdVendor;
|
||||||
|
import com.ktg.mes.md.service.IMdVendorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商Service业务层处理
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MdVendorServiceImpl implements IMdVendorService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private MdVendorMapper mdVendorMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询供应商
|
||||||
|
*
|
||||||
|
* @param vendorId 供应商主键
|
||||||
|
* @return 供应商
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public MdVendor selectMdVendorByVendorId(Long vendorId)
|
||||||
|
{
|
||||||
|
return mdVendorMapper.selectMdVendorByVendorId(vendorId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询供应商列表
|
||||||
|
*
|
||||||
|
* @param mdVendor 供应商
|
||||||
|
* @return 供应商
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<MdVendor> selectMdVendorList(MdVendor mdVendor)
|
||||||
|
{
|
||||||
|
return mdVendorMapper.selectMdVendorList(mdVendor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkVendorCodeUnique(MdVendor mdVendor) {
|
||||||
|
MdVendor vendor = mdVendorMapper.checkVendorCodeUnique(mdVendor);
|
||||||
|
Long vendorId = mdVendor.getVendorId()==null?-1L:mdVendor.getVendorId();
|
||||||
|
if(StringUtils.isNotNull(vendor) && vendor.getVendorId().longValue() !=vendorId.longValue()){
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkVendorNameUnique(MdVendor mdVendor) {
|
||||||
|
MdVendor vendor = mdVendorMapper.checkVendorNameUnique(mdVendor);
|
||||||
|
Long vendorId = mdVendor.getVendorId()==null?-1L:mdVendor.getVendorId();
|
||||||
|
if(StringUtils.isNotNull(vendor) && vendor.getVendorId().longValue() !=vendorId.longValue()){
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkVendorNickUnique(MdVendor mdVendor) {
|
||||||
|
MdVendor vendor = mdVendorMapper.checkVendorNickUnique(mdVendor);
|
||||||
|
Long vendorId = mdVendor.getVendorId()==null?-1L:mdVendor.getVendorId();
|
||||||
|
if(StringUtils.isNotNull(vendor) && vendor.getVendorId().longValue() !=vendorId.longValue()){
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增供应商
|
||||||
|
*
|
||||||
|
* @param mdVendor 供应商
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertMdVendor(MdVendor mdVendor)
|
||||||
|
{
|
||||||
|
mdVendor.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return mdVendorMapper.insertMdVendor(mdVendor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改供应商
|
||||||
|
*
|
||||||
|
* @param mdVendor 供应商
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateMdVendor(MdVendor mdVendor)
|
||||||
|
{
|
||||||
|
mdVendor.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return mdVendorMapper.updateMdVendor(mdVendor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除供应商
|
||||||
|
*
|
||||||
|
* @param vendorIds 需要删除的供应商主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteMdVendorByVendorIds(Long[] vendorIds)
|
||||||
|
{
|
||||||
|
return mdVendorMapper.deleteMdVendorByVendorIds(vendorIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除供应商信息
|
||||||
|
*
|
||||||
|
* @param vendorId 供应商主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteMdVendorByVendorId(Long vendorId)
|
||||||
|
{
|
||||||
|
return mdVendorMapper.deleteMdVendorByVendorId(vendorId);
|
||||||
|
}
|
||||||
|
}
|
202
ktg-mes/src/main/resources/mapper/md/MdVendorMapper.xml
Normal file
202
ktg-mes/src/main/resources/mapper/md/MdVendorMapper.xml
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
<?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.MdVendorMapper">
|
||||||
|
|
||||||
|
<resultMap type="MdVendor" id="MdVendorResult">
|
||||||
|
<result property="vendorId" column="vendor_id" />
|
||||||
|
<result property="vendorCode" column="vendor_code" />
|
||||||
|
<result property="vendorName" column="vendor_name" />
|
||||||
|
<result property="vendorNick" column="vendor_nick" />
|
||||||
|
<result property="vendorEn" column="vendor_en" />
|
||||||
|
<result property="vendorDes" column="vendor_des" />
|
||||||
|
<result property="vendorLogo" column="vendor_logo" />
|
||||||
|
<result property="vendorLevel" column="vendor_level" />
|
||||||
|
<result property="vendorScore" column="vendor_score" />
|
||||||
|
<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="selectMdVendorVo">
|
||||||
|
select vendor_id, vendor_code, vendor_name, vendor_nick, vendor_en, vendor_des, vendor_logo, vendor_level, vendor_score, 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_vendor
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectMdVendorList" parameterType="MdVendor" resultMap="MdVendorResult">
|
||||||
|
<include refid="selectMdVendorVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="vendorCode != null and vendorCode != ''"> and vendor_code = #{vendorCode}</if>
|
||||||
|
<if test="vendorName != null and vendorName != ''"> and vendor_name like concat('%', #{vendorName}, '%')</if>
|
||||||
|
<if test="vendorNick != null and vendorNick != ''"> and vendor_nick = #{vendorNick}</if>
|
||||||
|
<if test="vendorEn != null and vendorEn != ''"> and vendor_en = #{vendorEn}</if>
|
||||||
|
<if test="vendorDes != null and vendorDes != ''"> and vendor_des = #{vendorDes}</if>
|
||||||
|
<if test="vendorLogo != null and vendorLogo != ''"> and vendor_logo = #{vendorLogo}</if>
|
||||||
|
<if test="vendorLevel != null and vendorLevel != ''"> and vendor_level = #{vendorLevel}</if>
|
||||||
|
<if test="vendorScore != null "> and vendor_score = #{vendorScore}</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="selectMdVendorByVendorId" parameterType="Long" resultMap="MdVendorResult">
|
||||||
|
<include refid="selectMdVendorVo"/>
|
||||||
|
where vendor_id = #{vendorId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkVendorCodeUnique" parameterType="MdVendor" resultMap="MdVendorResult">
|
||||||
|
<include refid="selectMdVendorVo"/>
|
||||||
|
where vendor_code = #{vendorCode} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkVendorNameUnique" parameterType="MdVendor" resultMap="MdVendorResult">
|
||||||
|
<include refid="selectMdVendorVo"/>
|
||||||
|
where vendor_name = #{vendorName} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkVendorNickUnique" parameterType="MdVendor" resultMap="MdVendorResult">
|
||||||
|
<include refid="selectMdVendorVo"/>
|
||||||
|
where vendor_nick = #{vendorNick} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertMdVendor" parameterType="MdVendor" useGeneratedKeys="true" keyProperty="vendorId">
|
||||||
|
insert into md_vendor
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="vendorCode != null and vendorCode != ''">vendor_code,</if>
|
||||||
|
<if test="vendorName != null and vendorName != ''">vendor_name,</if>
|
||||||
|
<if test="vendorNick != null">vendor_nick,</if>
|
||||||
|
<if test="vendorEn != null">vendor_en,</if>
|
||||||
|
<if test="vendorDes != null">vendor_des,</if>
|
||||||
|
<if test="vendorLogo != null">vendor_logo,</if>
|
||||||
|
<if test="vendorLevel != null">vendor_level,</if>
|
||||||
|
<if test="vendorScore != null">vendor_score,</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="vendorCode != null and vendorCode != ''">#{vendorCode},</if>
|
||||||
|
<if test="vendorName != null and vendorName != ''">#{vendorName},</if>
|
||||||
|
<if test="vendorNick != null">#{vendorNick},</if>
|
||||||
|
<if test="vendorEn != null">#{vendorEn},</if>
|
||||||
|
<if test="vendorDes != null">#{vendorDes},</if>
|
||||||
|
<if test="vendorLogo != null">#{vendorLogo},</if>
|
||||||
|
<if test="vendorLevel != null">#{vendorLevel},</if>
|
||||||
|
<if test="vendorScore != null">#{vendorScore},</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="updateMdVendor" parameterType="MdVendor">
|
||||||
|
update md_vendor
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="vendorCode != null and vendorCode != ''">vendor_code = #{vendorCode},</if>
|
||||||
|
<if test="vendorName != null and vendorName != ''">vendor_name = #{vendorName},</if>
|
||||||
|
<if test="vendorNick != null">vendor_nick = #{vendorNick},</if>
|
||||||
|
<if test="vendorEn != null">vendor_en = #{vendorEn},</if>
|
||||||
|
<if test="vendorDes != null">vendor_des = #{vendorDes},</if>
|
||||||
|
<if test="vendorLogo != null">vendor_logo = #{vendorLogo},</if>
|
||||||
|
<if test="vendorLevel != null">vendor_level = #{vendorLevel},</if>
|
||||||
|
<if test="vendorScore != null">vendor_score = #{vendorScore},</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 vendor_id = #{vendorId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteMdVendorByVendorId" parameterType="Long">
|
||||||
|
delete from md_vendor where vendor_id = #{vendorId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteMdVendorByVendorIds" parameterType="String">
|
||||||
|
delete from md_vendor where vendor_id in
|
||||||
|
<foreach item="vendorId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{vendorId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user