insert into tb_ls_user (
name,
id_card,
phone,
sex,
create_time,
team_id,
pro_id
)values (#{userName},#{idCard},#{phone},#{sex},now(),#{teamId},#{proId})
UPDATE tb_sh_box
SET box_num=#{boxNum}
where id=#{boxId}
UPDATE tb_bracelet
SET face_status=0,peopel_type=NULL,bid_id=NULL,bid_time=NULL,sh_status=0
WHERE id=#{devId}
select id boxId,box_name boxName
FROM tb_sh_box
WHERE team_id is not null and del_flag=0
and team_id=#{teamId}
select blt.sh_code shCode,blt.id devId,peopel_type userType, blt.bid_id userId,
tpp.lat sgLat ,tpp.lon sgLon,team.team_name teamName,
case
WHEN peopel_type=0 then tpe.name
WHEN peopel_type=1 then tlu.name
ELSE ''
END AS userName ,
case
WHEN peopel_type=0 then tpe.phone
WHEN peopel_type=1 then tlu.phone
ELSE ''
END AS phone ,
case
WHEN peopel_type=0 then tpe.id_card
WHEN peopel_type=1 then tlu.id_card
ELSE ''
END AS idCard
FROM tb_bracelet blt
left join tb_sh_box sbx on blt.box_id=sbx.id
left join t_work_team team on team.team_id=sbx.team_id
left join tb_project_power tpp on tpp.id=sbx.gt_id
left join tb_people tpe on blt.bid_id=tpe.id and peopel_type=0
left join tb_ls_user tlu on blt.bid_id=tlu.id and peopel_type=1
where blt.del_flag=0
and blt.box_id=#{boxId}
and team.team_name like concat('%',#{teamName},'%')
and blt.sh_code like concat('%',#{shCode},'%')
and (
tpe.name like concat('%',#{userName},'%') or
tlu.name like concat('%',#{userName},'%')
)
and team_id=#{teamId}
select blt.sh_code shCode,blt.id devId,peopel_type userType, blt.bid_id userId,
tpp.lat sgLat ,tpp.lon sgLon,
case
WHEN peopel_type=0 then tpe.name
WHEN peopel_type=1 then tlu.name
ELSE ''
END AS userName ,
case
WHEN peopel_type=0 then tpe.phone
WHEN peopel_type=1 then tlu.phone
ELSE ''
END AS phone ,
case
WHEN peopel_type=0 then tpe.id_card
WHEN peopel_type=1 then tlu.id_card
ELSE ''
END AS idCard
FROM tb_bracelet blt
left join tb_sh_box sbx on blt.box_id=sbx.id
left join tb_project_power tpp on tpp.id=sbx.gt_id
left join tb_people tpe on blt.bid_id=tpe.id and peopel_type=0
left join tb_ls_user tlu on blt.bid_id=tlu.id and peopel_type=1
where blt.del_flag=0 AND blt.bid_id is not null and blt.bid_id!=''
and blt.box_id=#{boxId}
and team_id=#{teamId}
and (
tpe.name like concat('%',#{userName},'%') or
tlu.name like concat('%',#{userName},'%')
)
select id ,data_name dataName,data_val dataVal,data_unit dataUnit,data_code dataCode,data_time dataTime
from tb_dev_details
where dev_id=#{devId}
select count(1)
from tb_people_certificate
where certificate_type=1 and
people_id=#{userId}
select box_num
from tb_sh_box
where id=#{boxId}
SELECT count(1)
FROM tb_bracelet blt
where blt.box_id=#{boxId} and blt.bid_id is not null and blt.bid_id!='' and blt.del_flag=0
SELECT count(1)
FROM tb_bracelet blt
where blt.box_id=#{boxId} and blt.del_flag=0
select box.id boxId,count(1) shNum,box.box_num boxNum
from tb_sh_box box
left join tb_bracelet bt on bt.box_id=box.id
where bt.id in(
#{devId}
)
GROUP BY box.id,box.box_num
select count(1)
from tb_ls_user
where id_card=#{idCard}
select count(1)
from tb_people
where id_card=#{idCard} and del_flag=0
select pro_id
from t_work_team
where team_id=#{teamId}