Browse Source

处理基础资料更新是报名称重复问题

chenw 7 years ago
parent
commit
b2a9188b7a
24 changed files with 136 additions and 48 deletions
  1. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/AddressMapper.java
  2. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerkindMapper.java
  3. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/FundinouttypeMapper.java
  4. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductbrandMapper.java
  5. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProducttypeMapper.java
  6. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductunitMapper.java
  7. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorkindMapper.java
  8. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/WarehouseMapper.java
  9. 4 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/AddressServiceImpl.java
  10. 4 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerkindServiceImpl.java
  11. 4 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java
  12. 4 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductbrandServiceImpl.java
  13. 4 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProducttypeServiceImpl.java
  14. 4 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductunitServiceImpl.java
  15. 4 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorkindServiceImpl.java
  16. 4 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java
  17. 12 1
      applications/document/document-server/src/main/resources/mapper/AddressMapper.xml
  18. 12 1
      applications/document/document-server/src/main/resources/mapper/CustomerkindMapper.xml
  19. 12 1
      applications/document/document-server/src/main/resources/mapper/FundinouttypeMapper.xml
  20. 12 1
      applications/document/document-server/src/main/resources/mapper/ProductbrandMapper.xml
  21. 12 1
      applications/document/document-server/src/main/resources/mapper/ProducttypeMapper.xml
  22. 12 1
      applications/document/document-server/src/main/resources/mapper/ProductunitMapper.xml
  23. 12 1
      applications/document/document-server/src/main/resources/mapper/VendorkindMapper.xml
  24. 12 1
      applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/AddressMapper.java

@@ -25,7 +25,7 @@ public interface AddressMapper extends CommonBaseMapper<Address> {
 
     int deleteByIds(String ids);
 
-    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId, @Param("id") Long id);
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerkindMapper.java

@@ -22,5 +22,5 @@ public interface CustomerkindMapper extends CommonBaseMapper<Customerkind> {
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
 
-    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId, @Param("id") Long id);
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/FundinouttypeMapper.java

@@ -21,7 +21,7 @@ public interface FundinouttypeMapper extends CommonBaseMapper<Fundinouttype> {
 
     int updateByPrimaryKey(Fundinouttype record);
 
-    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId, @Param("id") Long id);
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductbrandMapper.java

@@ -23,5 +23,5 @@ public interface ProductbrandMapper extends CommonBaseMapper<Productbrand> {
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
 
-    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId, @Param("id") Long id);
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProducttypeMapper.java

@@ -20,7 +20,7 @@ public interface ProducttypeMapper extends CommonBaseMapper<Producttype> {
 
     int updateByPrimaryKey(Producttype record);
 
-    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId, @Param("id") Long id);
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductunitMapper.java

@@ -20,7 +20,7 @@ public interface ProductunitMapper extends CommonBaseMapper<Productunit> {
 
     int updateByPrimaryKey(Productunit record);
 
-    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId, @Param("id") Long id);
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorkindMapper.java

@@ -23,5 +23,5 @@ public interface VendorkindMapper extends CommonBaseMapper<Vendorkind> {
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
 
-    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId, @Param("id") Long id);
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/WarehouseMapper.java

@@ -33,5 +33,5 @@ public interface WarehouseMapper extends CommonBaseMapper<Warehouse> {
 
     List<Warehouse> selectWarehouseListByCondition(@Param("con") String con,@Param("companyId") Long companyId);
 
-    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId, @Param("id") Long id);
 }

+ 4 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/AddressServiceImpl.java

@@ -38,7 +38,7 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
             address.setCreateTime(new Date());
             address.setCreatorId(BaseContextHolder.getUserId());
             //验证名称是否重复
-            validName(address.getAd_address());
+            validName(address.getAd_address(), address.getId());
             addressMapper.insertSelective(address);
             //记录LOG
             messageLogService.save(generateMsgObj(address.getId()));
@@ -46,7 +46,7 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
             address.setUpdaterId(BaseContextHolder.getUserId());
             address.setUpdateTime(new Date());
             //验证名称是否重复
