id, card_no, card_secret, card_name, card_type, total_fee, act_fee, disc_fee, begin_time,
end_time, card_state, org_id, sale_state, sale_date, sale_phone, sale_remark, is_used,
used_cust_id, used_phone, used_date, rlt_order_id, rlt_pay_order_id, batch_no, create_reason, remark,
data_state, create_empid, create_date, modfiy_empid, modfiy_date
insert into td_c_recharge_card (card_no, card_secret, card_name,
card_type, total_fee, act_fee,
disc_fee, begin_time, end_time,
card_state, org_id, sale_state,
sale_date, sale_phone, sale_remark,
is_used, used_cust_id, used_phone,
used_date, rlt_order_id, rlt_pay_order_id,
batch_no, create_reason, remark, data_state,
create_empid, create_date, modfiy_empid,
modfiy_date)
values
(#{item.cardNo,jdbcType=VARCHAR}, #{item.cardSecret,jdbcType=VARCHAR}, #{item.cardName,jdbcType=VARCHAR},
#{item.cardType,jdbcType=INTEGER}, #{item.totalFee,jdbcType=BIGINT}, #{item.actFee,jdbcType=BIGINT},
#{item.discFee,jdbcType=BIGINT}, #{item.beginTime,jdbcType=TIMESTAMP}, #{item.endTime,jdbcType=TIMESTAMP},
#{item.cardState,jdbcType=INTEGER}, #{item.orgId,jdbcType=BIGINT}, #{item.saleState,jdbcType=INTEGER},
#{item.saleDate,jdbcType=TIMESTAMP}, #{item.salePhone,jdbcType=VARCHAR}, #{item.saleRemark,jdbcType=VARCHAR},
#{item.isUsed,jdbcType=INTEGER}, #{item.usedCustId,jdbcType=VARCHAR}, #{item.usedPhone,jdbcType=VARCHAR},
#{item.usedDate,jdbcType=TIMESTAMP}, #{item.rltOrderId,jdbcType=VARCHAR}, #{item.rltPayOrderId,jdbcType=VARCHAR},
#{item.batchNo,jdbcType=VARCHAR}, #{item.createReason,jdbcType=VARCHAR}, #{item.remark,jdbcType=VARCHAR}, #{item.dataState,jdbcType=INTEGER},
#{item.createEmpid,jdbcType=VARCHAR}, #{item.createDate,jdbcType=TIMESTAMP}, #{item.modfiyEmpid,jdbcType=VARCHAR},
#{item.modfiyDate,jdbcType=TIMESTAMP})
org_id=#{orgId} and data_state = 1
and begin_time >= #{beginSaleDate}
and begin_time <= #{endSaleDate}
and used_date >= #{beginUsedDate}
and used_date <= #{endUsedDate}
and card_no = #{cardNo}
and id like concat('%',#{id},'%')
and batch_no = #{batchNo}
and card_type = #{cardType,jdbcType=INTEGER}
and card_type in
#{card_type}
and sale_state = #{saleState,jdbcType=INTEGER}
and is_used = #{isUsed,jdbcType=INTEGER}
and sale_state = 1 and end_time >= #{nowDate} and is_used != 1
and sale_state = 0 and end_time >= #{nowDate}
and ( end_time < #{nowDate} or is_used = 1)