Browse Source

基础资料修改

chenw 7 years ago
parent
commit
90a633d104
30 changed files with 290 additions and 14 deletions
  1. 1 0
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  2. 7 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerController.java
  3. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductunitController.java
  4. 4 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/AddressMapper.java
  5. 1 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerListMapper.java
  6. 3 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/FundinouttypeMapper.java
  7. 2 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductbrandMapper.java
  8. 3 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProducttypeMapper.java
  9. 3 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductunitMapper.java
  10. 2 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorkindMapper.java
  11. 2 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/WarehouseMapper.java
  12. 4 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerService.java
  13. 25 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/AddressServiceImpl.java
  14. 16 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java
  15. 25 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java
  16. 26 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductbrandServiceImpl.java
  17. 23 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProducttypeServiceImpl.java
  18. 24 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductunitServiceImpl.java
  19. 24 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorkindServiceImpl.java
  20. 17 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java
  21. 11 2
      applications/document/document-server/src/main/resources/mapper/AddressMapper.xml
  22. 13 0
      applications/document/document-server/src/main/resources/mapper/CustomerListMapper.xml
  23. 2 2
      applications/document/document-server/src/main/resources/mapper/CustomerkindMapper.xml
  24. 12 3
      applications/document/document-server/src/main/resources/mapper/FundinouttypeMapper.xml
  25. 6 0
      applications/document/document-server/src/main/resources/mapper/ProductMapper.xml
  26. 11 2
      applications/document/document-server/src/main/resources/mapper/ProductbrandMapper.xml
  27. 11 2
      applications/document/document-server/src/main/resources/mapper/ProducttypeMapper.xml
  28. 3 0
      applications/document/document-server/src/main/resources/mapper/ProductunitMapper.xml
  29. 5 2
      applications/document/document-server/src/main/resources/mapper/VendorkindMapper.xml
  30. 3 0
      applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml

+ 1 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -23,6 +23,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     BIZ_CLOSE(79301, "只能关闭已审核的单据"),
     BIZ_OPEN(79302, "只能打开已关闭的单据"),
     BOM_SAVE(79401, "产品编号+版本号已存在"),
+    REPEAT_NAME(79501, "名称重复"),
     NO_DATA(79998, "未找到数据"),
     ILLEGAL_ID(79999, "id不正确"),
 

+ 7 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
  * Created by zdw
  * 2018-10-23 11:39.
  */
