tb_type_template 模板表字段类型长度含义IdBigint主键nameVarchar80模板名称Spec_idsVarchar1000关联规格(json格式)brand_idsVarchar1000关联品牌(json格式)custom_attribute_itemsVarchar2000扩展属性
前端:
select2组件在官网下载!
HTML:
<input select2 select2-model="entity.brandIds" config="brandList" multiple placeholder="选择品牌(可多选)" class="form-control" type="text"/>multiple作为单个属性 表示可多选Config用于配置数据来源select2-model用于指定用户选择后提交的变量
js:
$scope.brandList={data:[]};//此为数据来源,创建关联品牌对象,对象中的对象为品牌数据$scope.findBrandList=function(){$http.get(url).success(function(response){$scope.brandList={data:response};});}
后端:因为select2的config数据来源固定格式为[{id:2,text:联想},…]
所以后端需要查询id与name并返回修改属性名字后的json数据,所以
DAO:
xml:
select id,nameas text
from tb_brand
dao:
List
Service:
List
public List<Map> selectOptionList() {return brandMapper.selectOptionList();
}
Controller:
@RequestMapping("/selectOptionList")
public List