a.id AS "id", a.member_code AS "memberCode", a.project AS "project", a.combo AS "combo", a.operator AS "operator", a.pay_amount AS "payAmount", a.start_date AS "startDate", a.end_date AS "endDate", a.create_by AS "createBy.id", a.create_date AS "createDate", a.update_by AS "updateBy.id", a.update_date AS "updateDate", a.remarks AS "remarks", a.del_flag AS "delFlag", b.name AS "member.name", b.first_payment_time AS "member.firstPaymentTime", b.gender AS "member.gender", b.birthday AS "member.birthday", b.card_no AS "member.cardNo", b.mobile AS "member.mobile", b.province AS "member.province", b.city AS "member.city", b.street AS "member.street", b.address AS "member.address", b.member_type AS "member.memberType" LEFT JOIN sys_member b ON a.member_code = b.member_code a.del_flag = #{DEL_FLAG_NORMAL} AND (a.member_code = #{memberCode} OR b.name LIKE concat(#{memberCode},'%')) AND a.combo = #{combo} AND a.start_date < now() AND a.end_date > now() AND (a.start_date > now() OR a.end_date < now() OR a.end_date is null) INSERT INTO kennel_alliance( id, member_code, project, combo, operator, pay_amount, start_date, end_date, create_by, create_date, update_by, update_date, remarks, del_flag ) VALUES ( #{id}, #{memberCode}, #{project}, #{combo}, #{operator}, #{payAmount}, #{startDate}, #{endDate}, #{createBy.id}, #{createDate}, #{updateBy.id}, #{updateDate}, #{remarks}, #{delFlag} ) UPDATE kennel_alliance SET member_code = #{memberCode}, project = #{project}, combo = #{combo}, operator = #{operator}, pay_amount = #{payAmount}, start_date = #{startDate}, end_date = #{endDate}, update_by = #{updateBy.id}, update_date = #{updateDate}, remarks = #{remarks} WHERE id = #{id} UPDATE kennel_alliance SET remarks = concat(IFNULL(remarks,''),#{remarks}), del_flag = #{DEL_FLAG_DELETE} WHERE id = #{id}