给多属性接口增加属性值的查询条件
This commit is contained in:
@@ -55,7 +55,8 @@ public class MaterialAttributeController extends BaseController {
|
||||
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
|
||||
HttpServletRequest request)throws Exception {
|
||||
String attributeName = StringUtil.getInfo(search, "attributeName");
|
||||
List<MaterialAttribute> list = materialAttributeService.select(attributeName);
|
||||
String attributeValue = StringUtil.getInfo(search, "attributeValue");
|
||||
List<MaterialAttribute> list = materialAttributeService.select(attributeName, attributeValue);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import java.util.List;
|
||||
public interface MaterialAttributeMapperEx {
|
||||
|
||||
List<MaterialAttribute> selectByConditionMaterialAttribute(
|
||||
@Param("attributeName") String attributeName);
|
||||
@Param("attributeName") String attributeName,
|
||||
@Param("attributeValue") String attributeValue);
|
||||
|
||||
int batchDeleteMaterialAttributeByIds(
|
||||
@Param("ids") String ids[]);
|
||||
|
||||
@@ -57,11 +57,11 @@ public class MaterialAttributeService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MaterialAttribute> select(String attributeName) throws Exception{
|
||||
public List<MaterialAttribute> select(String attributeName, String attributeValue) throws Exception{
|
||||
List<MaterialAttribute> list = new ArrayList<>();
|
||||
try{
|
||||
PageUtils.startPage();
|
||||
list = materialAttributeMapperEx.selectByConditionMaterialAttribute(attributeName);
|
||||
list = materialAttributeMapperEx.selectByConditionMaterialAttribute(attributeName, attributeValue);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
<bind name="bindAttributeName" value="'%'+attributeName+'%'"/>
|
||||
and ma.attribute_name like #{bindAttributeName}
|
||||
</if>
|
||||
<if test="attributeValue != null">
|
||||
<bind name="bindAttributeValue" value="'%'+attributeValue+'%'"/>
|
||||
and ma.attribute_value like #{bindAttributeValue}
|
||||
</if>
|
||||
and ifnull(ma.delete_flag,'0') !='1'
|
||||
order by ma.id desc
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user