+@CrossOrigin
 @RestController
 @RequestMapping("/customer")
 public class CustomerController {
@@ -36,6 +37,12 @@ public class CustomerController {
         return Result.success(listData);
     }
 
+    @GetMapping("/dbfind")
+    public Result getDbfind(PageRequest page, ListReqDTO listReqDTO){
+        PageInfo<CustomerList> dbfindData = customerService.getDbfind(page, listReqDTO);
+        return Result.success(dbfindData);
+    }
+
     /**
      * 获取客户资料表单
      *

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductunitController.java

@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.*;
 import java.util.List;
 
 @RestController
-@RequestMapping("/productUnit")
+@RequestMapping("/productunit")
 public class ProductunitController {
 
     @Autowired

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

@@ -2,6 +2,8 @@ package com.usoftchina.saas.document.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Address;
+import org.apache.ibatis.annotations.Param;
+
 import java.util.List;
 
 public interface AddressMapper extends CommonBaseMapper<Address> {
@@ -21,4 +23,6 @@ public interface AddressMapper extends CommonBaseMapper<Address> {
     int updateByPrimaryKey(Address record);
 
     int deleteByIds(String ids);
+
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
 }

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

@@ -8,4 +8,5 @@ import java.util.List;
 public interface CustomerListMapper {
     List<CustomerList> selectCustomerListByCondition(@Param("con") String con, @Param("companyId") Long companyId);
     List<CustomerList> selectCustomerBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+    List<CustomerList> selectDbFind(@Param("condition") String condition, @Param("companyId") Long companyId);
 }

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

@@ -3,6 +3,7 @@ package com.usoftchina.saas.document.mapper;
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Fundinouttype;
+import org.apache.ibatis.annotations.Param;
 
 public interface FundinouttypeMapper extends CommonBaseMapper<Fundinouttype> {
     int deleteByPrimaryKey(Long ft_id);
@@ -16,4 +17,6 @@ public interface FundinouttypeMapper extends CommonBaseMapper<Fundinouttype> {
     int updateByPrimaryKeySelective(Fundinouttype record);
 
     int updateByPrimaryKey(Fundinouttype record);
+
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
 }

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

@@ -22,4 +22,6 @@ public interface ProductbrandMapper extends CommonBaseMapper<Productbrand> {
     int updateByPrimaryKey(Productbrand record);
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
+
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
 }

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

@@ -2,6 +2,7 @@ package com.usoftchina.saas.document.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Producttype;
+import org.apache.ibatis.annotations.Param;
 
 public interface ProducttypeMapper extends CommonBaseMapper<Producttype> {
     int deleteByPrimaryKey(Long id);
@@ -15,4 +16,6 @@ public interface ProducttypeMapper extends CommonBaseMapper<Producttype> {
     int updateByPrimaryKeySelective(Producttype record);
 
     int updateByPrimaryKey(Producttype record);
+
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
 }

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

@@ -2,6 +2,7 @@ package com.usoftchina.saas.document.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Productunit;
+import org.apache.ibatis.annotations.Param;
 
 public interface ProductunitMapper extends CommonBaseMapper<Productunit> {
     int deleteByPrimaryKey(Long pu_id);
@@ -15,4 +16,6 @@ public interface ProductunitMapper extends CommonBaseMapper<Productunit> {
     int updateByPrimaryKeySelective(Productunit record);
 
     int updateByPrimaryKey(Productunit record);
+
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
 }

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

@@ -22,4 +22,6 @@ public interface VendorkindMapper extends CommonBaseMapper<Vendorkind> {
     int updateByPrimaryKey(Vendorkind record);
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
+
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
 }

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

@@ -32,4 +32,6 @@ public interface WarehouseMapper extends CommonBaseMapper<Warehouse> {
     int validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long company);
 
     List<Warehouse> selectWarehouseListByCondition(@Param("con") String con,@Param("companyId") Long companyId);
+
+    int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId);
 }

+ 4 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerService.java

@@ -11,6 +11,8 @@ import com.usoftchina.saas.document.entities.CustomerList;
 import com.usoftchina.saas.document.mapper.CustomerMapper;
 import com.usoftchina.saas.page.PageRequest;
 
+import java.util.List;
+
 /**
  * Created by zdw
  * 2018-10-23 15:26.
@@ -37,4 +39,6 @@ public interface CustomerService extends CommonBaseService<CustomerMapper, Custo
     void batchClose(BatchDealBaseDTO baseDTOs);
 
     void batchOpen(BatchDealBaseDTO baseDTOs);
+
+    PageInfo<CustomerList> getDbfind(PageRequest page, ListReqDTO listReqDTO);
 }

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

@@ -3,13 +3,17 @@ package com.usoftchina.saas.document.service.impl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Address;
 import com.usoftchina.saas.document.mapper.AddressMapper;
 import com.usoftchina.saas.document.service.AddressService;
+import com.usoftchina.saas.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
+
 @Service
 public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Address> implements AddressService {
 
@@ -29,10 +33,18 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
     public boolean save(Address address){
         if(address.getId() == 0){
             address.setCompanyId(BaseContextHolder.getCompanyId());
+            address.setCreateTime(new Date());
+            address.setCreatorId(BaseContextHolder.getUserId());
+            //验证名称是否重复
+            validName(address.getAd_address());
             addressMapper.insertSelective(address);
             //记录LOG
             messageLogService.save(generateMsgObj(address.getId()));
         }else{
+            address.setUpdaterId(BaseContextHolder.getUserId());
+            address.setUpdateTime(new Date());
+            //验证名称是否重复
+            validName(address.getAd_address());
             addressMapper.updateByPrimaryKeySelective(address);
             //记录LOG
             messageLogService.update(generateMsgObj(address.getId()));
@@ -68,4 +80,17 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
     private DocBaseDTO generateMsgObj(Long id){
         return new DocBaseDTO(id, "", "Address");
     }
+
+    /**
+     * 校验
+     * @param name
+     * @return
+     */
+    private boolean validName(String name){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.REPEAT_NAME);
+        }
+        return true;
+    }
 }

+ 16 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java

@@ -331,6 +331,22 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
         }
     }
 
