语法规则:
${@path$subClass@Attr.getValueMethod}
例子:
<select id="listModelsToProTps" resultType="com.voyageone.ecerp.model.wms.WmsBtShipmentModel"> SELECT * from wms_bt_shipment${partition} WHERE port =${@com.voyageone.ecerp.domain.constant.wms.WmsConstant$Port@RST.value} AND tps_flg in ( ${@com.voyageone.ecerp.domain.enums.wms.WmsEnums$TpsFlg@NOT_HANDLE.value}, ${@com.voyageone.ecerp.domain.enums.wms.WmsEnums$TpsFlg@CREATED.value} ) AND status != ${@com.voyageone.ecerp.domain.enums.wms.WmsEnums$ShipmentStatus@OPEN.value}; </select>
其中静态常量如下(对应的mapper xml代码:${@com.voyageone.ecerp.domain.constant.wms.WmsConstant$Port@RST.value}
):
/** * 港口 * */ public final static class Port extends AbstractTypedConstant<Integer> { public static final Port RST = new Port(28); private Port() { } public Port(Integer value) { this.value = value; } }
枚举如下(对应的mapper xml代码:${@com.voyageone.ecerp.domain.enums.wms.WmsEnums$TpsFlg@CREATED.value}
):
public enum TpsFlg { NOT_HANDLE("0"), CREATED("1"), SHIPPED("2"); private String value; TpsFlg(String val) { this.value = val; } //这里定义了mybatis调用的方法成员,对应ms$TpsFlg@CREATED.value中的value,这应该和序列化有关 public String value() { return value; } }
参考博客:https://blog.csdn.net/u010714901/article/details/79541861