types(fix) product search sql
This commit is contained in:
parent
6b115b5439
commit
b39dc1c095
|
@ -82,14 +82,14 @@ func (ps *ProductSearch) BuildTagSearch() string {
|
|||
func (ps *ProductSearch) BuildSearch() string {
|
||||
sql := `SELECT DISTINCT p.*
|
||||
FROM Product p
|
||||
JOIN ProductTagging ptg ON p.ProductID = ptg.ProductID
|
||||
JOIN ProductTag pt ON ptg.TagID = pt.TagID
|
||||
LEFT OUTER JOIN ProductTagging ptg ON p.ProductID = ptg.ProductID
|
||||
LEFT OUTER JOIN ProductTag pt ON ptg.TagID = pt.TagID
|
||||
`
|
||||
|
||||
filters := []string{}
|
||||
|
||||
if ps.Ean != "" {
|
||||
filters = append(filters, "p.ean LIKE '%%"+ps.Ean+"%%'")
|
||||
filters = append(filters, fmt.Sprintf("p.ean LIKE '%%%s%%'", ps.Ean))
|
||||
}
|
||||
if len(ps.Names) > 0 {
|
||||
filters = append(filters, ps.BuildNamesSearch())
|
||||
|
|
Loading…
Reference in New Issue