基础信息供应商

highway
A0010407 1 year ago
parent 087174b6f6
commit 2de86224d7

@ -72,7 +72,13 @@ public class BaseSupplierController extends BaseController {
@Log(title = "供应商管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseSupplier baseSupplier) {
return toAjax(baseSupplierService.insertBaseSupplier(baseSupplier));
if (baseSupplierService.checkCodeUnique(baseSupplier)) {
return AjaxResult.error("供应商编码已存在!");
}else if(baseSupplierService.checkNameUnique(baseSupplier)){
return AjaxResult.error("供应商名称已存在!");
}else{
return toAjax(baseSupplierService.insertBaseSupplier(baseSupplier));
}
}
/**

@ -58,4 +58,7 @@ public interface BaseSupplierMapper {
* @return
*/
public int deleteBaseSupplierBySupplierIds(String[] supplierIds);
String checkNameUnique(BaseSupplier baseSupplier);
String checkCodeUnique(BaseSupplier baseSupplier);
}

@ -57,4 +57,7 @@ public interface IBaseSupplierService {
* @return
*/
public int deleteBaseSupplierBySupplierId(String supplierId);
boolean checkCodeUnique(BaseSupplier baseSupplier);
boolean checkNameUnique(BaseSupplier baseSupplier);
}

@ -97,4 +97,36 @@ public class BaseSupplierServiceImpl implements IBaseSupplierService {
public int deleteBaseSupplierBySupplierId(String supplierId) {
return baseSupplierMapper.deleteBaseSupplierBySupplierId(supplierId);
}
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public boolean checkCodeUnique(BaseSupplier baseSupplier) {
String code = baseSupplierMapper.checkCodeUnique(baseSupplier);
if(code == null){
return false;
}else{
return true;
}
}
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public boolean checkNameUnique(BaseSupplier baseSupplier) {
String name = baseSupplierMapper.checkNameUnique(baseSupplier);
if(name == null){
return false;
}else{
return true;
}
}
}

@ -40,8 +40,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBaseSupplierList" parameterType="BaseSupplier" resultMap="BaseSupplierResult">
<include refid="selectBaseSupplierVo"/>
<where>
<if test="supplierCode != null and supplierCode != ''"> and supplier_code = #{supplierCode}</if>
<if test="zhDesc != null and zhDesc != ''"> and zh_desc = #{zhDesc}</if>
<if test="supplierCode != null and supplierCode != ''"> and supplier_code like concat('%', #{supplierCode}, '%')</if>
<if test="zhDesc != null and zhDesc != ''"> and zh_desc like concat('%', #{zhDesc}, '%')</if>
<if test="enDesc != null and enDesc != ''"> and en_desc = #{enDesc}</if>
<if test="supplierType != null and supplierType != ''"> and supplier_type = #{supplierType}</if>
<if test="accountNumber != null and accountNumber != ''"> and account_number = #{accountNumber}</if>
@ -52,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="area != null and area != ''"> and area = #{area}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="postcode != null and postcode != ''"> and postcode = #{postcode}</if>
<if test="contact != null and contact != ''"> and contact = #{contact}</if>
<if test="contact != null and contact != ''"> and contact like concat('%', #{contact}, '%')</if>
<if test="contactPhone != null and contactPhone != ''"> and contact_phone = #{contactPhone}</if>
<if test="contactPosition != null and contactPosition != ''"> and contact_position = #{contactPosition}</if>
<if test="contactEmail != null and contactEmail != ''"> and contact_email = #{contactEmail}</if>
@ -170,4 +170,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{supplierId}
</foreach>
</delete>
<select id="checkNameUnique" parameterType="BaseSupplier" resultType ="java.lang.String">
select zh_desc
from base_supplier
where zh_desc = #{zhDesc}
</select>
<select id="checkCodeUnique" parameterType="BaseSupplier" resultType ="java.lang.String">
select supplier_code
from base_supplier
where supplier_code = #{supplierCode}
</select>
</mapper>
Loading…
Cancel
Save