select
distinct
bu.*,IF(mod(SUBSTR(bu.cardid,17,1),2),1,2) sexs,
ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
sll.longitude,sll.latitude,
bud.unit_name,
bud.permanent_residence_address as registered,
bd.dept_name
from
blade_user bu
left join blade_user_detail bud on bud.user_id = bu.id
left join blade_dept bd on bu.dept_id = bd.id
left join sys_information si on si.departmentid = bd.id
left join sys_jurisdiction sj on sj.id = si.jurisdiction
left join sys_live_location sll on sll.worker_id = bu.id
left join blade_role br on br.id = bu.role_id
left join sys_training_registration str on bu.id = str.user_id
where bu.is_deleted = 0
and (bu.examination_type = #{user.examinationType} or bu.examination_type is null or bu.examination_type ='')
and bu.examination_type = #{user.examinationType}
and bu.account like concat('%', #{user.account},'%')
and bu.hold = #{user.hold}
and bd.id in
(
select id from blade_dept where id = #{user.deptId}
union
SELECT
id
FROM
(
SELECT
t1.id,t1.parent_id,t1.dept_name,
IF
( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
FROM
( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
( SELECT @pids := #{user.deptId} ) t2
) t3
WHERE
ischild != 0
)
and bu.role_id = #{user.roleId}
and bu.audit_status = #{user.auditStatus}
and br.role_alias = '保安'
and bu.status = #{user.status}
and bu.is_freeze = #{user.isFreeze}
and bu.education = #{user.education}
and str.training_unit_id = #{user.trainingUnitId}
and bd.dept_name like concat('%', #{user.deptName},'%')
and (sj.id = #{user.jurisdiction} or sj.parent_id = #{user.jurisdiction})
and bu.real_name like concat('%', #{user.realName},'%')
and bu.dispatch = #{user.dispatch}
and bu.dispatch = #{user.dispatch}
and bu.avatar is not null and bu.avatar!=""
and (bu.avatar is null or bu.avatar="")
and age >=18 and age <=30
and age >30 and age <=45
and age >45 and age <=60
and bu.fingerprint is not null and bu.fingerprint!=""
and (bu.fingerprint is null or bu.fingerprint="")
and bu.user_type = #{user.userType}
and bu.securitynumber like concat('%', #{user.securitynumber},'%')
and bu.cardid like concat('%', #{user.cardid},'%')
and bud.unit_name like concat('%', #{user.unitName},'%')
ORDER BY bu.${user.sortName} ${user.sort},bu.id desc
ORDER BY bu.id desc
select * from
(
select
distinct
bu.*,IF(mod(SUBSTR(bu.cardid,17,1),2),1,2) sexs,
ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
sll.longitude,sll.latitude,
bud.unit_name,
bd.dept_name
from
blade_user bu
left join blade_user_detail bud on bud.user_id = bu.id
left join blade_dept bd on bu.dept_id = bd.id
left join sys_information si on si.departmentid = bd.id
left join sys_jurisdiction sj on sj.id = si.jurisdiction
left join sys_live_location sll on sll.worker_id = bu.id
left join blade_role br on br.id = bu.role_id
left join sys_training_registration str on bu.id = str.user_id
where bu.is_deleted = 0
and (bu.examination_type = #{user.examinationType} or bu.examination_type is null or bu.examination_type ='')
and bu.examination_type = #{user.examinationType}
and bu.account like concat('%', #{user.account},'%')
and bu.is_freeze = #{user.isFreeze}
and bu.hold = #{user.hold}
and bd.id in
(
select id from blade_dept where id = #{user.deptId}
union
SELECT
id
FROM
(
SELECT
t1.id,t1.parent_id,t1.dept_name,
IF
( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
FROM
( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
( SELECT @pids := #{user.deptId} ) t2
) t3
WHERE
ischild != 0
)
and bu.role_id = #{user.roleId}
and br.role_alias = '保安'
and bu.status = #{user.status}
and bu.education = #{user.education}
and str.training_unit_id = #{user.trainingUnitId}
and bd.dept_name like concat('%', #{user.deptName},'%')
and (sj.id = #{user.jurisdiction} or sj.parent_id = #{user.jurisdiction})
and bu.real_name like concat('%', #{user.realName},'%')
and bud.unit_name like concat('%', #{user.unitName},'%')
and bu.dispatch = #{user.dispatch}
and bu.dispatch = #{user.dispatch}
and bu.avatar is not null and bu.avatar!=""
and (bu.avatar is null or bu.avatar="")
and bu.fingerprint is not null and bu.fingerprint!=""
and (bu.fingerprint is null or bu.fingerprint="")
and bu.user_type = #{user.userType}
and bu.audit_status = #{user.auditStatus}
and bu.securitynumber like concat('%', #{user.securitynumber},'%')
and bu.cardid like concat('%', #{user.cardid},'%')
ORDER BY bu.${user.sortName} ${user.sort},bu.id desc
ORDER BY bu.id desc
) user
where 1=1
and age >=18 and age <=30
and age >30 and age <=45
and age >45 and age <=60
select bu.* from blade_user bu
left join blade_dept bd on bd.id = bu.dept_id
left join sys_jurisdiction sj on sj.id = bu.jurisdiction
left join blade_role br on br.id = bu.role_id
where bu.is_deleted = 0 and bu.id != 1123598821738675201
and tenant_id = #{user.tenantId}
and account like concat('%', #{user.account},'%')
and bu.is_freeze = #{user.isFreeze}
and (br.role_alias = '公安管理员' or br.role_alias = '民警')
and real_name like concat(concat('%', #{user.realName}),'%')
and bd.id in
(
select id from blade_dept where id = #{user.deptId}
union
SELECT
id
FROM
(
SELECT
t1.id,t1.parent_id,t1.dept_name,
IF
( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
FROM
( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
( SELECT @pids := #{user.deptId} ) t2
) t3
WHERE
ischild != 0
)
and user_type = #{user.userType}
and nativeplace = #{user.nativeplace}
and sex = #{user.sex}
and status = #{user.status}
and hold = #{user.hold}
and (sj.id = #{user.jurisdiction} or sj.parent_id = #{user.jurisdiction})
and securitynumber = #{user.securitynumber}
and examination_type = #{user.examinationType}
ORDER BY bu.id desc
SELECT *
FROM blade_user
WHERE tenant_id = #{param1}
and account = #{param2}
and password = #{param3}
and is_deleted = 0
and status = 1
SELECT
bu.id,
bd.dept_name AS deptId,
bu.real_name,
bu.phone,
bu.sex,
bu.cardid
FROM
blade_user bu
LEFT JOIN blade_dept bd ON bu.dept_id = bd.id
where bu.is_deleted = 0
AND bu.account LIKE CONCAT('%',#{obj.account},'%')
AND bu.real_name LIKE CONCAT('%',#{obj.realName},'%')
AND bu.dept_id = #{obj.deptId}
SELECT id, name, real_name RealName,securitynumber,dept_id
FROM blade_user
where 1=1
and is_deleted = 0
and status = 1
and cardid = #{param1}
select
bu.*,IF(mod(SUBSTR(bu.cardid,17,1),2),1,2) sexs
from
blade_user bu
left join blade_user_detail bud on bud.user_id = bu.id
left join blade_dept bd on bu.dept_id = bd.id
left join blade_role br on br.id = bu.role_id
where bu.is_deleted = 0
and role_alias = '保安'
and bu.real_name like concat(concat('%', #{user.realName}),'%')
and bu.user_type = #{user.userType}
and bu.nativeplace = #{user.nativeplace}
and bu.dept_id = #{user.deptId}
and bu.sex = #{user.sex}
and bu.is_freeze = #{user.isFreeze}
and (bu.dispatch = #{user.dispatch} or bu.dispatch is null)
and bu.dispatch = #{user.dispatch}
and bu.status = #{user.status}
and bu.equipment_code !="" and bu.equipment_code is not null and bu.equipment_code !=null
and bu.jurisdiction = #{user.jurisdiction}
and bud.unit_name like concat('%', #{user.unitName},'%')
and bu.securitynumber = #{user.securitynumber}
ORDER BY bu.id
select
bu.*,
bd.dept_name
from
blade_user bu
left join blade_user_detail bud on bud.user_id = bu.id
left join blade_dept bd on bu.dept_id = bd.id
left join blade_role br on br.id = bu.role_id
where bu.is_deleted = 0
and (hold = 2 or hold = 3)
and br.role_alias = "保安"
and bu.dept_id = #{user.deptId}
and bu.is_apply = #{user.isApply}
and bu.role_id = #{user.roleId}
and bu.is_freeze = #{user.isFreeze}
and bu.status = #{user.status}
and bu.real_name like concat('%', #{user.realName},'%')
and bud.unit_name like concat('%', #{user.unitName},'%')
and bu.user_type = #{user.userType}
and bu.securitynumber = #{user.securitynumber}
ORDER BY bu.id
select
a.id,
a.name,
a.type,
a.parentId
from (
select
distinct
bu.id,
ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
bu.is_apply isApply,
bu.is_train isTrain,
bu.real_name as name,
if(es.user_id is not null,1,2) as type,
#{user.deptId} parentId
from blade_user bu
left join blade_dept bd on bu.dept_id = bd.id
left join blade_role br on br.id = bu.role_id
left join (select user_id,max(id) from exam_score where (qualified =1 or qualified =3) GROUP BY user_id) es
on es.user_id = bu.id
where
bu.is_deleted = 0 and bu.status = 1 and bu.is_freeze = 0
and (bu.examination_type != 1 or bu.examination_type is null)
and (hold = 2 or hold = 3)
and bd.id = #{user.deptId}
and br.role_alias = '保安'
) a
where 1 = 1
and a.isApply != 1
and a.isTrain != 1
SELECT real_name as realName,id FROM blade_user
WHERE role_id='1412226235153731586' and status=1
and dept_id=#{deptid}
select ifnull(max(0+RIGHT(securitynumber,5)),0) from blade_user
where securitynumber like concat('%', #{pre},'%')
select DISTINCT
bu.id,is_apply isApply
from
blade_user bu
left join
sys_apply sa
on
sa.user_id = bu.id
where 1=1
and (hold=2 or hold = 3)
and (bu.is_apply != 1 or bu.is_apply is null)
and (sa.apply_status !=2 or sa.apply_status is null)
and bu.dept_id = #{deptId}
select id,real_name realName,ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(cardid, 7, 8), CURDATE()),0) AS age,securitynumber,cardid
from
blade_user
where
id = #{userId}
select
bu.*,
ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(cardid, 7, 8), CURDATE()),0) AS age,
bd.dept_name deptName
from
blade_user bu
left join
blade_dept bd
on
bu.dept_id = bd.id
where
1=1
and securitynumber = #{securityNumber}
and cardid = #{cardid}
and bu.status = 1
and bu.is_deleted = 0
and bu.is_freeze = 0
select CAST(id AS CHAR) as groupmember,real_name as rname from blade_user
select
bu.*,
bd.dept_name deptName
from
blade_user bu
left join
blade_dept bd
on
bu.dept_id = bd.id
where bu.id = #{user.id}
select bu.*,sdu.jurisdiction from blade_user bu
left join
sys_dispatcher sd
on
bu.id = sd.user_ids
left join
sys_dispatcher_unit sdu
on
sdu.id = sd.dispatcher_unit_id
where
bu.dispatch =0
and bu.status = 1
and bu.is_deleted = 0
and bu.dept_id = #{deptid}
and sdu.jurisdiction = #{jurisdiction}
select bu.*,si.jurisdiction from blade_user bu
left join
blade_dept bd
on
bd.id = bu.dept_id
left join
sys_information si
on
bd.id = si.departmentid
left join
blade_role br
on
br.id = bu.role_id
where
1=1
and bu.status = 1
and bu.is_deleted = 0
and bu.dept_id = #{deptid}
and si.jurisdiction = #{jurisdiction}
and br.role_alias = "公安管理员"
select bu.* from blade_user bu
left join
blade_dept bd
on
bd.id = bu.dept_id
left join
blade_role br
on
br.id = bu.role_id
where
1=1
and bu.status = 1
and bu.is_deleted = 0
and bu.dept_id = #{deptid}
and bu.jurisdiction = #{jurisdiction}
and br.role_alias = "公安管理员"
select
sd.id,sdu.jurisdiction
from
sys_dispatcher sd
left join
sys_dispatcher_unit sdu
on
sdu.id = sd.dispatcher_unit_id
where sd.user_ids = #{userId}
and sd.status = 0
select count(*) from blade_user where 1=1
and status = 1
and is_deleted = 0
and account = #{account}
(select dept_name from blade_dept where id = #{deptId} and 1=1)
union
(
select dept_name from blade_dept where id = (select parent_id from blade_dept where id= #{deptId} and 1=1)
)
select id,account from blade_user
where account = #{account}
and is_deleted = 0
and status = 1
select bu.*,si.jurisdiction from blade_user bu
left join
blade_dept bd
on
bd.id = bu.dept_id
left join
sys_information si
on
bd.id = si.departmentid
left join
sys_jurisdiction sj
on
sj.id = si.jurisdiction
left join
blade_role br
on
br.id = bu.role_id
where
1=1
and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
and bu.status = 1
and bu.is_deleted = 0
and br.role_alias = "保安"
(
select #{user.deptId} as id,
'全选' as name,
0 as parentId
from blade_user
)
union all
(
select
distinct
bu.id,
bu.real_name as name,
#{user.deptId} parentId
from
blade_user bu
left join
blade_dept bd
on
bu.dept_id = bd.id
left join
blade_role br
on
br.id = bu.role_id
where
bu.is_deleted = 0
and bu.status = 1
and bd.is_deleted = 0
and bd.id = #{user.deptId}
and br.role_alias = '保安'
and bu.dispatch = 1
)
select
distinct bu.id,
bd.dept_name deptId,
bu.real_name realName,if(IF(mod(SUBSTR(bu.cardid,17,1),2),1,2)=1,"男","女") sex,
bu.phone,bu.cardid,bu.nation,bu.education,bu.politicaloutlook,
bud.unit_name unitName,bud.marriage_status marriageStatus,bud.sign_level signLevel,
bud.permanent_residence_address permanentResidenceAddress,bud.dwell_address dwellAddress,
bud.member_of_family memberOfFamily,bud.work_experience workExperience,
bud.education_experience educationExperience,bud.acceptance_police_unit acceptancePoliceUnit,
bud.acceptance_person acceptancePerson,bud.acceptance_time acceptanceTime
from blade_user bu
left join blade_user_detail bud on bud.user_id = bu.id and bud.is_deleted = 0
left join blade_dept bd on bu.dept_id = bd.id and bd.is_deleted = 0
left join sys_information si on si.departmentid = bd.id
left join sys_jurisdiction sj on sj.id = si.jurisdiction
left join blade_role br on br.id = bu.role_id
left join sys_training_registration str on bu.id = str.user_id
where bu.is_deleted = 0
and (bu.examination_type = #{user.examinationType} or bu.examination_type is null or bu.examination_type ='')
and bu.examination_type = #{user.examinationType}
and bu.avatar is not null and bu.avatar!=""
and (bu.avatar is null or bu.avatar="")
and bu.is_freeze = #{user.isFreeze}
and bud.unit_name like concat('%', #{user.unitName},'%')
and bu.fingerprint is not null and bu.fingerprint!=""
and (bu.fingerprint is null or bu.fingerprint="")
and bu.account like concat('%', #{user.account},'%')
and bu.hold = #{user.hold}
and bd.id in
(
select id from blade_dept where id = #{user.deptId}
union
SELECT
id
FROM
(
SELECT
t1.id,t1.parent_id,t1.dept_name,
IF
( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
FROM
( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
( SELECT @pids := #{user.deptId} ) t2
) t3
WHERE
ischild != 0
)
and bu.role_id = #{user.roleId}
and br.role_alias = '保安'
and bu.status = #{user.status}
and str.training_unit_id = #{user.trainingUnitId}
and bd.dept_name like concat('%', #{user.deptName},'%')
and (sj.id = #{user.jurisdiction} or sj.parent_id = #{user.jurisdiction})
and bu.real_name like concat('%', #{user.realName},'%')
and bu.dispatch = #{user.dispatch}
and bu.dispatch = #{user.dispatch}
and bu.user_type = #{user.userType}
and bu.securitynumber like concat('%', #{user.securitynumber},'%')
and bu.cardid like concat('%', #{user.cardid},'%')
ORDER BY bu.${user.sortName} ${user.sort},bu.id desc
ORDER BY bu.id desc
SELECT id,
equipment_code as code
FROM blade_user
WHERE dept_id = '1460129345988239362'
AND role_id = '1412226235153731586'
AND is_deleted = 0
AND `status` = 1
AND equipment_code IS NOT NULL
AND equipment_code!=""
select
sdu.name dispatcherCompany,
dispatcherTime dispatchertime,
sd.end_time endTime
from blade_user bu
left join
sys_dispatcher sd
on
sd.user_ids = bu.id
left join
sys_dispatcher_unit sdu
on
sdu.id = sd.dispatcher_unit_id
where 1=1
and sd.status = 0
and bu.dispatch = 0
and bu.id = #{id}
insert into blade_user
(id,
tenant_id,account,password,name,real_name,avatar,email,phone,sex,
role_id,dept_id,cardid,nativePlace,nation,fingerprint,education,
politicaloutlook,healstats,height,securitynumber,
hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time
)
values
(
#{user.id},
#{user.tenantId},#{user.account},#{user.password},#{user.name},#{user.realName},#{user.avatar},#{user.email},#{user.phone},#{user.sex},
#{user.roleId},#{user.deptId},#{user.cardid},#{user.nativeplace},#{user.nation},#{user.fingerprint},#{user.education},
#{user.politicaloutlook},#{user.healstats},#{user.height},#{user.securitynumber},
#{user.hold},#{user.jurisdiction},#{user.examinationType},#{user.status},#{user.isDeleted},#{user.dispatch},#{user.createTime}
)
insert into sys_experience
(
name,post,entryTime,cardId,companyname,securityId
)
values
(
#{item.name},#{item.post},#{item.entrytime},#{item.cardid},#{item.companyname},#{item.securityid}
)
select count(*) c from (
select ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age from blade_user bu
left join blade_dept bd on bu.dept_id = bd.id
left join sys_information si on si.departmentid = bd.id
left join sys_jurisdiction sj on sj.id = si.jurisdiction
where bu.status = 1
and bu.is_deleted = 0
and bu.role_id = 1412226235153731586
and (sj.id = #{user.jurisdiction} or sj.parent_id = #{user.jurisdiction})
and bu.dept_id = #{user.deptId}
)a where age>=18 and age <=30
union
(
select count(*) c from
(
select ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age from blade_user bu
left join blade_dept bd on bu.dept_id = bd.id
left join sys_information si on si.departmentid = bd.id
left join sys_jurisdiction sj on sj.id = si.jurisdiction
where bu.status = 1
and bu.is_deleted = 0
and bu.role_id = 1412226235153731586
and (sj.id = #{user.jurisdiction} or sj.parent_id = #{user.jurisdiction})
and bu.dept_id = #{user.deptId}
)a where age>30 and age <=45
)
union
(
select count(*) c from
(
select ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age from blade_user bu
left join blade_dept bd on bu.dept_id = bd.id
left join sys_information si on si.departmentid = bd.id
left join sys_jurisdiction sj on sj.id = si.jurisdiction
where bu.status = 1
and bu.is_deleted = 0
and bu.role_id = 1412226235153731586
and (sj.id = #{user.jurisdiction} or sj.parent_id = #{user.jurisdiction})
and bu.dept_id = #{user.deptId}
)a where age>45 and age <=60
)
select * from blade_user where id = #{id}
select * from blade_user where is_deleted = 0 and status = 1
and tenant_id = #{tenantId} and phone = #{phone} limit 1
select bu.id from blade_user bu
left join (
select user_id,max(create_time) as create_time from sys_login_record GROUP BY user_id
)slr on bu.id = slr.user_id
where bu.status = 1 and bu.is_deleted = 0 and bu.role_id = 1412226235153731586
and DATE_SUB(CURDATE(), INTERVAL #{day} DAY) > date(bu.create_time)
and DATE_SUB(CURDATE(), INTERVAL #{day} DAY) > date(slr.create_time)
update blade_user set is_freeze = 1
where id in
#{id}
where id in ('')
update blade_user set is_deleted = 1
where id in
#{id}
where id in ('')
UPDATE BLADE_USER SET audit_status = #{auditStatus}
WHERE is_deleted = 0 and id in
#{item}
select bu.* from blade_user bu
left join blade_role br on br.id = bu.role_id
where bu.is_deleted = 0 and bu.status = 1 and bu.id = #{id}
and br.role_alias = '保安'
select bu.* from blade_user bu
where bu.is_deleted = 0
and bu.id = #{id}
select bu.* from blade_user bu
left join blade_user_detail bud on bu.id = bud.user_id and bud.is_deleted = 0
where bu.is_deleted = 0
and bu.role_id = '1412226235153731586'
and bud.id is null
SELECT * FROM BLADE_USER bu
LEFT JOIN BLADE_USER_DETAIL BUD on bud.user_id = bu.id and bud.is_deleted = 0
WHERE bu.is_deleted = 0 and bu.id = #{id}
SELECT id, name, real_name RealName,securitynumber,dept_id
FROM blade_user
where 1=1
and is_deleted = 0
and status = 1
and cardid = #{cardid}
and securitynumber = #{securityNumber}