add searching field for avs integration
parent
dc0b83a65f
commit
21194519e6
|
@ -26,6 +26,7 @@ public class JobCardDAO {
|
|||
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, code, job_order_id, created_at, created_by, status, inventory_status, customer, lot_number, purchase_order_id, location_site_id, description, poQuantity, articleName) VALUES (:id, :code, :job_order_id, :created_at, :created_by, :status, :inventory_status, :customer, :lot_number, :purchase_order_id, :location_site_id, :description, :poQuantity, :articleName) ON DUPLICATE KEY UPDATE code = VALUES(code), job_order_id = VALUES(job_order_id), created_at = VALUES(created_at), created_by = VALUES(created_by), status = VALUES(status), inventory_status = VALUES(inventory_status), customer = VALUES(customer), lot_number = VALUES(lot_number), purchase_order_id = VALUES(purchase_order_id), location_site_id = VALUES(location_site_id), description = VALUES(description), poQuantity = VALUES(poQuantity), articleName = VALUES(articleName) ", TABLE_NAME );
|
||||
private final String SELECT_BY_LIKE_CODE_AND_INV_STATUS_AND_STATUS = String.format( "SELECT * FROM %s WHERE code like :code AND status = :status AND inventory_status = :inventory_status", TABLE_NAME );
|
||||
private final String SELECT_BY_LIKE_CODE = String.format( "SELECT * FROM %s WHERE code like :code", TABLE_NAME );
|
||||
private final String SELECT_BY_LIKE_CODE_AND_PO_ID = String.format( "SELECT * FROM %s WHERE code like :code AND purchase_order_id = :purchase_order_id", TABLE_NAME );
|
||||
private final String SELECT_BY_LIMIT = String.format( "SELECT * FROM %s WHERE created_by = :created_by ORDER BY id ASC limit :limit", TABLE_NAME );
|
||||
|
||||
// prepare query params
|
||||
|
@ -95,6 +96,13 @@ public class JobCardDAO {
|
|||
return namedParameterJdbcTemplate.query(SELECT_BY_LIKE_CODE, params, new JobCardRowMapper());
|
||||
}
|
||||
|
||||
public List<JobCard> findLikeCodeAndPoID( String code, long poID ) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("code", "%" + code + "%");
|
||||
params.addValue("purchase_order_id", poID);
|
||||
return namedParameterJdbcTemplate.query(SELECT_BY_LIKE_CODE_AND_PO_ID, params, new JobCardRowMapper());
|
||||
}
|
||||
|
||||
public List<JobCard> findLikeCode( String code , String inventoryStatus, String status ){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue( "code", "%" + code + "%" );
|
||||
|
|
|
@ -23,6 +23,13 @@ public class JobCardRestController {
|
|||
return jobCardService.searchJobCards( term , filter );
|
||||
}
|
||||
|
||||
//search job card for avs integration
|
||||
@GetMapping( "/search-avs-jobcard" )
|
||||
public List<JobCard> searchJobCardByTermAndPOId( @RequestParam(value = "term", required = false) String term,
|
||||
@RequestParam(value = "poId") long poID){
|
||||
return jobCardService.searchJobCardsByTermAndPoId( term , poID );
|
||||
}
|
||||
|
||||
@GetMapping ( "/{id}/items" )
|
||||
public List<JobCardItem> getJobCardItems( @PathVariable( "id" ) long jobCardId ){
|
||||
return jobCardService.getJobCardItems( jobCardId );
|
||||
|
|
|
@ -78,6 +78,13 @@ public class JobCardService {
|
|||
return cards;
|
||||
}
|
||||
|
||||
/*
|
||||
* search by code and po id
|
||||
* */
|
||||
public List<JobCard> searchJobCardsByTermAndPoId( String term, long id ){
|
||||
return jobCardDAO.findLikeCodeAndPoID( term, id );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get cards
|
||||
|
|
Loading…
Reference in New Issue