|
|
|
@ -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
|
|
|
|
|