+    @Override
+    public PageInfo<CustomerList> getDbfind(PageRequest page, ListReqDTO listReqDTO) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //查询数据
+        List<CustomerList> lists = customerListMapper.selectDbFind(listReqDTO.getFinalCondition(), BaseContextHolder.getCompanyId());
+        //取分页信息
+        PageInfo<CustomerList> pageInfo = new PageInfo<CustomerList>(lists);
+        return pageInfo;
+    }
+
 
     private List<CustomerList> getListByMode(ListReqDTO req) {
         List<CustomerList> list = null;

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

@@ -3,14 +3,17 @@ package com.usoftchina.saas.document.service.impl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.commons.po.Messagelog;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Fundinouttype;
 import com.usoftchina.saas.document.mapper.FundinouttypeMapper;
 import com.usoftchina.saas.document.service.FundinouttypeService;
+import com.usoftchina.saas.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -28,10 +31,20 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
     public boolean save(Fundinouttype fundinouttype){
         if(fundinouttype.getId() == 0){
             fundinouttype.setCompanyId(BaseContextHolder.getCompanyId());
+            fundinouttype.setCreatorId(BaseContextHolder.getUserId());
+            fundinouttype.setCreateTime(new Date());
+            //验证名称是否重复
+            validName(fundinouttype.getFt_name());
+
             getMapper().insertSelective(fundinouttype);
             //记录LOG
             messageLogService.save(generateMsgObj(fundinouttype.getId()));
         }else{
+            fundinouttype.setUpdaterId(BaseContextHolder.getUserId());
+            fundinouttype.setUpdateTime(new Date());
+            //验证名称是否重复
+            validName(fundinouttype.getFt_name());
+
             getMapper().updateByPrimaryKeySelective(fundinouttype);
             //记录LOG
             messageLogService.update(generateMsgObj(fundinouttype.getId()));
@@ -58,4 +71,16 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
         return new DocBaseDTO(id, null, "FundInOutType");
     }
 
+    /**
+     * 校验
+     * @param name
+     * @return
+     */
+    private boolean validName(String name){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.REPEAT_NAME);
+        }
+        return true;
+    }
 }

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

@@ -4,13 +4,16 @@ import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.ComboDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Productbrand;
 import com.usoftchina.saas.document.mapper.ProductbrandMapper;
 import com.usoftchina.saas.document.service.ProductbrandService;
+import com.usoftchina.saas.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -27,11 +30,21 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
     public boolean save(Productbrand productbrand){
         productbrand.setCompanyId(BaseContextHolder.getCompanyId());
         if(productbrand.getId() == 0){
+            productbrand.setCompanyId(BaseContextHolder.getCompanyId());
+            productbrand.setCreatorId(BaseContextHolder.getUserId());
+            productbrand.setCreateTime(new Date());
+            //验证名称是否重复
+            validName(productbrand.getPb_name());
+
             productbrandMapper.insertSelective(productbrand);
             //记录日志
             DocBaseDTO docBaseDTO = new DocBaseDTO(productbrand.getId(), null, LOG_NAME);
             messageLogService.save(docBaseDTO);
         }else{
+            productbrand.setUpdaterId(BaseContextHolder.getUserId());
+            productbrand.setUpdateTime(new Date());
+            //验证名称是否重复
+            validName(productbrand.getPb_name());
             productbrandMapper.updateByPrimaryKeySelective(productbrand);
             //记录日志
             DocBaseDTO docBaseDTO = new DocBaseDTO(productbrand.getId(), null, LOG_NAME);
@@ -53,4 +66,17 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
     public List<ComboDTO> getCombo() {
         return getMapper().getCombo(BaseContextHolder.getCompanyId());
     }
+
+    /**
+     * 校验
+     * @param name
+     * @return
+     */
+    private boolean validName(String name){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.REPEAT_NAME);
+        }
+        return true;
+    }
 }

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

@@ -3,13 +3,16 @@ package com.usoftchina.saas.document.service.impl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Producttype;
 import com.usoftchina.saas.document.mapper.ProducttypeMapper;
 import com.usoftchina.saas.document.service.ProducttypeService;
+import com.usoftchina.saas.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -29,10 +32,18 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
     public boolean save(Producttype producttype){
         if(producttype.getId() == 0){
             producttype.setCompanyId(BaseContextHolder.getCompanyId());
+            producttype.setCreatorId(BaseContextHolder.getUserId());
+            producttype.setCreateTime(new Date());
+            //验证名称是否重复
+            validName(producttype.getPt_name());
             producttypeMapper.insertSelective(producttype);
             //记录LOG
             messageLogService.save(generateMsgObj(producttype.getId()));
         }else{
+            producttype.setUpdaterId(BaseContextHolder.getUserId());
+            producttype.setUpdateTime(new Date());
+            //验证名称是否重复
+            validName(producttype.getPt_name());
             producttypeMapper.updateByPrimaryKeySelective(producttype);
             //记录LOG
             messageLogService.update(generateMsgObj(producttype.getId()));
@@ -64,4 +75,16 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
         return new DocBaseDTO(id, "", "ProductType");
     }
 
+    /**
+     * 校验
+     * @param name
+     * @return
+     */
+    private boolean validName(String name){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.REPEAT_NAME);
+        }
+        return true;
+    }
 }

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

