mirror of https://github.com/elunez/eladmin
				
				
				
			委外公司
							parent
							
								
									a0aeb5680c
								
							
						
					
					
						commit
						35a359dcc7
					
				| 
						 | 
				
			
			@ -0,0 +1,66 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.domain;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import cn.hutool.core.bean.copier.CopyOptions;
 | 
			
		||||
import org.hibernate.annotations.CreationTimestamp;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.*;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-03
 | 
			
		||||
*/
 | 
			
		||||
@Entity
 | 
			
		||||
@Data
 | 
			
		||||
@Table(name="bd_out_source_company_info")
 | 
			
		||||
public class OutSourceCompanyInfo implements Serializable {
 | 
			
		||||
 | 
			
		||||
    @Id
 | 
			
		||||
    @GeneratedValue(strategy = GenerationType.IDENTITY)
 | 
			
		||||
    @Column(name = "id")
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    // 委外公司名称
 | 
			
		||||
    @Column(name = "out_source_company_name",nullable = false)
 | 
			
		||||
    private String outSourceCompanyName;
 | 
			
		||||
 | 
			
		||||
    // 期初预收款
 | 
			
		||||
    @Column(name = "initial_pre_money")
 | 
			
		||||
    private Long initialPreMoney;
 | 
			
		||||
 | 
			
		||||
    // 委外公司编号
 | 
			
		||||
    @Column(name = "out_source_company_code",nullable = false)
 | 
			
		||||
    private String outSourceCompanyCode;
 | 
			
		||||
 | 
			
		||||
    // 创建时间
 | 
			
		||||
    @Column(name = "create_time")
 | 
			
		||||
    @CreationTimestamp
 | 
			
		||||
    private Timestamp createTime;
 | 
			
		||||
 | 
			
		||||
    // 更新时间
 | 
			
		||||
    @Column(name = "update_time")
 | 
			
		||||
    @CreationTimestamp
 | 
			
		||||
    private Timestamp updateTime;
 | 
			
		||||
 | 
			
		||||
    // 备注
 | 
			
		||||
    @Column(name = "remark")
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    // 委外公司地址数组[{“province”:””,”city”:””,”area”:””,”address_detail”:””,”sort”:””}]
 | 
			
		||||
    @Column(name = "out_source_company_address")
 | 
			
		||||
    private String outSourceCompanyAddress;
 | 
			
		||||
 | 
			
		||||
    // 委外公司联系人[{“sort”:””,”name”:””,”mobile”:””,”phone”:””,”email”:””,”qq”:””,”weixin”:””,”firstTag”:””}]firstTag 0:非首要联系人 1:首要联系人
 | 
			
		||||
    @Column(name = "out_source_company_contact")
 | 
			
		||||
    private String outSourceCompanyContact;
 | 
			
		||||
 | 
			
		||||
    @Column(name = "status")
 | 
			
		||||
    private Boolean status;
 | 
			
		||||
 | 
			
