select id, wx_id, fan_time, fan_num, create_time, create_by, update_time, update_by, del_flag from sys_wx_fan_statistics select swfs.id, swfs.wx_id, swfs.fan_time, swfs.fan_num, swfs.create_time, swfs.create_by, swfs.update_time, swfs.update_by, swfs.del_flag, su.nick_name as user_name,acc.dict_label as account,asg.dict_label as sale_group,swsa.wx_nick_name,swsa.wx_account,swd.sale_group_id from sys_wx_fan_statistics swfs left join sys_wx_sale_account swsa on swsa.id = swfs.wx_id and swsa.del_flag = 0 left join sys_wx_distribution swd on swd.wechat_account = swfs.wx_id and swd.del_flag = 0 left join sys_user su on su.user_id = swd.user_id and su.del_flag = 0 LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS acc ON acc.dict_value = swd.account_id LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'sale_group') AS asg ON asg.dict_value = swd.sale_group_id insert into sys_wx_fan_statistics wx_id, fan_time, fan_num, create_time, create_by, update_time, update_by, del_flag, #{wxId}, #{fanTime}, #{fanNum}, #{createTime}, #{createBy}, #{updateTime}, #{updateBy}, #{delFlag}, update sys_wx_fan_statistics wx_id = #{wxId}, fan_time = #{fanTime}, fan_num = #{fanNum}, create_time = #{createTime}, create_by = #{createBy}, update_time = #{updateTime}, update_by = #{updateBy}, del_flag = #{delFlag}, where id = #{id} update sys_wx_fan_statistics set del_flag = 1 where id = #{id} update sys_wx_fan_statistics set del_flag = 1 where id in #{id}