@@ -3,13 +3,16 @@ package com.usoftchina.saas.document.service.impl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Productunit;
 import com.usoftchina.saas.document.mapper.ProductunitMapper;
 import com.usoftchina.saas.document.service.ProductunitService;
+import com.usoftchina.saas.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -22,10 +25,19 @@ public class ProductunitServiceImpl extends CommonBaseServiceImpl<ProductunitMap
     public boolean save(Productunit productunit){
         if(productunit.getId() == 0){
             productunit.setCompanyId(BaseContextHolder.getCompanyId());
+            productunit.setCreatorId(BaseContextHolder.getUserId());
+            productunit.setCreateTime(new Date());
+            //验证名称是否重复
+            validName(productunit.getPu_name());
+
             getMapper().insertSelective(productunit);
             //记录LOG
             messageLogService.save(generateMsgObj(productunit.getId()));
         }else{
+            productunit.setUpdaterId(BaseContextHolder.getUserId());
+            productunit.setUpdateTime(new Date());
+            //验证名称是否重复
+            validName(productunit.getPu_name());
             getMapper().updateByPrimaryKeySelective(productunit);
             //记录LOG
             messageLogService.update(generateMsgObj(productunit.getId()));
@@ -58,4 +70,16 @@ public class ProductunitServiceImpl extends CommonBaseServiceImpl<ProductunitMap
         return new DocBaseDTO(id, "", "ProductUnit");
     }
 
+    /**
+     * 校验
+     * @param name
+     * @return
+     */
+    private boolean validName(String name){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.REPEAT_NAME);
+        }
+        return true;
+    }
 }

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

@@ -4,13 +4,16 @@ import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.ComboDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Vendorkind;
 import com.usoftchina.saas.document.mapper.VendorkindMapper;
 import com.usoftchina.saas.document.service.VendorkindService;
+import com.usoftchina.saas.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -25,10 +28,18 @@ public class VendorkindServiceImpl extends CommonBaseServiceImpl<VendorkindMappe
     public boolean save(Vendorkind vendorkind){
         if(vendorkind.getId() == 0){
             vendorkind.setCompanyId(BaseContextHolder.getCompanyId());
+            vendorkind.setCreatorId(BaseContextHolder.getUserId());
+            vendorkind.setCreateTime(new Date());
+            //验证名称是否重复
+            validName(vendorkind.getVk_name());
             vendorkindMapper.insertSelective(vendorkind);
             //记录LOG
             messageLogService.save(generateMsgObj(vendorkind.getId()));
         }else{
+            vendorkind.setUpdaterId(BaseContextHolder.getUserId());
+            vendorkind.setUpdateTime(new Date());
+            //验证名称是否重复
+            validName(vendorkind.getVk_name());
             vendorkindMapper.updateByPrimaryKeySelective(vendorkind);
             //记录LOG
             messageLogService.update(generateMsgObj(vendorkind.getId()));
@@ -59,4 +70,17 @@ public class VendorkindServiceImpl extends CommonBaseServiceImpl<VendorkindMappe
     public List<ComboDTO> getCombo() {
         return getMapper().getCombo(BaseContextHolder.getCompanyId());
     }
+
+    /**
+     * 校验
+     * @param name
+     * @return
+     */
+    private boolean validName(String name){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.REPEAT_NAME);
+        }
+        return true;
+    }
 }

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

@@ -107,6 +107,8 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
             record.setCreatorId(BaseContextHolder.getUserId());
             record.setCreateTime(new Date());
 
+            //验证名称是否重复
+            validName(record.getWh_description());
             count = getMapper().insertSelective(record);
             //记录LOG
             docBaseDTO = generateMsgObj(record.getId(), code);
@@ -114,6 +116,8 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
         }else{
             record.setUpdateTime(new Date());
             record.setUpdaterId(BaseContextHolder.getUserId());
+            //验证名称是否重复
+            validName(record.getWh_description());
 
             getMapper().updateByPrimaryKeySelective(record);
             //记录LOG
@@ -221,4 +225,17 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
                 getMapper().validateCodeWhenUpdate(code, id, companyId);
         return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.WAREHOUSE.getCaller()).getData();
     }
