1、parameterType为String时,需要在mapper接口中定义@Param要传入的字符串名
xxMappper.xml
<!--获取动态指标明细数据接口-->
<select id="tableName" parameterType="String" resultMap="DynaResultMap">
SELECT
*
FROM
t_dynatable_fields
WHERE
DYNA_KEY = #{dynaKey,jdbcType=VARCHAR}
</select>
xxMapper
List<DynaTableField> tableName(@Param("dynaKey") String dynaKey);
2、parameterType为对象时,因为已经在对象中定义了属性,所以在mapper接口中就不要添加了@Param或者什么标注了
<insert id="insert" parameterType="com.jsptpd.gayg.modules.cloud.model.EnterpriseBase">
insert into t_enterprise_base_info (ENTERPRISE_ID, ENTERPRISE_NAME, ENTERPRISE_USCC,
GD_INFO, HG_CODE, ESTABLISH_DATE,
REGIST_CAPITAL, ENTERPRISE_ADDRESS, ENTERPRISE_SCOPE,
LEGAL_NAME, CONTACT_PHONE, IS_INVEST,
PARK_TYPE, WORKSHOP_POS, WORKSHOP_AREA,
INDUSTRY_CLASS, INDUSTRY_CATEGORY, TRIAL_TIME,
INVEST_TIME, PRODUCT_TIME, BUSI_INFO,
ENTERPRISE_TYPE, REMARK, STATUS,
OPERATOR, OPERATE_TIME)
values (#{enterpriseId,jdbcType=VARCHAR}, #{enterpriseName,jdbcType=VARCHAR}, #{enterpriseUscc,jdbcType=VARCHAR},
#{gdInfo,jdbcType=VARCHAR}, #{hgCode,jdbcType=VARCHAR}, #{establishDate,jdbcType=DATE},
#{registCapital,jdbcType=DECIMAL}, #{enterpriseAddress,jdbcType=VARCHAR}, #{enterpriseScope,jdbcType=VARCHAR},
#{legalName,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, #{isInvest,jdbcType=INTEGER},
#{parkType,jdbcType=INTEGER}, #{workshopPos,jdbcType=VARCHAR}, #{workshopArea,jdbcType=DECIMAL},
#{industryClass,jdbcType=INTEGER}, #{industryCategory,jdbcType=INTEGER}, #{trialTime,jdbcType=DATE},
#{investTime,jdbcType=DATE}, #{productTime,jdbcType=DATE}, #{busiInfo,jdbcType=INTEGER},
#{enterpriseType,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{operator,jdbcType=VARCHAR}, #{operateTime,jdbcType=TIMESTAMP})
</insert>
int insert(EnterpriseBase record);
网友评论