$('#dg').datagrid({
url:ctx+'supplier/material',
pagination:true,//分页
fit:true,
pageList:[5,6,8,10,12],
columns:[
[
{field:'id',title:'序号',width:130,align:'center',sortable:true},
{field:'materialNum',title:'产品编号',width:150,align:'center'},
{field:'materialName',title:'产品名称',align:'center',sortable:true},
{field:'materialType',title:'产品类别',width:150,align:'center'},
{field:'materialCount',title:'数量',width:150,align:'center',sortable:true},
{field:'materialUnit',title:'单位',width:140,align:'center'},
{field:'materialMoney',title:'价格',width:150,align:'center',sortable:true},
]
],
//工具栏
toolbar:'#tb',
});
<mapper namespace="com.turing.ppm.mapper.MaterialMapper" >
<resultMap id="BaseResultMap" type="com.turing.ppm.entity.Material" >
<id column="ID" property="id" jdbcType="INTEGER" />
<result column="MATERIAL_NUM" property="materialNum" jdbcType="VARCHAR" />
<result column="MATERIAL_NAME" property="materialName" jdbcType="VARCHAR" />
<result column="MATERIAL_UNIT" property="materialUnit" jdbcType="VARCHAR" />
<result column="MATERIAL_TYPE" property="materialType" jdbcType="VARCHAR" />
<result column="material_count" property="materialCount" jdbcType="INTEGER" />
<result column="material_money" property="materialMoney" jdbcType="DOUBLE" />
</resultMap>
<select id="selectBySupplierId" resultMap="BaseResultMap" parameterType="com.turing.ppm.entity.MaterialExample" >
select * from material where id in (select MATERIAL_ID from supp_material where SUPPLIER_ID=(select id from supplier where user_id=#{id}))
<if test="sort!=null and sort!=''">
order by ${sort} ${order}
</if>
limit #{pageNum},#{pageSize}
</select>