+
+    /**
+     * 校验
+     * @param name
+     * @return
+     */
+    private boolean validName(String name){
+        int count = getMapper().selectCountByName(name, BaseContextHolder.getCompanyId());
+        if (count > 0){
+            throw new BizException(BizExceptionCode.REPEAT_NAME);
+        }
+        return true;
+    }
 }

+ 11 - 2
applications/document/document-server/src/main/resources/mapper/AddressMapper.xml

@@ -25,6 +25,9 @@
   </sql>
 
   <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Address">
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into address (ad_recorddate, companyId,
       updaterId, updateTime, ad_text1, 
       ad_text2, ad_text3, ad_text4, 
@@ -35,6 +38,9 @@
       #{ad_text5,jdbcType=VARCHAR}, #{ad_address,jdbcType=LONGVARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Address">
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into address
     <trim prefix="(" suffix=")" suffixOverrides=",">
       <if test="ad_recorddate != null">
@@ -135,7 +141,7 @@
         ad_address = #{ad_address,jdbcType=LONGVARCHAR},
       </if>
     </set>
-    where ad_id = #{ad_id,jdbcType=INTEGER}
+    where ad_id = #{id}
   </update>
   <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.document.entities.Address">
     update address
@@ -164,7 +170,7 @@
       ad_text5 = #{ad_text5,jdbcType=VARCHAR}
     where ad_id = #{id}
   </update>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     delete from address
     where ad_id = #{id}
   </delete>
@@ -175,4 +181,7 @@
   <select id="selectAll" resultMap="ResultMapWithBLOBs">
     SELECT * FROM ADDRESS
   </select>
+  <select id="selectCountByName" resultType="int">
+    SELECT * FROM ADDRESS WHERE AD_ADDRESS=#{name} ADN COMPANYID=#{companyId}
+  </select>
 </mapper>

+ 13 - 0
applications/document/document-server/src/main/resources/mapper/CustomerListMapper.xml

@@ -63,6 +63,19 @@
     </where>  order by cu_id
   </select>
 
+  <select id="selectDbFind" resultMap="BaseResultMap">
+    SELECT * FROM CUSTOMER LEFT JOIN CUSTOMERADDRESS ON CU_ID=CA_CUID AND CUSTOMERADDRESS.CA_DEFAULT=1
+    <where>
+      <if test="condition != null">
+        ${condition}
+      </if>
+      <if test="companyId!=null">
+        and customer.companyid = #{companyId}
+      </if>
+    </where>
+    order by cu_id
+  </select>
+
   <select id="selectCustomerBycondition"  resultMap="BaseResultMap">
     select  *  from customer
     <where>

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

@@ -11,7 +11,7 @@
     <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
     <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
   </resultMap>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
     select 
     <include refid="Base_Column_List" />
     from customerkind
@@ -20,7 +20,7 @@
   <sql id="Base_Column_List" >
     ck_id, ck_name, ck_recordid, ck_recorder, ck_date, companyId, updaterId, updateTime
   </sql>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
     delete from customerkind
     where ck_id = #{id}
   </delete>

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

@@ -20,13 +20,16 @@
     select 
     <include refid="Base_Column_List" />
     from fundinouttype
-    where ft_id = #{id,jdbcType=INTEGER}
+    where ft_id = #{id}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
     delete from fundinouttype
-    where ft_id = #{id,jdbcType=INTEGER}
+    where ft_id = #{id}
   </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Fundinouttype" >
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into fundinouttype (ft_name, ft_kind,
       ft_recordid, ft_recorder, ft_date, 
       companyId, updaterId, updateTime
@@ -37,6 +40,9 @@
       )
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Fundinouttype" >
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into fundinouttype
     <trim prefix="(" suffix=")" suffixOverrides="," >
       <if test="ft_name != null" >
@@ -131,9 +137,12 @@
       companyId = #{companyId,jdbcType=INTEGER},
       updaterId = #{updaterId,jdbcType=INTEGER},
       updateTime = #{updateTime,jdbcType=TIMESTAMP}
-    where ft_id = #{id,jdbcType=INTEGER}
+    where ft_id = #{id}
   </update>
   <select id="selectAll" resultMap="BaseResultMap">
     SELECT * FROM FUNDINOUTTYPE
   </select>
+  <select id="selectCountByName" resultType="int">
+    SELECT COUNT(*) FROM FUNDINOUTTYPE WHERE FT_NAME=#{name} AND COMPANYID=#{companyId}
+  </select>
 </mapper>

+ 6 - 0
applications/document/document-server/src/main/resources/mapper/ProductMapper.xml

@@ -94,6 +94,9 @@
         where pr_id = #{id}
     </delete>
     <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Product" >
+        <selectKey resultType="java.lang.Long" keyProperty="id">
+            SELECT LAST_INSERT_ID() AS ID
+        </selectKey>
         insert into product (pr_code, pr_detail,
         pr_spec, pr_unit, pr_kind,
         pr_orispeccode, pr_whid, pr_whcode,
@@ -118,6 +121,9 @@
         #{pr_text4,jdbcType=VARCHAR}, #{pr_text5,jdbcType=VARCHAR})
     </insert>
     <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Product" >
+        <selectKey resultType="java.lang.Long" keyProperty="id">
+            SELECT LAST_INSERT_ID() AS ID
+        </selectKey>
         insert into product
         <trim prefix="(" suffix=")" suffixOverrides="," >
             <if test="pr_code != null" >

+ 11 - 2
applications/document/document-server/src/main/resources/mapper/ProductbrandMapper.xml

@@ -11,7 +11,7 @@
     <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
     <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
   </resultMap>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
     select 
     *
     from productbrand
@@ -20,11 +20,14 @@
   <sql id="Base_Column_List" >
     pb_id, pb_name, pb_recordid, pb_recorder, pb_date, companyId, updaterId, updateTime
   </sql>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
     delete from productbrand
     where pb_id = #{id}
   </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Productbrand" >
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into productbrand (pb_name, pb_recordid,
       pb_recorder, pb_date, companyId, 
       updaterId, updateTime)
@@ -33,6 +36,9 @@
       #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Productbrand" >
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into productbrand
     <trim prefix="(" suffix=")" suffixOverrides="," >
       <if test="pb_name != null" >
@@ -126,4 +132,7 @@
   <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
     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>
 </mapper>

+ 11 - 2
applications/document/document-server/src/main/resources/mapper/ProducttypeMapper.xml

@@ -14,17 +14,20 @@
   <sql id="Base_Column_List">
     pt_id, pt_name, pt_recordid, pt_recorder, pt_date, companyId, updaterId, updateTime
   </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select 
     <include refid="Base_Column_List" />
     from producttype
     where pt_id = #{id}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     delete from producttype
     where pt_id = #{id}
   </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Producttype">
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into producttype (pt_name, pt_recordid,
       pt_recorder, pt_date, companyId, 
       updaterId, updateTime)
@@ -33,6 +36,9 @@
       #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Producttype">
+    <selectKey resultType="java.lang.Long" keyProperty="id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
     insert into producttype
     <trim prefix="(" suffix=")" suffixOverrides=",">
       <if test="pt_name != null">
@@ -122,4 +128,7 @@
   <select id="selectAll" resultMap="BaseResultMap">
     SELECT * FROM PRODUCTTYPE
   </select>
+    <select id="selectCountByName" resultType="int">
+        SELECT COUNT(*) FROM PRODUCTTYPE WHERE PT_NAME=#{name} AND COMPANYID=#{companyId}
+    </select>
 </mapper>

+ 3 - 0
applications/document/document-server/src/main/resources/mapper/ProductunitMapper.xml

@@ -122,4 +122,7 @@
   <select id="selectAll" resultMap="BaseResultMap">
     SELECT * FROM PRODUCTUNIT
   </select>
+    <select id="selectCountByName" resultType="int">
+        SELECT COUNT(*) FROM productunit WHERE PU_NAME=#{name} AND COMPANYID=#{companyId}
+    </select>
 </mapper>

+ 5 - 2
applications/document/document-server/src/main/resources/mapper/VendorkindMapper.xml

@@ -14,13 +14,13 @@
   <sql id="Base_Column_List">
     vk_id, vk_name, vk_recordid, vk_recorder, vk_date, companyId, updaterId, updateTime
   </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
     from vendorkind
     where vk_id = #{id}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     delete from vendorkind
     where vk_id = #{id}
   </delete>
@@ -131,4 +131,7 @@
   <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
     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>
 </mapper>

+ 3 - 0
applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml

@@ -333,6 +333,9 @@
         order by cu_id
     </select>
 
+    <select id="selectCountByName" resultType="int">
+        SELECT COUNT(*) FROM warehouse WHERE wh_description=#{name} AND COMPANYID=#{companyId}
+    </select>
 
 </mapper>