SELECT
id,
name,
create_time,
update_time,
handle_state,
response,
accessory_url,
accessory_name,
video_url,
video_name,
picture_url,
picture_name,
department_id,
create_user_id,
accessory_id,
(select organization_name from automessage_organization_chart where automessage_organization_chart.id=automessage_reply_template.department_id) as departmentName,
(select user_name from automessage_sys_user where automessage_sys_user.user_id=automessage_reply_template.create_user_id) as createUser,
guidance
FROM
automessage_reply_template
insert into automessage_reply_template (
id,
name,
handle_state,
response,
guidance,
accessory_url,
accessory_name,
video_url,
video_name,
picture_url,
picture_name,
create_user_id,
department_id,
accessory_id,
update_time,
create_time
)values(
#{id},
#{name},
#{handleState},
#{response},
#{guidance},
#{accessoryUrl},
#{accessoryName},
#{videoUrl},
#{videoName},
#{pictureUrl},
#{pictureName},
#{createUserId},
#{departmentId},
#{accessoryId},
sysdate(),
sysdate()
)
update automessage_reply_template
id=#{id},
name=#{name},
handle_state=#{handleState},
response=#{response},
guidance=#{guidance},
accessory_url=#{accessoryUrl},
accessory_name=#{accessoryName},
video_url=#{videoUrl},
video_name=#{videoName},
picture_url=#{pictureUrl},
picture_name=#{pictureName},
create_user_id=#{createUserId},
department_id=#{departmentId},
accessory_id=#{accessoryId},
update_time=sysdate()
where id= #{id}
delete from automessage_reply_template where id= #{Id}