-            validName(address.getAd_address());
+            validName(address.getAd_address(), address.getId());
             addressMapper.updateByPrimaryKeySelective(address);
             //记录LOG
             messageLogService.update(generateMsgObj(address.getId()));
@@ -93,8 +93,8 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
      * @param name
      * @return
      */
-    private boolean validName(String name){
-        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+    private boolean validName(String name, Long id){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId(), id);
         if (count > 0){
             throw new BizException(BizExceptionCode.REPEAT_NAME);
         }

+ 4 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerkindServiceImpl.java

@@ -36,7 +36,7 @@ public class CustomerkindServiceImpl extends CommonBaseServiceImpl<CustomerkindM
             customerkind.setCreateTime(new Date());
             customerkind.setCreatorId(BaseContextHolder.getUserId());
             //验证名称是否重复
-            validName(customerkind.getCk_name());
+            validName(customerkind.getCk_name(), customerkind.getId());
             customerkindMapper.insertSelective(customerkind);
             //记录LOG
             messageLogService.save(generateMsgObj(customerkind.getId()));
@@ -44,7 +44,7 @@ public class CustomerkindServiceImpl extends CommonBaseServiceImpl<CustomerkindM
             customerkind.setUpdaterId(BaseContextHolder.getUserId());
             customerkind.setUpdateTime(new Date());
             //验证名称是否重复
-            validName(customerkind.getCk_name());
+            validName(customerkind.getCk_name(), customerkind.getId());
             customerkindMapper.updateByPrimaryKeySelective(customerkind);
             //记录LOG
             messageLogService.update(generateMsgObj(customerkind.getId()));
@@ -86,8 +86,8 @@ public class CustomerkindServiceImpl extends CommonBaseServiceImpl<CustomerkindM
      * @param name
      * @return
      */
-    private boolean validName(String name){
-        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+    private boolean validName(String name, Long id){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId(), id);
         if (count > 0){
             throw new BizException(BizExceptionCode.REPEAT_NAME);
         }

+ 4 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java

@@ -35,7 +35,7 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
             fundinouttype.setCreatorId(BaseContextHolder.getUserId());
             fundinouttype.setCreateTime(new Date());
             //验证名称是否重复
-            validName(fundinouttype.getFt_name());
+            validName(fundinouttype.getFt_name(), fundinouttype.getId());
 
             getMapper().insertSelective(fundinouttype);
             //记录LOG
@@ -44,7 +44,7 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
             fundinouttype.setUpdaterId(BaseContextHolder.getUserId());
             fundinouttype.setUpdateTime(new Date());
             //验证名称是否重复
-            validName(fundinouttype.getFt_name());
+            validName(fundinouttype.getFt_name(), fundinouttype.getId());
 
             getMapper().updateByPrimaryKeySelective(fundinouttype);
             //记录LOG
@@ -77,8 +77,8 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
      * @param name
      * @return
      */
-    private boolean validName(String name){
-        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+    private boolean validName(String name, Long id){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId(), id);
         if (count > 0){
             throw new BizException(BizExceptionCode.REPEAT_NAME);
         }

+ 4 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductbrandServiceImpl.java

@@ -34,7 +34,7 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
             productbrand.setCreatorId(BaseContextHolder.getUserId());
             productbrand.setCreateTime(new Date());
             //验证名称是否重复
-            validName(productbrand.getPb_name());
+            validName(productbrand.getPb_name(), productbrand.getId());
 
             productbrandMapper.insertSelective(productbrand);
             //记录日志
@@ -44,7 +44,7 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
             productbrand.setUpdaterId(BaseContextHolder.getUserId());
             productbrand.setUpdateTime(new Date());
             //验证名称是否重复
-            validName(productbrand.getPb_name());
+            validName(productbrand.getPb_name(), productbrand.getId());
             productbrandMapper.updateByPrimaryKeySelective(productbrand);
             //记录日志
             DocBaseDTO docBaseDTO = new DocBaseDTO(productbrand.getId(), null, LOG_NAME);
@@ -72,8 +72,8 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
      * @param name
      * @return
      */
-    private boolean validName(String name){
-        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+    private boolean validName(String name, Long id){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId(), id);
         if (count > 0){
             throw new BizException(BizExceptionCode.REPEAT_NAME);
         }

+ 4 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProducttypeServiceImpl.java

@@ -36,7 +36,7 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
             producttype.setCreatorId(BaseContextHolder.getUserId());
             producttype.setCreateTime(new Date());
             //验证名称是否重复
-            validName(producttype.getPt_name());
+            validName(producttype.getPt_name(), producttype.getId());
             producttypeMapper.insertSelective(producttype);
             //记录LOG
             messageLogService.save(generateMsgObj(producttype.getId()));
@@ -44,7 +44,7 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
             producttype.setUpdaterId(BaseContextHolder.getUserId());
             producttype.setUpdateTime(new Date());
             //验证名称是否重复
-            validName(producttype.getPt_name());
+            validName(producttype.getPt_name(), producttype.getId());
             producttypeMapper.updateByPrimaryKeySelective(producttype);
             //记录LOG
             messageLogService.update(generateMsgObj(producttype.getId()));
@@ -81,8 +81,8 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
      * @param name
      * @return
      */
-    private boolean validName(String name){
-        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+    private boolean validName(String name, Long id){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId(), id);
         if (count > 0){
             throw new BizException(BizExceptionCode.REPEAT_NAME);
         }

+ 4 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductunitServiceImpl.java

@@ -29,7 +29,7 @@ public class ProductunitServiceImpl extends CommonBaseServiceImpl<ProductunitMap
             productunit.setCreatorId(BaseContextHolder.getUserId());
             productunit.setCreateTime(new Date());
             //验证名称是否重复
-            validName(productunit.getPu_name());
+            validName(productunit.getPu_name(), productunit.getId());
 
             getMapper().insertSelective(productunit);
             //记录LOG
@@ -38,7 +38,7 @@ public class ProductunitServiceImpl extends CommonBaseServiceImpl<ProductunitMap
             productunit.setUpdaterId(BaseContextHolder.getUserId());
             productunit.setUpdateTime(new Date());
             //验证名称是否重复
-            validName(productunit.getPu_name());
+            validName(productunit.getPu_name(), productunit.getId());
             getMapper().updateByPrimaryKeySelective(productunit);
             //记录LOG
             messageLogService.update(generateMsgObj(productunit.getId()));
@@ -76,8 +76,8 @@ public class ProductunitServiceImpl extends CommonBaseServiceImpl<ProductunitMap
      * @param name
      * @return
      */
-    private boolean validName(String name){
-        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+    private boolean validName(String name, Long id){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId(), id);
         if (count > 0){
             throw new BizException(BizExceptionCode.REPEAT_NAME);
         }

+ 4 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorkindServiceImpl.java

@@ -31,7 +31,7 @@ public class VendorkindServiceImpl extends CommonBaseServiceImpl<VendorkindMappe
             vendorkind.setCreatorId(BaseContextHolder.getUserId());
             vendorkind.setCreateTime(new Date());
             //验证名称是否重复
-            validName(vendorkind.getVk_name());
+            validName(vendorkind.getVk_name(), vendorkind.getId());
             vendorkindMapper.insertSelective(vendorkind);
             //记录LOG
             messageLogService.save(generateMsgObj(vendorkind.getId()));
@@ -39,7 +39,7 @@ public class VendorkindServiceImpl extends CommonBaseServiceImpl<VendorkindMappe
             vendorkind.setUpdaterId(BaseContextHolder.getUserId());
             vendorkind.setUpdateTime(new Date());
             //验证名称是否重复
-            validName(vendorkind.getVk_name());
+            validName(vendorkind.getVk_name(), vendorkind.getId());
             vendorkindMapper.updateByPrimaryKeySelective(vendorkind);
             //记录LOG
             messageLogService.update(generateMsgObj(vendorkind.getId()));
@@ -76,8 +76,8 @@ public class VendorkindServiceImpl extends CommonBaseServiceImpl<VendorkindMappe
      * @param name
      * @return
      */
-    private boolean validName(String name){
-        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+    private boolean validName(String name, Long id){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId(), id);
         if (count > 0){
             throw new BizException(BizExceptionCode.REPEAT_NAME);
         }

+ 4 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java

@@ -108,7 +108,7 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
             record.setCreateTime(new Date());
 
             //验证名称是否重复
-            validName(record.getWh_description());
+            validName(record.getWh_description(), record.getId());
             count = getMapper().insertSelective(record);
             //记录LOG
             docBaseDTO = generateMsgObj(record.getId(), code);
@@ -117,7 +117,7 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
             record.setUpdateTime(new Date());
             record.setUpdaterId(BaseContextHolder.getUserId());
             //验证名称是否重复
-            validName(record.getWh_description());
+            validName(record.getWh_description(), record.getId());
 
             getMapper().updateByPrimaryKeySelective(record);
             //记录LOG
@@ -231,8 +231,8 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
      * @param name
      * @return
      */
-    private boolean validName(String name){
-        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+    private boolean validName(String name, Long id){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId(), id);
         if (count > 0){
             throw new BizException(BizExceptionCode.REPEAT_NAME);
         }

+ 12 - 1
applications/document/document-server/src/main/resources/mapper/AddressMapper.xml

@@ -182,7 +182,18 @@
     SELECT * FROM ADDRESS
   </select>
   <select id="selectCountByName" resultType="int">
-    SELECT count(*) FROM ADDRESS WHERE AD_ADDRESS=#{name} AND COMPANYID=#{companyId}
+    SELECT count(*) FROM ADDRESS
+    <where>
+        <if test="name!=null">
+           and ad_address=#{name}
+        </if>
+        <if test="companyId!=null">
+           and companyId=#{companyId}
+        </if>
+        <if test="id!=null and id!=0">
+            and ad_id!=#{id}
+        </if>
+    </where>
   </select>
     <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
         SELECT AD_ADDRESS display,AD_ADDRESS value FROM ADDRESS WHERE COMPANYID=#{companyId}

+ 12 - 1
applications/document/document-server/src/main/resources/mapper/CustomerkindMapper.xml

@@ -126,6 +126,17 @@
     SELECT ck_name display,ck_name value FROM CUSTOMERKIND WHERE COMPANYID=#{companyId}
   </select>
     <select id="selectCountByName" resultType="int">
-        SELECT count(*) FROM CUSTOMERKIND WHERE CK_NAME=#{name} AND COMPANYID=#{companyId}
+        SELECT count(*) FROM CUSTOMERKIND
+        <where>
+            <if test="name!=null">
+                and CK_NAME=#{name}
+            </if>
+            <if test="companyId!=0 and companyId!=null">
+                and companyId=#{companyId}
+            </if>
+            <if test="id!=0 and id != null">
+                and ck_id != #{id}
+            </if>
+        </where>
     </select>
 </mapper>

+ 12 - 1
applications/document/document-server/src/main/resources/mapper/FundinouttypeMapper.xml

@@ -143,7 +143,18 @@
     SELECT * FROM FUNDINOUTTYPE
   </select>
   <select id="selectCountByName" resultType="int">
-    SELECT COUNT(*) FROM FUNDINOUTTYPE WHERE FT_NAME=#{name} AND COMPANYID=#{companyId}
+    SELECT COUNT(*) FROM FUNDINOUTTYPE
+    <where>
+        <if test="name!=null">
+            and FT_NAME=#{name}
+        </if>
+        <if test="companyId!=null and companyId!=0">
+            and COMPANYID=#{companyId}
+        </if>
+        <if test="id!=0 and id!=null">
+            and ft_id != #{id}
+        </if>
+    </where>
   </select>
     <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
         SELECT FT_NAME display,FT_NAME value FROM FUNDINOUTTYPE

+ 12 - 1
applications/document/document-server/src/main/resources/mapper/ProductbrandMapper.xml

@@ -133,6 +133,17 @@
     SELECT PB_NAME display,PB_NAME value FROM PRODUCTBRAND
   </select>
   <select id="selectCountByName" resultType="int">
-    SELECT COUNT(*) FROM PRODUCTBRAND WHERE PB_NAME=#{name} AND COMPANYID=#{companyId}
+    SELECT COUNT(*) FROM PRODUCTBRAND
+    <where>
+        <if test="name!=null">
+            and PB_NAME=#{name}
+        </if>
+        <if test="companyId!=null and companyId!=0">
+            and  COMPANYID=#{companyId}
+        </if>
+        <if test="id!=0 and id!=null">
+            and pb_id!=#{id}
+        </if>
+    </where>
   </select>
 </mapper>

+ 12 - 1
applications/document/document-server/src/main/resources/mapper/ProducttypeMapper.xml

@@ -129,7 +129,18 @@
     SELECT * FROM PRODUCTTYPE
   </select>
     <select id="selectCountByName" resultType="int">
-        SELECT COUNT(*) FROM PRODUCTTYPE WHERE PT_NAME=#{name} AND COMPANYID=#{companyId}
+        SELECT COUNT(*) FROM PRODUCTTYPE
+         <where>
+             <if test="name!=null">
+                 and PT_NAME=#{name}
+             </if>
+             <if test="companyId!=null and companyId!=0">
+                 and COMPANYID=#{companyId}
+             </if>
+             <if test="id != null and id != 0">
+                 and pt_id != #{id}
+             </if>
+         </where>
     </select>
     <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
         SELECT PT_NAME display,PT_NAME value FROM PRODUCTTYPE WHERE COMPANYID=#{companyId}

+ 12 - 1
applications/document/document-server/src/main/resources/mapper/ProductunitMapper.xml

@@ -123,7 +123,18 @@
     SELECT * FROM PRODUCTUNIT
   </select>
     <select id="selectCountByName" resultType="int">
-        SELECT COUNT(*) FROM productunit WHERE PU_NAME=#{name} AND COMPANYID=#{companyId}
+        SELECT COUNT(*) FROM productunit
+        <where>
+            <if test="name!=null">
+                and PU_NAME=#{name}
+            </if>
+            <if test="companyId!=0 and companyId!=null">
+                and COMPANYID=#{companyId}
+            </if>
+            <if test="id!=0 and id!=null">
+                and pu_id != #{id}
+            </if>
+        </where>
     </select>
     <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
         SELECT PU_NAME display,PU_NAME value FROM PRODUCTUNIT WHERE COMPANYID=#{companyId}

+ 12 - 1
applications/document/document-server/src/main/resources/mapper/VendorkindMapper.xml

@@ -132,6 +132,17 @@
     SELECT VK_NAME display, VK_NAME value FROM VENDORKIND WHERE COMPANYID=#{companyId}
   </select>
   <select id="selectCountByName" resultType="int">
-    SELECT COUNT(*) FROM VENDORKIND WHERE VK_NAME=#{name} AND COMPANYID=#{companyId}
+    SELECT COUNT(*) FROM VENDORKIND
+    <where>
+        <if test="name!=null">
+            and VK_NAME=#{name}
+        </if>
+        <if test="companyId!=0 and companyId!=null">
+            and COMPANYID=#{companyId}
+        </if>
+        <if test="id!=0 and id!=null">
+            and vk_id != #{id}
+        </if>
+    </where>
   </select>
 </mapper>

+ 12 - 1
applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml

@@ -330,7 +330,18 @@
     </select>
 
     <select id="selectCountByName" resultType="int">
-        SELECT COUNT(*) FROM warehouse WHERE wh_description=#{name} AND COMPANYID=#{companyId}
+        SELECT COUNT(*) FROM warehouse
+        <where>
+            <if test="name!=null">
+                and wh_description=#{name}
+            </if>
+            <if test="companyId!=0 and companyId!=null">
+                and COMPANYID=#{companyId}
+            </if>
+            <if test="id!=0 and id!=null">
+                and wh_id!=#{id}
+            </if>
+        </where>
     </select>
 
 </mapper>