select id,deviceName,deviceNumber,deviceType,ownership,ownerId,devicestate,stime,ST_ASTEXT (coordinate ) AS
coordinate,dtype,
parent_id,
FORMAT( jd, 6 ) AS jd,
FORMAT( wd, 6 ) AS wd,
street,
addvcd,pay,expireTime from sys_equipment where 1=1
and (deviceName like concat('%',#{deviceName},'%') or deviceNumber like
concat('%',#{deviceName},'%'))
and addvcd=#{addvcd}
and devicestate =#{devicestate}
and dtype=#{dtype}
and parent_id!=0
INSERT INTO sys_equipment (deviceName,deviceNumber,deviceType,ownership,ownerId,devicestate,stime,coordinate,parent_id,jd,wd,addvcd,street,dtype) VALUES (#{deviceName},#{deviceNumber},#{deviceType},#{ownership},#{yname},#{devicestate},#{stime},POINT(#{jd},#{wd}),#{parentId},#{jd},#{wd},#{addvcd},#{streeName},#{dtype})
select id, parent_id, deviceName as title, id as "value", id as "key" from sys_equipment
SELECT dept.id,dept.deviceName,dept.deviceNumber,dept.deviceType,dept.ownership,
dept.ownerId,dept.devicestate,dept.stime,
ST_ASTEXT(dept.coordinate) as coordinate,dept.dtype,
dept.parent_id,FORMAT(dept.jd,6) as jd,FORMAT(dept.wd,6) as wd,dept.street as
streeName,u.yname,d.addvnm,dept.addvcd,
(
SELECT
CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
FROM
sys_equipment
WHERE
parent_id = dept.id
) AS "has_children"
FROM
sys_equipment dept left JOIN sys_suser u on u.ynumber=dept.ownerId LEFT JOIN sys_district d on
d.addvcds=dept.addvcd LEFT JOIN sys_street s on s.id=dept.street
WHERE 1=1
and dept.parent_id =#{parentId}
and dept.deviceName like concat(concat('%', #{param2.deviceName}),'%')
and dept.deviceType like concat(concat('%', #{param2.deviceType}),'%')
and dept.deviceNumber like concat(concat('%', #{param2.deviceNumber}),'%')
and dept.devicestate like concat(concat('%', #{param2.devicestate}),'%')
and dept.dtype like concat(concat('%', #{param2.dtype}),'%')
update sys_equipment SET deviceName=#{deviceName},deviceNumber=#{deviceNumber},deviceType=#{deviceType},
ownership=#{ownership},ownerId=#{yname},devicestate=#{devicestate},stime=#{stime},
coordinate=POINT(#{jd},#{wd}),parent_id=#{parentId},jd=#{jd},wd=#{wd},addvcd=#{addvnm},street=#{streeName},dtype=#{dtype} where id=#{id}
update sys_equipment SET deviceName=#{deviceName},deviceNumber=#{deviceNumber},deviceType=#{deviceType},
ownership=#{ownership},ownerId=#{yname},devicestate=#{devicestate},stime=#{stime},
coordinate=POINT(#{jd},#{wd}),parent_id=#{parentId},jd=#{jd},wd=#{wd},addvcd=#{addvnm},street=#{streeName},dtype=#{dtype} where id=#{id}
SELECT
dept.id,dept.deviceName,dept.deviceNumber,dept.deviceType,dept.ownership,
dept.ownerId,dept.devicestate,dept.stime,
ST_ASTEXT(dept.coordinate) as coordinate,dept.dtype,
dept.parent_id,dept.jd,dept.wd,dept.street as streeName,u.yname,d.addvnm,dept.addvcd,
(
SELECT
CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
FROM
sys_equipment
WHERE
parent_id = dept.id
) AS "has_children"
FROM
sys_equipment dept left JOIN sys_suser u on u.ynumber=dept.ownerId LEFT JOIN sys_district d on d.addvcds=dept.addvcd LEFT JOIN sys_street s on s.id=dept.street
WHERE dept.id=#{id}
SELECT e.id,e.deviceName,e.deviceNumber,e.deviceType,e.ownership,
e.ownerId,e.devicestate,e.stime,e.street as streeName,
ST_ASTEXT(e.coordinate) as coordinate,e.dtype,
e.parent_id,e.jd,e.wd,e.addvcd,
s.yname,d.bType,di.addvnm FROM `sys_equipment` e
LEFT JOIN sys_suser s
on s.ynumber=e.ownerId LEFT JOIN act_deploy d on d.deviceNumber=e.deviceNumber LEFT JOIN sys_district di on
di.addvcds=e.addvcd LEFT JOIN sys_street t on t.id=e.street
where 1=1
and e.deviceType=#{deviceType}
SELECT
dept.id,
dept.deviceName,
dept.deviceNumber,
dept.deviceType,
dept.ownership,
dept.ownerId,
dept.devicestate,
dept.stime,
ST_ASTEXT ( dept.coordinate ) AS coordinate,
dept.dtype,
dept.parent_id,
dept.jd,
dept.wd,
dept.street AS streeName,
u.yname,
d.addvnm,
dept.addvcd
FROM
sys_equipment dept
LEFT JOIN sys_suser u ON u.ynumber = dept.ownerId
LEFT JOIN sys_district d ON d.addvcds = dept.addvcd
LEFT JOIN sys_street s ON s.id = dept.street WHERE dept.deviceNumber=#{deviceNumber}