select a.group_id, a.group_code, a.group_name, b.person_number,a.group_describe, a.status, a.create_by, a.create_time from sys_group a left join inner join ( select group_code,count(group_code) as person_number from sys_group_person group by group_code ) b on b.group_code = a.group_code insert into sys_group group_code, group_name, group_describe, status, create_by, create_time, #{groupCode}, #{groupName}, #{groupDescribe}, 0, #{createBy}, now(), update sys_group group_code = #{groupCode}, group_name = #{groupName}, group_describe = #{groupDescribe}, status = #{status}, create_by = #{createBy}, create_time = #{createTime}, where group_id = #{groupId} delete from sys_group where group_id = #{groupId} delete from sys_group where group_id in #{groupId}