Merge pull request 'fixed Items Search By SKu' (#15) from print-job-card into main
Reviewed-on: http://git.utopiadeals.com:8080/UIND/cut-to-pack-service/pulls/15main
commit
98b6cae284
|
@ -42,7 +42,7 @@ public class ItemDAO {
|
|||
TABLE_NAME);
|
||||
private final String SELECT_BY_IDS = String.format("SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME);
|
||||
private final String SELECT_BY_IDS_AND_ACTIVE = String.format("SELECT * FROM %s WHERE id IN (:ids) AND is_active = 1 ", TABLE_NAME);
|
||||
private final String SELECT_LIKE_TITLE_AND_STATUS_QUERY = String.format("SELECT * FROM %s WHERE is_active = :is_active AND title LIKE :title ORDER BY title ASC limit 100 offset 0", TABLE_NAME);
|
||||
private final String SELECT_LIKE_TITLE_AND_STATUS_QUERY_OR_SKU = String.format("SELECT * FROM %s WHERE is_active = :is_active AND title LIKE :title OR sku LIKE :sku ORDER BY title ASC limit 100 offset 0", TABLE_NAME);
|
||||
private final String SELECT_LIKE_TITLE_BY_DEPARTMENT_QUERY =
|
||||
String.format("SELECT * FROM %s WHERE department_id = :department_id AND title LIKE :title ORDER BY title ASC", TABLE_NAME);
|
||||
private final String SELECT_LIKE_TITLE = String.format("SELECT * FROM %s WHERE title LIKE :item_title", TABLE_NAME);
|
||||
|
@ -232,11 +232,12 @@ public class ItemDAO {
|
|||
}
|
||||
|
||||
// find all like title (active only)
|
||||
public List<Item> findLikeTitleAndStatus(String title, boolean active) {
|
||||
public List<Item> findLikeTitleAndStatusORSKU(String title, boolean active) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("title", "%" + title + "%");
|
||||
params.addValue("is_active", active);
|
||||
return namedParameterJdbcTemplate.query(SELECT_LIKE_TITLE_AND_STATUS_QUERY, params, new ItemRowMapper());
|
||||
params.addValue("sku", "%" + title + "%");
|
||||
return namedParameterJdbcTemplate.query(SELECT_LIKE_TITLE_AND_STATUS_QUERY_OR_SKU, params, new ItemRowMapper());
|
||||
}
|
||||
|
||||
// find all like title and department
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ItemRestController {
|
|||
items = itemDAO.findBySkuOrTitleAndTypeIdAndActive(term, Arrays.stream(typeIds).collect(Collectors.toList()), "1" );
|
||||
} else {
|
||||
// else return all results
|
||||
items = itemDAO.findLikeTitleAndStatus(term, true );
|
||||
items = itemDAO.findLikeTitleAndStatusORSKU(term, true );
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
|
|
@ -1151,7 +1151,7 @@ if ( typeof Vue !== 'undefined' ) {
|
|||
}
|
||||
// else format item title with code
|
||||
if ( typeof item.code !== 'undefined' ) {
|
||||
return `${item.title} (${item.code})`;
|
||||
return `${item.title} (${item.sku}) (${item.code})`;
|
||||
}
|
||||
// item title only
|
||||
return item.title;
|
||||
|
|
Loading…
Reference in New Issue