package cn.ibizlab.assetmanagement.assetapi.rest;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.assetmanagement.assetapi.dto.*;
import cn.ibizlab.assetmanagement.assetapi.mapping.*;
import cn.ibizlab.assetmanagement.core.asset.domain.EAMSparePartsPRO;
import cn.ibizlab.assetmanagement.core.asset.service.IEAMSparePartsPROService;
import cn.ibizlab.assetmanagement.core.asset.filter.EAMSparePartsPROSearchContext;
import cn.ibizlab.assetmanagement.util.annotation.VersionCheck;

@Slf4j
@Api(tags = {"备件包物料" })
@RestController("AssetApi-eamsparepartspro")
@RequestMapping("")
public class EAMSparePartsPROResource {

    @Autowired
    public IEAMSparePartsPROService eamsparepartsproService;

    @Autowired
    @Lazy
    public EAMSparePartsPROMapping eamsparepartsproMapping;

    @PreAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodto),'iBizAssetManagement-EAMSparePartsPRO-Create')")
    @ApiOperation(value = "新建备件包物料", tags = {"备件包物料" },  notes = "新建备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartspros")
    @Transactional
    public ResponseEntity<EAMSparePartsPRODTO> create(@RequestBody EAMSparePartsPRODTO eamsparepartsprodto) {
        EAMSparePartsPRO domain = eamsparepartsproMapping.toDomain(eamsparepartsprodto);
		eamsparepartsproService.create(domain);
        EAMSparePartsPRODTO dto = eamsparepartsproMapping.toDto(domain);
		return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodtos),'iBizAssetManagement-EAMSparePartsPRO-Create')")
    @ApiOperation(value = "批量新建备件包物料", tags = {"备件包物料" },  notes = "批量新建备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartspros/batch")
    public ResponseEntity<Boolean> createBatch(@RequestBody List<EAMSparePartsPRODTO> eamsparepartsprodtos) {
        eamsparepartsproService.createBatch(eamsparepartsproMapping.toDomain(eamsparepartsprodtos));
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @VersionCheck(entity = "eamsparepartspro" , versionfield = "updatedate")
    @PreAuthorize("hasPermission(this.eamsparepartsproService.get(#eamsparepartspro_id),'iBizAssetManagement-EAMSparePartsPRO-Update')")
    @ApiOperation(value = "更新备件包物料", tags = {"备件包物料" },  notes = "更新备件包物料")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamsparepartspros/{eamsparepartspro_id}")
    @Transactional
    public ResponseEntity<EAMSparePartsPRODTO> update(@PathVariable("eamsparepartspro_id") String eamsparepartspro_id, @RequestBody EAMSparePartsPRODTO eamsparepartsprodto) {
		EAMSparePartsPRO domain  = eamsparepartsproMapping.toDomain(eamsparepartsprodto);
        domain .setEamsparepartsproid(eamsparepartspro_id);
		eamsparepartsproService.update(domain );
		EAMSparePartsPRODTO dto = eamsparepartsproMapping.toDto(domain );
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproService.getEamsparepartsproByEntities(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodtos)),'iBizAssetManagement-EAMSparePartsPRO-Update')")
    @ApiOperation(value = "批量更新备件包物料", tags = {"备件包物料" },  notes = "批量更新备件包物料")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamsparepartspros/batch")
    public ResponseEntity<Boolean> updateBatch(@RequestBody List<EAMSparePartsPRODTO> eamsparepartsprodtos) {
        eamsparepartsproService.updateBatch(eamsparepartsproMapping.toDomain(eamsparepartsprodtos));
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproService.get(#eamsparepartspro_id),'iBizAssetManagement-EAMSparePartsPRO-Remove')")
    @ApiOperation(value = "删除备件包物料", tags = {"备件包物料" },  notes = "删除备件包物料")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamsparepartspros/{eamsparepartspro_id}")
    @Transactional
    public ResponseEntity<Boolean> remove(@PathVariable("eamsparepartspro_id") String eamsparepartspro_id) {
         return ResponseEntity.status(HttpStatus.OK).body(eamsparepartsproService.remove(eamsparepartspro_id));
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproService.getEamsparepartsproByIds(#ids),'iBizAssetManagement-EAMSparePartsPRO-Remove')")
    @ApiOperation(value = "批量删除备件包物料", tags = {"备件包物料" },  notes = "批量删除备件包物料")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamsparepartspros/batch")
    public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
        eamsparepartsproService.removeBatch(ids);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PostAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(returnObject.body),'iBizAssetManagement-EAMSparePartsPRO-Get')")
    @ApiOperation(value = "获取备件包物料", tags = {"备件包物料" },  notes = "获取备件包物料")
	@RequestMapping(method = RequestMethod.GET, value = "/eamsparepartspros/{eamsparepartspro_id}")
    public ResponseEntity<EAMSparePartsPRODTO> get(@PathVariable("eamsparepartspro_id") String eamsparepartspro_id) {
        EAMSparePartsPRO domain = eamsparepartsproService.get(eamsparepartspro_id);
        EAMSparePartsPRODTO dto = eamsparepartsproMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @ApiOperation(value = "获取备件包物料草稿", tags = {"备件包物料" },  notes = "获取备件包物料草稿")
	@RequestMapping(method = RequestMethod.GET, value = "/eamsparepartspros/getdraft")
    public ResponseEntity<EAMSparePartsPRODTO> getDraft() {
        return ResponseEntity.status(HttpStatus.OK).body(eamsparepartsproMapping.toDto(eamsparepartsproService.getDraft(new EAMSparePartsPRO())));
    }

    @ApiOperation(value = "检查备件包物料", tags = {"备件包物料" },  notes = "检查备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartspros/checkkey")
    public ResponseEntity<Boolean> checkKey(@RequestBody EAMSparePartsPRODTO eamsparepartsprodto) {
        return  ResponseEntity.status(HttpStatus.OK).body(eamsparepartsproService.checkKey(eamsparepartsproMapping.toDomain(eamsparepartsprodto)));
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodto),'iBizAssetManagement-EAMSparePartsPRO-Save')")
    @ApiOperation(value = "保存备件包物料", tags = {"备件包物料" },  notes = "保存备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartspros/save")
    public ResponseEntity<Boolean> save(@RequestBody EAMSparePartsPRODTO eamsparepartsprodto) {
        return ResponseEntity.status(HttpStatus.OK).body(eamsparepartsproService.save(eamsparepartsproMapping.toDomain(eamsparepartsprodto)));
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodtos),'iBizAssetManagement-EAMSparePartsPRO-Save')")
    @ApiOperation(value = "批量保存备件包物料", tags = {"备件包物料" },  notes = "批量保存备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartspros/savebatch")
    public ResponseEntity<Boolean> saveBatch(@RequestBody List<EAMSparePartsPRODTO> eamsparepartsprodtos) {
        eamsparepartsproService.saveBatch(eamsparepartsproMapping.toDomain(eamsparepartsprodtos));
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMSparePartsPRO-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMSparePartsPRO-Get')")
	@ApiOperation(value = "获取DEFAULT", tags = {"备件包物料" } ,notes = "获取DEFAULT")
    @RequestMapping(method= RequestMethod.GET , value="/eamsparepartspros/fetchdefault")
	public ResponseEntity<List<EAMSparePartsPRODTO>> fetchDefault(EAMSparePartsPROSearchContext context) {
        Page<EAMSparePartsPRO> domains = eamsparepartsproService.searchDefault(context) ;
        List<EAMSparePartsPRODTO> list = eamsparepartsproMapping.toDto(domains.getContent());
        return ResponseEntity.status(HttpStatus.OK)
                .header("x-page", String.valueOf(context.getPageable().getPageNumber()))
                .header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
                .header("x-total", String.valueOf(domains.getTotalElements()))
                .body(list);
	}

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMSparePartsPRO-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMSparePartsPRO-Get')")
	@ApiOperation(value = "查询DEFAULT", tags = {"备件包物料" } ,notes = "查询DEFAULT")
    @RequestMapping(method= RequestMethod.POST , value="/eamsparepartspros/searchdefault")
	public ResponseEntity<Page<EAMSparePartsPRODTO>> searchDefault(@RequestBody EAMSparePartsPROSearchContext context) {
        Page<EAMSparePartsPRO> domains = eamsparepartsproService.searchDefault(context) ;
	    return ResponseEntity.status(HttpStatus.OK)
                .body(new PageImpl(eamsparepartsproMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
	}
    @PreAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodto),'iBizAssetManagement-EAMSparePartsPRO-Create')")
    @ApiOperation(value = "根据备件包建立备件包物料", tags = {"备件包物料" },  notes = "根据备件包建立备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros")
    @Transactional
    public ResponseEntity<EAMSparePartsPRODTO> createByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @RequestBody EAMSparePartsPRODTO eamsparepartsprodto) {
        EAMSparePartsPRO domain = eamsparepartsproMapping.toDomain(eamsparepartsprodto);
        domain.setEamsparepartsgroupid(eamsparepartsgroup_id);
		eamsparepartsproService.create(domain);
        EAMSparePartsPRODTO dto = eamsparepartsproMapping.toDto(domain);
		return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodtos),'iBizAssetManagement-EAMSparePartsPRO-Create')")
    @ApiOperation(value = "根据备件包批量建立备件包物料", tags = {"备件包物料" },  notes = "根据备件包批量建立备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/batch")
    public ResponseEntity<Boolean> createBatchByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @RequestBody List<EAMSparePartsPRODTO> eamsparepartsprodtos) {
        List<EAMSparePartsPRO> domainlist=eamsparepartsproMapping.toDomain(eamsparepartsprodtos);
        for(EAMSparePartsPRO domain:domainlist){
            domain.setEamsparepartsgroupid(eamsparepartsgroup_id);
        }
        eamsparepartsproService.createBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @VersionCheck(entity = "eamsparepartspro" , versionfield = "updatedate")
    @PreAuthorize("hasPermission(this.eamsparepartsproService.get(#eamsparepartspro_id),'iBizAssetManagement-EAMSparePartsPRO-Update')")
    @ApiOperation(value = "根据备件包更新备件包物料", tags = {"备件包物料" },  notes = "根据备件包更新备件包物料")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/{eamsparepartspro_id}")
    @Transactional
    public ResponseEntity<EAMSparePartsPRODTO> updateByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @PathVariable("eamsparepartspro_id") String eamsparepartspro_id, @RequestBody EAMSparePartsPRODTO eamsparepartsprodto) {
        EAMSparePartsPRO domain = eamsparepartsproMapping.toDomain(eamsparepartsprodto);
        domain.setEamsparepartsgroupid(eamsparepartsgroup_id);
        domain.setEamsparepartsproid(eamsparepartspro_id);
		eamsparepartsproService.update(domain);
        EAMSparePartsPRODTO dto = eamsparepartsproMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproService.getEamsparepartsproByEntities(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodtos)),'iBizAssetManagement-EAMSparePartsPRO-Update')")
    @ApiOperation(value = "根据备件包批量更新备件包物料", tags = {"备件包物料" },  notes = "根据备件包批量更新备件包物料")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/batch")
    public ResponseEntity<Boolean> updateBatchByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @RequestBody List<EAMSparePartsPRODTO> eamsparepartsprodtos) {
        List<EAMSparePartsPRO> domainlist=eamsparepartsproMapping.toDomain(eamsparepartsprodtos);
        for(EAMSparePartsPRO domain:domainlist){
            domain.setEamsparepartsgroupid(eamsparepartsgroup_id);
        }
        eamsparepartsproService.updateBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproService.get(#eamsparepartspro_id),'iBizAssetManagement-EAMSparePartsPRO-Remove')")
    @ApiOperation(value = "根据备件包删除备件包物料", tags = {"备件包物料" },  notes = "根据备件包删除备件包物料")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/{eamsparepartspro_id}")
    @Transactional
    public ResponseEntity<Boolean> removeByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @PathVariable("eamsparepartspro_id") String eamsparepartspro_id) {
		return ResponseEntity.status(HttpStatus.OK).body(eamsparepartsproService.remove(eamsparepartspro_id));
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproService.getEamsparepartsproByIds(#ids),'iBizAssetManagement-EAMSparePartsPRO-Remove')")
    @ApiOperation(value = "根据备件包批量删除备件包物料", tags = {"备件包物料" },  notes = "根据备件包批量删除备件包物料")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/batch")
    public ResponseEntity<Boolean> removeBatchByEAMSparePartsGroup(@RequestBody List<String> ids) {
        eamsparepartsproService.removeBatch(ids);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PostAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(returnObject.body),'iBizAssetManagement-EAMSparePartsPRO-Get')")
    @ApiOperation(value = "根据备件包获取备件包物料", tags = {"备件包物料" },  notes = "根据备件包获取备件包物料")
	@RequestMapping(method = RequestMethod.GET, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/{eamsparepartspro_id}")
    public ResponseEntity<EAMSparePartsPRODTO> getByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @PathVariable("eamsparepartspro_id") String eamsparepartspro_id) {
        EAMSparePartsPRO domain = eamsparepartsproService.get(eamsparepartspro_id);
        EAMSparePartsPRODTO dto = eamsparepartsproMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @ApiOperation(value = "根据备件包获取备件包物料草稿", tags = {"备件包物料" },  notes = "根据备件包获取备件包物料草稿")
    @RequestMapping(method = RequestMethod.GET, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/getdraft")
    public ResponseEntity<EAMSparePartsPRODTO> getDraftByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id) {
        EAMSparePartsPRO domain = new EAMSparePartsPRO();
        domain.setEamsparepartsgroupid(eamsparepartsgroup_id);
        return ResponseEntity.status(HttpStatus.OK).body(eamsparepartsproMapping.toDto(eamsparepartsproService.getDraft(domain)));
    }

    @ApiOperation(value = "根据备件包检查备件包物料", tags = {"备件包物料" },  notes = "根据备件包检查备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/checkkey")
    public ResponseEntity<Boolean> checkKeyByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @RequestBody EAMSparePartsPRODTO eamsparepartsprodto) {
        return  ResponseEntity.status(HttpStatus.OK).body(eamsparepartsproService.checkKey(eamsparepartsproMapping.toDomain(eamsparepartsprodto)));
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodto),'iBizAssetManagement-EAMSparePartsPRO-Save')")
    @ApiOperation(value = "根据备件包保存备件包物料", tags = {"备件包物料" },  notes = "根据备件包保存备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/save")
    public ResponseEntity<Boolean> saveByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @RequestBody EAMSparePartsPRODTO eamsparepartsprodto) {
        EAMSparePartsPRO domain = eamsparepartsproMapping.toDomain(eamsparepartsprodto);
        domain.setEamsparepartsgroupid(eamsparepartsgroup_id);
        return ResponseEntity.status(HttpStatus.OK).body(eamsparepartsproService.save(domain));
    }

    @PreAuthorize("hasPermission(this.eamsparepartsproMapping.toDomain(#eamsparepartsprodtos),'iBizAssetManagement-EAMSparePartsPRO-Save')")
    @ApiOperation(value = "根据备件包批量保存备件包物料", tags = {"备件包物料" },  notes = "根据备件包批量保存备件包物料")
	@RequestMapping(method = RequestMethod.POST, value = "/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/savebatch")
    public ResponseEntity<Boolean> saveBatchByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @RequestBody List<EAMSparePartsPRODTO> eamsparepartsprodtos) {
        List<EAMSparePartsPRO> domainlist=eamsparepartsproMapping.toDomain(eamsparepartsprodtos);
        for(EAMSparePartsPRO domain:domainlist){
             domain.setEamsparepartsgroupid(eamsparepartsgroup_id);
        }
        eamsparepartsproService.saveBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMSparePartsPRO-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMSparePartsPRO-Get')")
	@ApiOperation(value = "根据备件包获取DEFAULT", tags = {"备件包物料" } ,notes = "根据备件包获取DEFAULT")
    @RequestMapping(method= RequestMethod.GET , value="/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/fetchdefault")
	public ResponseEntity<List<EAMSparePartsPRODTO>> fetchEAMSparePartsPRODefaultByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id,EAMSparePartsPROSearchContext context) {
        context.setN_eamsparepartsgroupid_eq(eamsparepartsgroup_id);
        Page<EAMSparePartsPRO> domains = eamsparepartsproService.searchDefault(context) ;
        List<EAMSparePartsPRODTO> list = eamsparepartsproMapping.toDto(domains.getContent());
	    return ResponseEntity.status(HttpStatus.OK)
                .header("x-page", String.valueOf(context.getPageable().getPageNumber()))
                .header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
                .header("x-total", String.valueOf(domains.getTotalElements()))
                .body(list);
	}

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMSparePartsPRO-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMSparePartsPRO-Get')")
	@ApiOperation(value = "根据备件包查询DEFAULT", tags = {"备件包物料" } ,notes = "根据备件包查询DEFAULT")
    @RequestMapping(method= RequestMethod.POST , value="/eamsparepartsgroups/{eamsparepartsgroup_id}/eamsparepartspros/searchdefault")
	public ResponseEntity<Page<EAMSparePartsPRODTO>> searchEAMSparePartsPRODefaultByEAMSparePartsGroup(@PathVariable("eamsparepartsgroup_id") String eamsparepartsgroup_id, @RequestBody EAMSparePartsPROSearchContext context) {
        context.setN_eamsparepartsgroupid_eq(eamsparepartsgroup_id);
        Page<EAMSparePartsPRO> domains = eamsparepartsproService.searchDefault(context) ;
	    return ResponseEntity.status(HttpStatus.OK)
                .body(new PageImpl(eamsparepartsproMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
	}
}

