<?xml version="1.0" encoding="utf-8" ?>
<select>
	<selectstr>
		SELECT
			u_mattress_mx_extra.mattressid,
			u_mattress_mx_extra.mattressmxid,
			u_mattress_mx_extra.extraid,
			u_mattress_mx_extra.extramxid,
			u_mattress_mx_extra.extraname,
			u_mattress_mx_extra.price,
			u_mattress_mx_extra.qty,
			ISNULL(u_mattress_extra_type.inputtype, 0) as extrainputtype,
			ISNULL(u_mattress_extra.inputtype, 0) as inputtype,
			'+' as addmx,
			'-' as delmx,
			u_mattress_mx_extra.dscrp
		From u_mattress_mx_extra
		Left OUTER JOIN u_mattress_extra_type On u_mattress_extra_type.extraid = u_mattress_mx_extra.extraid
		Left OUTER JOIN u_mattress_extra On u_mattress_extra.extramxid = u_mattress_mx_extra.extramxid
	</selectstr>
	<where>
		<when notnull="@arg_mattressid">
			u_mattress_mx_extra.mattressid = @arg_mattressid
		</when>
		<when notnull="@arg_typeid">
			u_mattress_extra_type.typeid = @arg_typeid
		</when>
		<when notnull="@arg_ifinit">
			u_mattress_extra.ifinit = @arg_ifinit
		</when>
	</where>
	<displayfields>
		<field field="pid" compute="getrow()">序</field>
		<field field="addmx">+</field>
		<field field="delmx">-</field>
		<field field="extraid" mapper="u_mattress_extra.mattressextra">项目类型</field>
		<field field="extraname">项目名称</field>
		<field field="price" datatype="number">金额</field>
		<field field="qty" datatype="number">数量</field>
		<field field="dscrp">备注</field>
		<field field="inputtype" mapper="u_mattress_extra.inputtype">输入类型</field>
	</displayfields>
</select>