		||||
    public void copy(OutSourceCompanyInfo source){
 | 
			
		||||
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.repository;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.OutSourceCompanyInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.SupplierInfo;
 | 
			
		||||
import org.springframework.data.jpa.repository.JpaRepository;
 | 
			
		||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 | 
			
		||||
import org.springframework.data.jpa.repository.Modifying;
 | 
			
		||||
import org.springframework.data.jpa.repository.Query;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-03
 | 
			
		||||
*/
 | 
			
		||||
public interface OutSourceCompanyInfoRepository extends JpaRepository<OutSourceCompanyInfo, Long>, JpaSpecificationExecutor {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据主键查看状态正常的委外公司资料
 | 
			
		||||
     * @param id
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    OutSourceCompanyInfo findByIdAndStatusTrue(long id);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除供应商资料
 | 
			
		||||
     * @param id
 | 
			
		||||
     */
 | 
			
		||||
    @Modifying
 | 
			
		||||
    @Query(value = "update bd_out_source_company_info set status = 0 where id = ?1",nativeQuery = true)
 | 
			
		||||
    void deleteOutSourceCompanyInfo(long id);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ public class MaterialCategoryController {
 | 
			
		|||
 | 
			
		||||
    @Log("查看物料类别")
 | 
			
		||||
    @GetMapping(value = "/materialCategory/{id}")
 | 
			
		||||
    public ResponseEntity getMessureUnits(@PathVariable Long id){
 | 
			
		||||
    public ResponseEntity getMessureUnit(@PathVariable Long id){
 | 
			
		||||
        return new ResponseEntity(materialCategoryService.findById(id), HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,82 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.rest;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.aop.log.Log;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.OutSourceCompanyInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.OutSourceCompanyInfoService;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoDTO;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoQueryCriteria;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.data.domain.Pageable;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.security.access.prepost.PreAuthorize;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import io.swagger.annotations.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-03
 | 
			
		||||
*/
 | 
			
		||||
@Api(tags = "委外公司管理")
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("api")
 | 
			
		||||
public class OutSourceCompanyInfoController {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private OutSourceCompanyInfoService outSourceCompanyInfoService;
 | 
			
		||||
 | 
			
		||||
    @Log("分页查询委外公司资料列表")
 | 
			
		||||
    @ApiOperation(value = "分页查询委外公司资料列表")
 | 
			
		||||
    @GetMapping(value = "/outSourceCompanyInfos")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDOUTSOURCECOMPANYINFO_ALL','BDOUTSOURCECOMPANYINFO_SELECT')")
 | 
			
		||||
    public ResponseEntity getOutSourceCompanyInfos(OutSourceCompanyInfoQueryCriteria criteria, Pageable pageable){
 | 
			
		||||
        return new ResponseEntity(outSourceCompanyInfoService.queryAll(criteria,pageable),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Log("查询委外公司资料列表")
 | 
			
		||||
    @ApiOperation(value = "分页查询委外公司资料列表")
 | 
			
		||||
    @GetMapping(value = "/getOutSourceCompanyInfoList")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDOUTSOURCECOMPANYINFO_ALL','BDOUTSOURCECOMPANYINFO_SELECT')")
 | 
			
		||||
    public ResponseEntity getOutSourceCompanyInfoList(OutSourceCompanyInfoQueryCriteria criteria){
 | 
			
		||||
        return new ResponseEntity(outSourceCompanyInfoService.queryAll(criteria),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Log("查询委外公司详情")
 | 
			
		||||
    @ApiOperation(value = "查询委外公司详情")
 | 
			
		||||
    @GetMapping(value = "/outSourceCompanyInfo/{id}")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDOUTSOURCECOMPANYINFO_ALL','BDOUTSOURCECOMPANYINFO_SELECT')")
 | 
			
		||||
    public ResponseEntity getOutSourceCompanyInfoList(@PathVariable("id") Long id){
 | 
			
		||||
        OutSourceCompanyInfoDTO outSourceCompanyInfoDTO = outSourceCompanyInfoService.findById(id);
 | 
			
		||||
        return new ResponseEntity(outSourceCompanyInfoDTO,HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Log("新增委外公司资料")
 | 
			
		||||
    @ApiOperation(value = "新增委外公司资料")
 | 
			
		||||
    @PostMapping(value = "/outSourceCompanyInfo")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDOUTSOURCECOMPANYINFO_ALL','BDOUTSOURCECOMPANYINFO_CREATE')")
 | 
			
		||||
    public ResponseEntity create(@Validated @RequestBody OutSourceCompanyInfo resources){
 | 
			
		||||
        return new ResponseEntity(outSourceCompanyInfoService.create(resources),HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("修改委外公司资料")
 | 
			
		||||
    @ApiOperation(value = "修改委外公司资料")
 | 
			
		||||
    @PutMapping(value = "/outSourceCompanyInfo")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDOUTSOURCECOMPANYINFO_ALL','BDOUTSOURCECOMPANYINFO_EDIT')")
 | 
			
		||||
    public ResponseEntity update(@Validated @RequestBody OutSourceCompanyInfo resources){
 | 
			
		||||
        outSourceCompanyInfoService.update(resources);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.NO_CONTENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("删除委外公司资料")
 | 
			
		||||
    @ApiOperation(value = "删除委外公司资料")
 | 
			
		||||
    @DeleteMapping(value = "/outSourceCompanyInfo/{id}")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDOUTSOURCECOMPANYINFO_ALL','BDOUTSOURCECOMPANYINFO_DELETE')")
 | 
			
		||||
    public ResponseEntity delete(@PathVariable Long id){
 | 
			
		||||
        outSourceCompanyInfoService.delete(id);
 | 
			
		||||
        return new ResponseEntity(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,64 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.service;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.OutSourceCompanyInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoDTO;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoQueryCriteria;
 | 
			
		||||
//import org.springframework.cache.annotation.CacheConfig;
 | 
			
		||||
//import org.springframework.cache.annotation.CacheEvict;
 | 
			
		||||
//import org.springframework.cache.annotation.Cacheable;
 | 
			
		||||
import org.springframework.data.domain.Pageable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-03
 | 
			
		||||
*/
 | 
			
		||||
//@CacheConfig(cacheNames = "bdOutSourceCompanyInfo")
 | 
			
		||||
public interface OutSourceCompanyInfoService {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    * queryAll 分页
 | 
			
		||||
    * @param criteria
 | 
			
		||||
    * @param pageable
 | 
			
		||||
    * @return
 | 
			
		||||
    */
 | 
			
		||||
    //@Cacheable(keyGenerator = "keyGenerator")
 | 
			
		||||
    Object queryAll(OutSourceCompanyInfoQueryCriteria criteria, Pageable pageable);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    * queryAll 不分页
 | 
			
		||||
    * @param criteria
 | 
			
		||||
    * @return
 | 
			
		||||
    */
 | 
			
		||||
    //@Cacheable(keyGenerator = "keyGenerator")
 | 
			
		||||
    public Object queryAll(OutSourceCompanyInfoQueryCriteria criteria);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * findById
 | 
			
		||||
     * @param id
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    //@Cacheable(key = "#p0")
 | 
			
		||||
    OutSourceCompanyInfoDTO findById(Long id);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * create
 | 
			
		||||
     * @param resources
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    //@CacheEvict(allEntries = true)
 | 
			
		||||
    OutSourceCompanyInfoDTO create(OutSourceCompanyInfo resources);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * update
 | 
			
		||||
     * @param resources
 | 
			
		||||
     */
 | 
			
		||||
    //@CacheEvict(allEntries = true)
 | 
			
		||||
    void update(OutSourceCompanyInfo resources);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * delete
 | 
			
		||||
     * @param id
 | 
			
		||||
     */
 | 
			
		||||
    //@CacheEvict(allEntries = true)
 | 
			
		||||
    void delete(Long id);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,42 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.service.dto;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-03
 | 
			
		||||
*/
 | 
			
		||||
@Data
 | 
			
		||||
public class OutSourceCompanyInfoDTO implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    // 委外公司名称
 | 
			
		||||
    private String outSourceCompanyName;
 | 
			
		||||
 | 
			
		||||
    // 期初预收款
 | 
			
		||||
    private Long initialPreMoney;
 | 
			
		||||
 | 
			
		||||
    // 委外公司编号
 | 
			
		||||
    private String outSourceCompanyCode;
 | 
			
		||||
 | 
			
		||||
    // 创建时间
 | 
			
		||||
    private Timestamp createTime;
 | 
			
		||||
 | 
			
		||||
    // 更新时间
 | 
			
		||||
    private Timestamp updateTime;
 | 
			
		||||
 | 
			
		||||
    // 备注
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    // 委外公司地址数组[{“province”:””,”city”:””,”area”:””,”address_detail”:””,”sort”:””}]
 | 
			
		||||
    private String outSourceCompanyAddress;
 | 
			
		||||
 | 
			
		||||
    // 委外公司联系人[{“sort”:””,”name”:””,”mobile”:””,”phone”:””,”email”:””,”qq”:””,”weixin”:””,”firstTag”:””}]firstTag 0:非首要联系人 1:首要联系人
 | 
			
		||||
    private String outSourceCompanyContact;
 | 
			
		||||
 | 
			
		||||
    private Boolean status;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.service.dto;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import me.zhengjie.annotation.Query;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-03
 | 
			
		||||
*/
 | 
			
		||||
@Data
 | 
			
		||||
public class OutSourceCompanyInfoQueryCriteria {
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,122 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.service.impl;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.exception.BadRequestException;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.OutSourceCompanyInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.SupplierInfo;
 | 
			
		||||
import me.zhengjie.utils.ValidationUtil;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.repository.OutSourceCompanyInfoRepository;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.OutSourceCompanyInfoService;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoDTO;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoQueryCriteria;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.mapper.OutSourceCompanyInfoMapper;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.data.jpa.domain.Specification;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Propagation;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Optional;
 | 
			
		||||
import org.springframework.data.domain.Page;
 | 
			
		||||
import org.springframework.data.domain.Pageable;
 | 
			
		||||
import me.zhengjie.utils.PageUtil;
 | 
			
		||||
import me.zhengjie.utils.QueryHelp;
 | 
			
		||||
import org.springframework.util.CollectionUtils;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.criteria.CriteriaBuilder;
 | 
			
		||||
import javax.persistence.criteria.CriteriaQuery;
 | 
			
		||||
import javax.persistence.criteria.Predicate;
 | 
			
		||||
import javax.persistence.criteria.Root;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-03
 | 
			
		||||
*/
 | 
			
		||||
@Service
 | 
			
		||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
 | 
			
		||||
public class OutSourceCompanyInfoServiceImpl implements OutSourceCompanyInfoService {
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private OutSourceCompanyInfoRepository outSourceCompanyInfoRepository;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private OutSourceCompanyInfoMapper outSourceCompanyInfoMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Object queryAll(OutSourceCompanyInfoQueryCriteria criteria, Pageable pageable){
 | 
			
		||||
        Specification<OutSourceCompanyInfo> specification = new Specification<OutSourceCompanyInfo>() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public Predicate toPredicate(Root<OutSourceCompanyInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
 | 
			
		||||
 | 
			
		||||
                List<Predicate> targetPredicateList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
                Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1);
 | 
			
		||||
                targetPredicateList.add(statusPredicate);
 | 
			
		||||
 | 
			
		||||
                if(CollectionUtils.isEmpty(targetPredicateList)){
 | 
			
		||||
                    return null;
 | 
			
		||||
                }else{
 | 
			
		||||
                    return criteriaBuilder.and(targetPredicateList.toArray(new Predicate[targetPredicateList.size()]));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        Page<OutSourceCompanyInfo> page = outSourceCompanyInfoRepository.findAll(specification, pageable);
 | 
			
		||||
        return PageUtil.toPage(page.map(outSourceCompanyInfoMapper::toDto));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Object queryAll(OutSourceCompanyInfoQueryCriteria criteria){
 | 
			
		||||
        Specification<OutSourceCompanyInfo> specification = new Specification<OutSourceCompanyInfo>() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public Predicate toPredicate(Root<OutSourceCompanyInfo> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
 | 
			
		||||
 | 
			
		||||
                List<Predicate> targetPredicateList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
                Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1);
 | 
			
		||||
                targetPredicateList.add(statusPredicate);
 | 
			
		||||
 | 
			
		||||
                if(CollectionUtils.isEmpty(targetPredicateList)){
 | 
			
		||||
                    return null;
 | 
			
		||||
                }else{
 | 
			
		||||
                    return criteriaBuilder.and(targetPredicateList.toArray(new Predicate[targetPredicateList.size()]));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        return outSourceCompanyInfoMapper.toDto(outSourceCompanyInfoRepository.findAll(specification));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public OutSourceCompanyInfoDTO findById(Long id) {
 | 
			
		||||
        Optional<OutSourceCompanyInfo> bdOutSourceCompanyInfo = outSourceCompanyInfoRepository.findById(id);
 | 
			
		||||
        ValidationUtil.isNull(bdOutSourceCompanyInfo,"OutSourceCompanyInfo","id",id);
 | 
			
		||||
        return outSourceCompanyInfoMapper.toDto(bdOutSourceCompanyInfo.get());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public OutSourceCompanyInfoDTO create(OutSourceCompanyInfo resources) {
 | 
			
		||||
        resources.setStatus(true);
 | 
			
		||||
        return outSourceCompanyInfoMapper.toDto(outSourceCompanyInfoRepository.save(resources));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(OutSourceCompanyInfo resources) {
 | 
			
		||||
        Optional<OutSourceCompanyInfo> optionalBdOutSourceCompanyInfo = outSourceCompanyInfoRepository.findById(resources.getId());
 | 
			
		||||
        ValidationUtil.isNull( optionalBdOutSourceCompanyInfo,"BdOutSourceCompanyInfo","id",resources.getId());
 | 
			
		||||
        OutSourceCompanyInfo outSourceCompanyInfo = optionalBdOutSourceCompanyInfo.get();
 | 
			
		||||
        outSourceCompanyInfo.copy(resources);
 | 
			
		||||
        outSourceCompanyInfoRepository.save(outSourceCompanyInfo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void delete(Long id) {
 | 
			
		||||
        OutSourceCompanyInfo outSourceCompanyInfo = outSourceCompanyInfoRepository.findByIdAndStatusTrue(id);
 | 
			
		||||
        if (null == outSourceCompanyInfo) {
 | 
			
		||||
            throw new BadRequestException("委外公司资料不存在!");
 | 
			
		||||
        }
 | 
			
		||||
        outSourceCompanyInfoRepository.deleteOutSourceCompanyInfo(id);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -98,8 +98,8 @@ public class SupplierInfoServiceImpl implements SupplierInfoService {
 | 
			
		|||
    public SupplierInfoDTO create(SupplierInfo resources) {
 | 
			
		||||
        resources.setStatus(true);
 | 
			
		||||
        SupplierInfo supplierInfo = supplierInfoRepository.save(resources);
 | 
			
		||||
        SupplierInfoDTO supplierInfoDTO = supplierInfoMapper.toDto(supplierInfo);
 | 
			
		||||
        return supplierInfoDTO;
 | 
			
		||||
        supplierInfoMapper.toDto(supplierInfo);
 | 
			
		||||
        return supplierInfoMapper.toDto(supplierInfo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.service.mapper;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.mapper.EntityMapper;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.OutSourceCompanyInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoDTO;
 | 
			
		||||
import org.mapstruct.Mapper;
 | 
			
		||||
import org.mapstruct.ReportingPolicy;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-03
 | 
			
		||||
*/
 | 
			
		||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
 | 
			
		||||
public interface OutSourceCompanyInfoMapper extends EntityMapper<OutSourceCompanyInfoDTO, OutSourceCompanyInfo> {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue