insert into team_group_type(team_group_id,team_type) values(#{id},#{teamType})
insert into team_person(team_id,name,id_card,phone,sex,work_type,face_url,is_team_leader)
values
(#{id},#{name},#{idCard},#{phone},#{sex},#{workTypeId},#{faceUrl},#{isTeamLeader})
INSERT INTO team_person (team_id, name, id_card, phone, sex, work_type, is_team_leader)
VALUES
(#{item.teamId}, #{item.name}, #{item.idCard}, #{item.phone},
#{item.sex}, #{item.workType}, #{item.isTeamLeader})
update team_group_type set team_type = #{teamType} where team_group_id = #{id}
UPDATE pm_org_info
SET name = #{teamGroupName}
, parent_id = #{parentId}
, status = #{status}
WHERE id = #{id}
update team_person set name = #{name},id_card = #{idCard},phone = #{phone},sex = #{sex},work_type = #{workType},face_url = #{faceUrl}
where id = #{id}
update pm_org_info set audit_status = #{auditStatus} where id = #{id}
delete from pm_org_info where id = #{id}
delete from team_group_type where team_group_id = #{id}
delete from team_person where id = #{id}
delete from team_person where team_id = #{id}
SELECT
poi2.NAME subContractor,
poi3.NAME project,
poi3.user_id as userId,
poi.NAME teamGroupName,
poi.id as id,
poi.parent_id as parentId,
poi.p_parent_id as pParentId,
poi.status as status,
td.id as teamTypeId,
td.val teamType,
count( tp.team_id ) teamPersonNum
FROM
pm_org_info poi
LEFT JOIN pm_org_info poi2 ON poi.parent_id = poi2.id
LEFT JOIN pm_org_info poi3 ON poi2.parent_id = poi3.id
left join team_group_type tgt on poi.id = tgt.team_group_id
left join t_dict td on tgt.team_type = td.id
left join team_person tp on poi.id = tp.team_id
WHERE
poi.`level` = 5
and poi3.user_id = #{userId}
AND (
poi2.NAME like concat('%',#{keyWord},'%') or
poi3.NAME like concat('%',#{keyWord},'%') or
poi.NAME like concat('%',#{keyWord},'%')
)
and poi.status = #{status}
group by poi.id
order by poi.id desc
select count(1) from team_group_type where team_group_id = #{id}
SELECT tp.id,
tp.name,
tp.id_card as idCard,
tp.phone,
case when tp.sex = 1 then '男' else '女' end as sex,
tp.work_type workTypeId,
td.val as workType,
tp.face_url as faceUrl,
case when tp.is_team_leader = 0 then '是' else '否' end as isTeamLeader
FROM
team_person tp
left join t_dict td on tp.work_type = td.id
WHERE
tp.team_id = #{id}
and tp.name like concat('%',#{name},'%')
and tp.sex = #{sex}
select count(1) from team_person where id_card = #{idCard}
select count(1) from team_person where phone = #{phone}
select is_team_leader from team_person where id = #{id}
SELECT id_card FROM team_person WHERE id_card IN
#{idCard}
SELECT phone FROM team_person WHERE phone IN
#{phone}
SELECT id FROM pm_org_info WHERE name = #{name}
SELECT id FROM t_dict WHERE val = #{workType} and type = 'workType'
SELECT tp.id,
tp.name,
poi.name as teamGroupName,
poi2.name as subContractor,
poi3.name as project,
tp.id_card as idCard,
tp.phone,
case when tp.sex = 1 then '男' else '女' end as sex,
tp.work_type workTypeId,
td.val as workType,
tp.face_url as faceUrl,
case when tp.is_team_leader = 0 then '是' else '否' end as isTeamLeader
FROM
team_person tp
left join t_dict td on tp.work_type = td.id
left join pm_org_info poi on tp.team_id = poi.id
left join pm_org_info poi2 on poi2.id = poi.parent_id
left join pm_org_info poi3 on poi3.id = poi2.parent_id
WHERE 1=1
AND (
poi2.NAME like concat('%',#{keyWord},'%') or
poi3.NAME like concat('%',#{keyWord},'%') or
poi.NAME like concat('%',#{keyWord},'%')
)
and tp.name like concat('%',#{name},'%')
and tp.sex = #{sex}
and poi3.id = #{projectId}
and tp.work_type = #{workType}
SELECT name,
phone
FROM team_person WHERE team_id = #{id} and is_team_leader = 0
SELECT pa.enterpriseName FROM pm_org_info poi
left join project_assignment pa on poi.p_parent_id = pa.id
WHERE poi.p_parent_id = #{pParentId} limit 1
SELECT
poi.id,
poi.name teamGroupName,
poi.apply_man applyMan,
poi.create_time createTime,
poi.info_file_url infoFileUrl,
poi.audit_status auditStatus,
su.username applyMan,
CASE
WHEN poi.audit_status = 0 THEN '草稿'
WHEN poi.audit_status = 1 THEN '待事业部审核'
WHEN poi.audit_status = 2 THEN '待专责审核'
WHEN poi.audit_status = 3 THEN '待汇总审核'
WHEN poi.audit_status = 4 THEN '已通过'
WHEN poi.audit_status = 5 THEN '已驳回'
END AS auditStatusName
FROM
pm_org_info poi
left join sys_user su ON su.id = poi.apply_man
WHERE
poi.audit_status IS NOT NULL
AND poi.LEVEL = 5
and poi.name like concat('%',#{keyWord},'%')
and poi.audit_status = 0
and poi.audit_status = #{status}
AND DATE_FORMAT(poi.create_time, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
SELECT
tp.name AS name,
tp.phone AS phone,
tp.id_card AS idCard,
team_stats.personNum
FROM
pm_org_info poi
INNER JOIN team_person tp ON poi.id = tp.team_id
INNER JOIN (
SELECT
team_id,
COUNT(*) AS personNum
FROM
team_person
GROUP BY
team_id
) AS team_stats ON poi.id = team_stats.team_id
WHERE
tp.is_team_leader = 0
and poi.id = #{id}
SELECT DISTINCT
poi2.name
FROM
pm_org_info poi
left join pm_org_info poi2 on poi.parent_id = poi2.id
WHERE
poi.user_id = #{applyMan}