有些为空的插入不进来,可以用selective进行插入。
<insert id="insert" parameterType="com.yonghui.ccd.center.model.CostTplDO">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into yh_cost_tpl (contract_type, tpl_ranking, cost_code,
cost_name, region_identifier, institutional_format,
calculation_params, calculation_method, settle_interval,
calculation_level, default_value, indicators_identifier,
-------------------------------------------------------------
<insert id="insertSelective" parameterType="com.yonghui.ccd.center.model.CostTplDO">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into yh_cost_tpl
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="contractType != null">
contract_type,
</if>
<if test="tplRanking != null">
tpl_ranking,
</if>