初始提交

This commit is contained in:
2025-09-04 18:25:00 +08:00
commit 07ffe495a7
1939 changed files with 166154 additions and 0 deletions

View File

@ -0,0 +1,838 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mosty.qwzx.mapper.TbQwXfbbMapper">
<resultMap id="BaseResultMap" type="com.mosty.base.model.dto.qwzx.TbQwXfbbVo">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="xfpb_id" property="xfpbId"/>
<result column="bblx" property="bblx"/>
<result column="qwlx" property="qwlx"/>
<result column="qwdj_id" property="qwdjId"/>
<result column="qwdj" property="qwdj"/>
<result column="qwbc_id" property="qwbcId"/>
<result column="jz_id" property="jzId"/>
<result column="jz_mc" property="jzMc"/>
<result column="xfbm" property="xfbm"/>
<result column="xfbmid" property="xfbmid"/>
<result column="xfbmdm" property="xfbmdm"/>
<result column="fzr_sfzh" property="fzrSfzh"/>
<result column="fzr_xm" property="fzrXm"/>
<result column="fzr_id" property="fzrId"/>
<result column="fzr_lxdh" property="fzrLxdh"/>
<result column="xfrq" property="xfrq"/>
<result column="kssj" property="kssj"/>
<result column="jssj" property="jssj"/>
<result column="zqsc" property="zqsc"/>
<result column="jgts" property="jgts"/>
<result column="mjsl" property="mjsl"/>
<result column="pbmj" property="pbmj"/>
<result column="fjsl" property="fjsl"/>
<result column="pbfj" property="pbfj"/>
<result column="jcsl" property="jcsl"/>
<result column="pbcl" property="pbcl"/>
<result column="txzbsl" property="txzbsl"/>
<result column="txzb" property="txzb"/>
<result column="jyqxsl" property="jyqxsl"/>
<result column="jyqx" property="jyqx"/>
<result column="wzlx" property="wzlx"/>
<result column="zzlx" property="zzlx"/>
<result column="xlfs" property="xlfs"/>
<result column="xfzt" property="xfzt"/>
<result column="bbkssj" property="bbkssj"/>
<result column="bbjssj" property="bbjssj"/>
<result column="bbzt" property="bbzt"/>
<result column="dqwz" property="dqwz"/>
<result column="jd" property="jd"/>
<result column="wd" property="wd"/>
<result column="zbhash" property="zbhash"/>
<result column="zbsj" property="zbsj"/>
<result column="xfsc" property="xfsc"/>
<result column="xflc" property="xflc"/>
<result column="xffwlx" property="xffwlx"/>
<result column="xffwid" property="xffwid"/>
<result column="ssbm" property="ssbm"/>
<result column="ssbmid" property="ssbmid"/>
<result column="ssbmdm" property="ssbmdm"/>
<result column="ssxgaj" property="ssxgaj"/>
<result column="ssxgajid" property="ssxgajid"/>
<result column="ssxgajdm" property="ssxgajdm"/>
<result column="sssgajid" property="sssgajid"/>
<result column="sssgaj" property="sssgaj"/>
<result column="sssgajdm" property="sssgajdm"/>
<result column="bz" property="bz"/>
<result column="zylx" property="zylx"/>
<result column="dzbq" property="dzbq"/>
<result column="wqzb" property="wqzb"/>
<collection property="jlList" ofType="com.mosty.base.model.dto.qwzx.TbQwJlDto">
<result column="id" property="id"/>
<result column="ywid" property="ywid"/>
<result column="jl_id" property="jlId"/>
<result column="jllx" property="jllx"/>
<result column="jlxm" property="jlxm"/>
<result column="xbdm" property="xbdm"/>
<result column="nl" property="nl"/>
<result column="jlzt" property="jlzt"/>
<result column="zblx" property="zblx"/>
</collection>
<collection property="clList" ofType="com.mosty.base.model.dto.qwzx.TbQwClDto">
<result column="id" property="id"/>
<result column="ywid" property="ywid"/>
<result column="qwcl_id" property="qwclId"/>
<result column="clmc" property="clmc"/>
<result column="jdchphm" property="jdchphm"/>
<result column="jdchpzldm" property="jdchpzldm"/>
<result column="zblx" property="zblx"/>
</collection>
<collection property="znzbList" ofType="com.mosty.base.model.dto.qwzx.TbQwZnzbDto">
<result column="id" property="id"/>
<result column="ywid" property="ywid"/>
<result column="txzb_id" property="txzbId"/>
<result column="sbmc" property="sbmc"/>
<result column="txzblx" property="txzblx"/>
<result column="hh" property="hh"/>
<result column="zhh" property="zhh"/>
<result column="zblx" property="zblx"/>
</collection>
<collection property="jyqxList" ofType="com.mosty.base.model.dto.qwzx.TbQwJyqxDto">
<result column="id" property="id"/>
<result column="ywid" property="ywid"/>
<result column="zblx" property="zblx"/>
<result column="qxmc" property="qxmc"/>
<result column="qxlx" property="qxlx"/>
<result column="qxsl" property="qxsl"/>
</collection>
</resultMap>
<resultMap id="BaseMap" type="com.mosty.base.model.entity.qwzx.TbQwXfbb">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="xfpb_id" property="xfpbId"/>
<result column="qwdj_id" property="qwdjId"/>
<result column="qwlx" property="qwlx"/>
<result column="bblx" property="bblx"/>
<result column="qwdj" property="qwdj"/>
<result column="qwbc_id" property="qwbcId"/>
<result column="jz_id" property="jzId"/>
<result column="jz_mc" property="jzMc"/>
<result column="xfbm" property="xfbm"/>
<result column="xfbmid" property="xfbmid"/>
<result column="xfbmdm" property="xfbmdm"/>
<result column="fzr_sfzh" property="fzrSfzh"/>
<result column="fzr_xm" property="fzrXm"/>
<result column="fzr_id" property="fzrId"/>
<result column="fzr_lxdh" property="fzrLxdh"/>
<result column="xfrq" property="xfrq"/>
<result column="kssj" property="kssj"/>
<result column="jssj" property="jssj"/>
<result column="zqsc" property="zqsc"/>
<result column="jgts" property="jgts"/>
<result column="mjsl" property="mjsl"/>
<result column="pbmj" property="pbmj"/>
<result column="fjsl" property="fjsl"/>
<result column="pbfj" property="pbfj"/>
<result column="jcsl" property="jcsl"/>
<result column="pbcl" property="pbcl"/>
<result column="txzbsl" property="txzbsl"/>
<result column="txzb" property="txzb"/>
<result column="jyqxsl" property="jyqxsl"/>
<result column="jyqx" property="jyqx"/>
<result column="wzlx" property="wzlx"/>
<result column="zzlx" property="zzlx"/>
<result column="xlfs" property="xlfs"/>
<result column="xfzt" property="xfzt"/>
<result column="bbkssj" property="bbkssj"/>
<result column="bbjssj" property="bbjssj"/>
<result column="bbzt" property="bbzt"/>
<result column="dqwz" property="dqwz"/>
<result column="jd" property="jd"/>
<result column="wd" property="wd"/>
<result column="zb" property="zb" typeHandler="com.mosty.base.feign.handle.PointTypeHandler"/>
<result column="zbhash" property="zbhash"/>
<result column="zbsj" property="zbsj"/>
<result column="xfsc" property="xfsc"/>
<result column="xflc" property="xflc"/>
<result column="xffwlx" property="xffwlx"/>
<result column="xffwid" property="xffwid"/>
<result column="ssbm" property="ssbm"/>
<result column="ssbmid" property="ssbmid"/>
<result column="ssbmdm" property="ssbmdm"/>
<result column="ssxgaj" property="ssxgaj"/>
<result column="ssxgajid" property="ssxgajid"/>
<result column="ssxgajdm" property="ssxgajdm"/>
<result column="sssgajid" property="sssgajid"/>
<result column="sssgaj" property="sssgaj"/>
<result column="sssgajdm" property="sssgajdm"/>
<result property="xtSjly" column="xt_sjly" jdbcType="VARCHAR"/>
<result property="xtSjzt" column="xt_sjzt" jdbcType="VARCHAR"/>
<result property="xtScbz" column="xt_scbz" jdbcType="VARCHAR"/>
<result property="xtCjip" column="xt_cjip" jdbcType="VARCHAR"/>
<result property="xtCjsj" column="xt_cjsj" jdbcType="VARCHAR"/>
<result property="xtCjrId" column="xt_cjr_id" jdbcType="VARCHAR"/>
<result property="xtCjr" column="xt_cjr" jdbcType="VARCHAR"/>
<result property="xtCjbmdm" column="xt_cjbmdm" jdbcType="VARCHAR"/>
<result property="xtCjbmmc" column="xt_cjbmmc" jdbcType="VARCHAR"/>
<result property="xtZhgxip" column="xt_zhgxip" jdbcType="VARCHAR"/>
<result property="xtZhgxsj" column="xt_zhgxsj" jdbcType="VARCHAR"/>
<result property="xtZhgxrid" column="xt_zhgxrid" jdbcType="VARCHAR"/>
<result property="xtZhgxr" column="xt_zhgxr" jdbcType="VARCHAR"/>
<result property="xtZhgxbmdm" column="xt_zhgxbmdm" jdbcType="VARCHAR"/>
<result property="xtZhgxbm" column="xt_zhgxbm" jdbcType="VARCHAR"/>
<result column="bz" property="bz"/>
<result column="zylx" property="zylx"/>
<result column="dzbq" property="dzbq"/>
<result column="wqzb" property="wqzb"/>
</resultMap>
<!--查询-->
<select id="queryList" resultMap="BaseResultMap">
select a.*,b.*,c.*,d.*,e.* from tb_qw_xfbb a
left join tb_qw_jl b on a.id = b.ywid
left join tb_qw_cl c on a.id = c.ywid
left join tb_qw_znzb d on a.id = d.ywid
left join tb_qw_jyqx e on a.id = e.ywid
where a.xt_scbz = '0'
<if test="params.xfbId != null and params.xfbId != ''">
and a.xfpb_id = #{params.xfpbId,jdbcType=VARCHAR}
</if>
<if test="params.qwdjId != null and params.qwdjId != ''">
and a.qwdj_id = #{params.qwdjId,jdbcType=VARCHAR}
</if>
<if test="params.qwbcId != null and params.qwbcId != ''">
and a.qwbc_id = #{params.qwbcId,jdbcType=VARCHAR}
</if>
<if test="params.jzId != null and params.jzId != ''">
and a.jz_id = #{params.jzId,jdbcType=VARCHAR}
</if>
<if test="params.qwdj != null and params.qwdj != ''">
and a.qwdj = #{params.qwdj,jdbcType=VARCHAR}
</if>
<if test="params.xfbmdm != null and params.xfbmdm != ''">
and a.xfbmdm = #{params.xfbmdm,jdbcType=VARCHAR}
</if>
<if test="params.fzrXm != null and params.fzrXm != ''">
and a.fzr_xm like concat('%',#{params.fzrXm,jdbcType=VARCHAR},'%')
</if>
<if test="params.fzrSfzh != null and params.fzrSfzh != ''">
and a.fzr_sfzh like concat('%',#{params.fzrSfzh,jdbcType=VARCHAR},'%')
</if>
<if test="params.xfzt != null and params.xfzt != ''">
and a.xfzt = #{params.xfzt,jdbcType=VARCHAR}
</if>
<if test="params.xtSjly != null and params.xtSjly != ''">
and a.xt_sjly = #{params.xtSjly,jdbcType=VARCHAR}
</if>
<if test="params.xtSjzt != null and params.xtSjzt != ''">
and a.xt_sjzt = #{params.xtSjzt,jdbcType=VARCHAR}
</if>
<if test="params.kssj != null and params.jssj == null">
and a.kssj &gt;= #{params.kssj,jdbcType=DATE}
</if>
<if test="params.kssj == null and params.jssj != null">
and a.kssj &lt;= #{params.jssj,jdbcType=DATE}
</if>
<if test="params.kssj != null and params.jssj != null">
and a.kssj between #{params.kssj,jdbcType=DATE} and #{params.jssj,jdbcType=DATE}
</if>
<if test="params.ssbmdm != null and params.ssbmdm != ''">
and a.ssbmdm like concat(#{params.ssbmdm},'%')
</if>
<!-- 数据范围过滤 -->
<!-- ${createSql}-->
</select>
<!--id查询-->
<select id="queryById" resultMap="BaseResultMap">
select a.*, b.*, c.*, d.*, e.*
from tb_qw_xfbb a
left join tb_qw_jl b on a.id = b.ywid
left join tb_qw_cl c on a.id = c.ywid
left join tb_qw_znzb d on a.id = d.ywid
left join tb_qw_jyqx e on a.id = e.ywid
where a.xt_scbz = '0'
and a.id = #{id,jdbcType=VARCHAR}
</select>
<select id="selectJhsl" resultType="Integer">
select count(1) from tb_qw_xfpb_zq b where b.xt_scbz = '0' and b.xt_sjzt = '1'
and b.id in (select a.pbzq_id from tb_qw_xfpb_mrjl a where DATE_FORMAT(now(), '%Y-%m-%d %H:%i:%s')
between DATE_FORMAT(a.xfkssj, '%Y-%m-%d %H:%i:%s') and DATE_FORMAT(a.xfjssj, '%Y-%m-%d %H:%i:%s'))
<if test="dto != null and dto.fzrXm != null and dto.fzrXm != ''">
and b.fzr_xm like concat ('%',#{dto.fzrXm},'%')
</if>
<!-- <if test="dto != null and dto.ssbmid != null and dto.ssbmid != ''">-->
<!-- and b.ssbmid = #{dto.ssbmid}-->
<!-- </if>-->
<if test="dto != null and dto.ssbmdm != null and dto.ssbmdm != ''">
and b.ssbmdm like concat(#{dto.ssbmdm},'%')
</if>
<!-- ${useSql}-->
</select>
<select id="selectJhslList" resultType="com.mosty.base.model.entity.qwzx.TbQwXfpbZq">
select * from tb_qw_xfpb_zq b where b.xt_scbz = '0' and b.xt_sjzt = '1'
and b.id in (select a.pbzq_id from tb_qw_xfpb_mrjl a where DATE_FORMAT(now(), '%Y-%m-%d %H:%i:%s')
between DATE_FORMAT(a.xfkssj, '%Y-%m-%d %H:%i:%s') and DATE_FORMAT(a.xfjssj, '%Y-%m-%d %H:%i:%s')
)
<if test="dto != null and dto.fzrXm != null and dto.fzrXm != ''">
and b.fzr_xm like concat ('%',#{dto.fzrXm},'%')
</if>
<!-- <if test="dto != null and dto.ssbmid != null and dto.ssbmid != ''">-->
<!-- and b.ssbmid = #{dto.ssbmid}-->
<!-- </if>-->
<if test="dto != null and dto.ssbmdm != null and dto.ssbmdm != ''">
and b.ssbmdm = #{dto.ssbmdm}
</if>
<!-- ${useSql}-->
limit #{pageIndex}, #{pageSize}
</select>
<select id="selectSjsl" resultType="Integer">
select count(1)
from tb_qw_xfbb b
where b.xt_scbz = '0'
and b.xt_sjzt = '1'
and b.bbzt = '0'
<if test="dto != null and dto.fzrXm != null and dto.fzrXm != ''">
and b.fzr_xm like concat ('%',#{dto.fzrXm},'%')
</if>
<!-- <if test="dto != null and dto.ssbmid != null and dto.ssbmid != ''">-->
<!-- and b.xfbmdm = #{dto.ssbmid}-->
<!-- </if>-->
<if test="dto != null and dto.ssbmdm != null and dto.ssbmdm != ''">
and b.ssbmdm like concat(#{dto.ssbmdm},'%')
</if>
<!-- ${useSql}-->
</select>
<select id="selectSjslList" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb">
select *
from tb_qw_xfbb b
where b.xt_scbz = '0'
and b.xt_sjzt = '1'
and b.bbzt = '0'
<if test="dto != null and dto.fzrXm != null and dto.fzrXm != ''">
and b.fzr_xm like concat ('%',#{dto.fzrXm},'%')
</if>
<!-- <if test="dto != null and dto.ssbmid != null and dto.ssbmid != ''">-->
<!-- and b.xfbmdm = #{dto.ssbmid}-->
<!-- </if>-->
<if test="dto != null and dto.ssbmdm != null and dto.ssbmdm != ''">
and b.ssbmdm like concat(#{dto.ssbmdm},'%')
</if>
<!-- ${useSql}-->
limit #{pageIndex}
, #{pageSize}
</select>
<select id="selectPowerAndDayLength" resultType="java.util.Map" parameterType="String">
select ifnull(sum(mjsl), 0) jmmjsl,
ifnull(sum(fjsl), 0) jmfjsl,
ifnull(sum(xfsc), 0) xfsc,
ifnull(sum(xflc), 0) xflc
from tb_qw_xfbb
where xt_scbz = '0'
and xt_sjzt = '1'
and bbzt = '0'
<if test="ssbmdm != null and ssbmdm != ''">
and ssbmdm like concat(#{ssbmdm},'%')
</if>
</select>
<select id="selectNearbyDeck" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb">
SELECT *,
(
6371 * acos(
cos(radians(#{t.jd}))
* cos(radians(jd))
* cos(radians(wd) - radians(#{t.wd}))
+ sin(radians(#{t.jd}))
* sin(radians(jd))
)
)
AS distance
FROM tb_qw_xfbb
HAVING distance &lt; 20
ORDER BY distance;
</select>
<!--批量删除-->
<update id="deleteXfbb">
update tb_qw_xfbb set xt_scbz = '1' where id in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</update>
<!--查询周边巡组或街面巡组数量-->
<select id="getCountZbxz" resultType="Integer" parameterType="Map">
select count(1) from tb_qw_xfbb a where a.xt_scbz = '0' and a.xt_sjzt = '1' and a.bbzt= '0'
<if test="dto.jd != null and dto.wd != null and dto.radius != null">
<![CDATA[and st_distance_sphere(POINT(jd,wd),POINT(#{dto.jd},#{dto.wd})) <= #{dto.radius}]]>
</if>
<!-- <if test="list != null and list.size() > 0 and qwList != null and qwList.size() > 0 ">
and a.xfzt in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>-->
<choose>
<when test="list != null and list.size() > 0 and qwList != null and qwList.size() > 0 ">
and ( a.xfzt in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
or a.qwlx in
<foreach collection="qwList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
)
</when>
<when test="list != null and list.size() > 0 ">
and a.xfzt in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<when test="qwList != null and qwList.size() > 0 ">
and a.qwlx in
<foreach collection="qwList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</when>
</choose>
<if test="dto.bbrq != null and dto.bbrq != ''">
and date_format(a.xfrq,'%Y-%m-%d') = #{dto.bbrq}
</if>
<if test="dto.zzlx != null and dto.zzlx != ''">
and a.zzlx = #{dto.zzlx}
</if>
<if test="dto.fzrXm != null and dto.fzrXm != ''">
and a.fzr_xm like concat('%',#{dto.fzrXm},'%')
</if>
<if test="dto.jzMc != null and dto.jzMc != ''">
and a.jz_mc like concat('%',#{dto.jzMc},'%')
</if>
<if test="dto.ssbmdm != null and dto.ssbmdm != ''">
and a.ssbmdm like concat(#{dto.ssbmdm},'%')
</if>
<if test="dto.keyword != null and dto.keyword != ''">
and (
a.xfbm like concat('%',#{dto.keyword},'%') or
a.jz_mc like concat('%',#{dto.keyword},'%') or
a.fzr_xm like concat('%',#{dto.keyword},'%') or
a.dqwz like concat('%',#{dto.keyword},'%')
)
</if>
<!-- <if test="qwList != null and qwList.size() > 0">
and a.qwlx in
<foreach collection="qwList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
-->
</select>
<!--查询周边巡组或街面巡组列表-->
<select id="getListZbxz" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb" parameterType="Map">
select *
<if test="dto.jd != null and dto.wd != null and dto.radius != null">
,st_distance_sphere(POINT(jd,wd),POINT(#{dto.jd},#{dto.wd})) as distance
</if>
from tb_qw_xfbb a where a.xt_scbz = '0' and a.xt_sjzt = '1' and a.bbzt= '0'
<!-- <if test="list != null and list.size() > 0">
and a.xfzt in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>-->
<choose>
<when test="list != null and list.size() > 0 and qwList != null and qwList.size() > 0 ">
and ( a.xfzt in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
or a.qwlx in
<foreach collection="qwList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
)
</when>
<when test="list != null and list.size() > 0 ">
and a.xfzt in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<when test="qwList != null and qwList.size() > 0 ">
and a.qwlx in
<foreach collection="qwList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</when>
</choose>
<if test="dto.bbrq != null and dto.bbrq != ''">
and date_format(a.xfrq,'%Y-%m-%d') = #{dto.bbrq}
</if>
<if test="dto.zzlx != null and dto.zzlx != ''">
and a.zzlx = #{dto.zzlx}
</if>
<!-- <if test="dto.ssbmdm != null and dto.ssbmdm != ''">-->
<!-- and ssbmdm = #{dto.ssbmdm}-->
<!-- </if>-->
<if test="dto.fzrXm != null and dto.fzrXm != ''">
and a.fzr_xm like concat('%',#{dto.fzrXm},'%')
</if>
<if test="dto.jzMc != null and dto.jzMc != ''">
and a.jz_mc like concat('%',#{dto.jzMc},'%')
</if>
<if test="dto.ssbmdm != null and dto.ssbmdm != ''">
and a.ssbmdm like concat(#{dto.ssbmdm},'%')
</if>
<if test="dto.keyword != null and dto.keyword != ''">
and (
a.xfbm like concat('%',#{dto.keyword},'%') or
a.jz_mc like concat('%',#{dto.keyword},'%') or
a.fzr_xm like concat('%',#{dto.keyword},'%') or
a.dqwz like concat('%',#{dto.keyword},'%')
)
</if>
<!-- <if test="qwList != null and qwList.size() > 0">
and a.qwlx in
<foreach collection="qwList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>-->
<if test="dto.jd != null and dto.wd != null and dto.radius != null">
<![CDATA[and st_distance_sphere(POINT(jd,wd),POINT(#{dto.jd},#{dto.wd})) <= #{dto.radius}]]>
order by distance asc
</if>
<if test="pageIndex != null and pageIndex != null and pageIndex != '' and pageSize != ''">
limit #{pageIndex},#{pageSize}
</if>
</select>
<!--查询我今天的报备-->
<select id="getMybbTodayNew" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb" parameterType="String">
select *
from tb_qw_xfbb a
where a.xt_scbz = '0'
<if test="bblx != null and bblx != ''">
and a.bblx = #{bblx}
</if>
and a.xt_sjzt = '1'
and a.bbzt = '0'
and a.bbjssj is null
and (
a.fzr_sfzh = #{sfzh} or a.id in (select ywid
from tb_qw_jl b
where b.xt_scbz = '0'
and b.xt_sjzt = '1'
and b.ywid = a.id
and b.sfzh = #{sfzh})
)
limit 1
</select>
<!--查询我今天的报备-->
<select id="getMybbTodayByTime" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb" parameterType="String">
select *
from tb_qw_xfbb a
where a.xt_scbz = '0'
and a.xt_sjzt = '1'
and a.bbzt = '0'
and a.bbjssj is null
<if test="bblx != null and bblx != ''">
and a.bblx = #{bblx}
</if>
<if test="time != null and time != ''">
and date_format(a.xfrq,'%Y-%m-%d') = #{time}
</if>
and (
a.fzr_id = #{userId} or a.id in (select ywid
from tb_qw_jl b
where b.xt_scbz = '0'
and b.xt_sjzt = '1'
and b.ywid = a.id
and b.jl_id = #{userId})
)
</select>
<select id="getBbxxByJi" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb">
select *
from (
select id,
st_distance_sphere(POINT(jd, wd), POINt(#{jd}, #{wd}))
as jl,
ssbm,
ssbmid,
ssbmdm,
ssxgaj,
ssxgajid,
ssxgajdm,
sssgaj,
sssgajid,
sssgajdm
from tb_qw_xfbb
where xt_scbz = '0'
and bbzt = '0'
and xfzt = '0'
<if test="ssbmid != null and ssbmid != ''">
and (ssbmid = #{ssbmid} or ssxgajid = #{ssbmid} or sssgajid = #{ssbmid})
</if>
order by jl asc
) a
where a.jl &lt;= #{radius} limit 1
</select>
<select id="getBbList" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb">
select a.*
from tb_qw_xfbb a,
tb_qw_znzb b
where a.id = b.ywid
and b.xt_sjzt = '1'
and b.xt_scbz = '0'
and b.hh = #{sbid}
and a.bbzt = '0'
<!-- and date_format(xfrq, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')-->
</select>
<select id="getClBbList" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb">
SELECT
a.*
FROM
tb_qw_xfbb a,
tb_qw_cl b
WHERE
a.id = b.ywid
AND b.xt_sjzt = '1'
AND b.xt_scbz = '0'
AND b.gps_id = #{sbid}
AND a.bbzt = '0'
</select>
<sql id="base_column_list">
id, xfpb_id, qwdj_id, qwdj, qwbc_id, jz_id, jz_mc,bblx,qwlx,
xfbm,xfbmid, xfbmdm, fzr_sfzh, fzr_xm, fzr_id, fzr_lxdh, xfrq, kssj, jssj,
zqsc, jgts, mjsl, pbmj, fjsl, pbfj, jcsl, pbcl, txzbsl, txzb, jyqxsl,
jyqx, wzlx, zzlx, xlfs, xfzt, bbkssj, bbjssj, bbzt, dqwz, jd, wd,
zbhash, zbsj, xfsc, xflc, xffwlx, xffwid, ssbm, ssbmdm, ssxgaj, ssxgajdm,ssbmid,ssxgajid,sssgajid,
sssgaj, sssgajdm, bz, xt_sjly, xt_sjzt, xt_scbz, xt_cjip,
xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid,
xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm,zylx,dzbq,wqzb
</sql>
<sql id="zb_sql">
ST_ASWKT
(zb)
as zb
</sql>
<insert id="insertEntity">
insert into tb_qw_xfbb
(id, xfpb_id, qwdj_id, qwdj, qwbc_id, jz_id, jz_mc, bblx, qwlx,
xfbm, xfbmid, xfbmdm, fzr_sfzh, fzr_xm, fzr_id, fzr_lxdh, xfrq, kssj, jssj,
zqsc, jgts, mjsl, pbmj, fjsl, pbfj, jcsl, pbcl, txzbsl, txzb, jyqxsl,
jyqx, jyqx_sfagdxd, wzlx, zzlx, xlfs, xfzt, bbkssj, bbjssj, bbzt, dqwz, jd, wd, zb,
zbhash, zbsj, xfsc, xflc, xffwlx, xffwid, ssbm, ssbmdm, ssxgaj, ssxgajdm, ssbmid, ssxgajid, sssgajid,
sssgaj, sssgajdm, bz, xt_sjly, xt_sjzt, xt_scbz, xt_cjip,
xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid,
xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, zylx,dzbq,wqzb)
values (#{id}, #{xfpbId}, #{qwdjId}, #{qwdj}, #{qwbcId}, #{jzId}, #{jzMc}, #{bblx}, #{qwlx},
#{xfbm}, #{xfbmid}, #{xfbmdm}, #{fzrSfzh}, #{fzrXm}, #{fzrId}, #{fzrLxdh}, #{xfrq}, #{kssj}, #{jssj},
#{zqsc}, #{jgts}, #{mjsl}, #{pbmj}, #{fjsl}, #{pbfj}, #{jcsl}, #{pbcl}, #{txzbsl}, #{txzb}, #{jyqxsl},
#{jyqx}, #{jyqxSfagdxd}, #{wzlx}, #{zzlx}, #{xlfs}, #{xfzt}, #{bbkssj}, #{bbjssj}, #{bbzt}, #{dqwz}, #{jd}, #{wd},
ST_GEOMFROMTEXT(#{zb,typeHandler = com.mosty.base.feign.handle.PointTypeHandler}),
#{zbhash}, #{zbsj}, #{xfsc}, #{xflc}, #{xffwlx}, #{xffwid}, #{ssbm}, #{ssbmdm}, #{ssxgaj},
#{ssxgajdm}, #{ssbmid}, #{ssxgajid}, #{sssgajid},
#{sssgaj}, #{sssgajdm}, #{bz}, #{xtSjly}, #{xtSjzt}, #{xtScbz}, #{xtCjip},
#{xtCjsj}, #{xtCjrId}, #{xtCjr}, #{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip}, #{xtZhgxsj},
#{xtZhgxrid},
#{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{zylx}, #{dzbq}, #{wqzb})
</insert>
<select id="getSumXfsc" resultType="java.util.Map">
select sum(xfsc) xfsc,ssxgaj,ssxgajid from tb_qw_xfbb where xfrq &lt;= #{jssj} and xfrq >= #{kssj}
and xt_sjzt = '1' and xt_scbz = '0'
group by ssxgaj,ssxgajid
</select>
<select id="getSumXflc" resultType="java.util.Map">
select sum(xflc) xflc,ssxgaj,ssxgajid from tb_qw_xfbb where xfrq &lt;= #{jssj} and xfrq >= #{kssj}
and xt_sjzt = '1' and xt_scbz = '0'
group by ssxgaj,ssxgajid
</select>
<select id="getBbAll" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb">
select * from tb_qw_xfbb where
xt_sjzt = '1' and xt_scbz = '0' and bbzt = '0'
</select>
<!--修改巡逻状态-->
<update id="updateByXlzt">
update tb_qw_xfbb set xfzt = #{xlzt} where id = #{id}
</update>
<!--修改巡逻时长-->
<update id="updateXfscById">
update tb_qw_xfbb set xfsc = #{xfsc} where id = #{id}
</update>
<select id="bmtj" resultType="java.util.Map">
SELECT ssbm,ssbmdm,
sum(xfsc) xfsc,
SUM(xflc) xflc,
COUNT(1) xfxz,
SUM( IFNULL( jcsl, 0 ) ) jcsl,
SUM( IFNULL( mjsl, 0 ) ) mjsl,
SUM( IFNULL( fjsl, 0 ) ) fjsl
FROM `tb_qw_xfbb`
where xt_sjzt = '1' and xt_scbz = '0'
<if test="params.ssbmdm != null and params.ssbmdm != ''">
and ssbmdm like concat(#{params.ssbmdm},'%')
</if>
<if test="params.kssj != null and params.kssj != ''">
and bbkssj >= #{params.kssj}
</if>
<if test="params.jssj != null and params.jssj != ''">
and bbkssj &lt;= #{params.jssj}
</if>
GROUP BY ssbm,ssbmdm ORDER BY ssbmdm
</select>
<select id="bmtjAll" resultType="java.util.Map">
SELECT
sum(xfsc) xfsc,
SUM(xflc) xflc,
COUNT(1) xfxz,
SUM( IFNULL( jcsl, 0 ) ) jcsl,
SUM( IFNULL( mjsl, 0 ) ) mjsl,
SUM( IFNULL( fjsl, 0 ) ) fjsl
FROM `tb_qw_xfbb`
where xt_sjzt = '1' and xt_scbz = '0'
<if test="ssbmdm != null and ssbmdm != ''">
and ssbmdm like concat(#{ssbmdm},'%')
</if>
<if test="kssj != null and kssj != ''">
and bbkssj >= #{kssj}
</if>
<if test="jssj != null and jssj != ''">
and bbkssj &lt;= #{jssj}
</if>
</select>
<select id="xqtj" resultType="java.util.Map">
SELECT
glbid,
fw_mc,
COUNT( b.id ) xfxz,
SUM( IFNULL( b.jcsl, 0 ) ) jcsl,
SUM( IFNULL( b.mjsl, 0 ) ) mjsl,
SUM( IFNULL( b.xflc, 0 ) ) xflc,
SUM( IFNULL( b.xfsc, 0 ) ) xfsc,
SUM( IFNULL( b.fjsl, 0 ) ) fjsl
FROM
`tb_qw_xffw` f
LEFT JOIN tb_qw_xfbb b ON b.id = f.ywid
WHERE
f.qwlx = '2'
AND f.xt_scbz = '0'
AND b.xt_scbz = '0'
<if test="params.ssbmdm != null and params.ssbmdm != ''">
and b.ssbmdm like concat(#{params.ssbmdm},'%')
</if>
<if test="params.kssj != null and params.kssj != ''">
and b.bbkssj >= #{params.kssj}
</if>
<if test="params.jssj != null and params.jssj != ''">
and b.bbkssj &lt;= #{params.jssj}
</if>
GROUP BY
glbid,
fw_mc
</select>
<select id="grtj" resultType="java.util.Map">
SELECT
fzr_sfzh,
fzr_xm,
SUM( xfsc ) xfsc,
SUM( xflc ) xflc,
SUM( IFNULL( jcsl, 0 ) ) jcsl,
SUM( IFNULL( mjsl, 0 ) ) mjsl,
SUM( IFNULL( fjsl, 0 ) ) fjsl
FROM
`tb_qw_xfbb`
where xt_sjzt = '1' and xt_scbz = '0'
<if test="params.ssbmdm != null and params.ssbmdm != ''">
and ssbmdm like concat(#{params.ssbmdm},'%')
</if>
<if test="params.kssj != null and params.kssj != ''">
and bbkssj >= #{params.kssj}
</if>
<if test="params.jssj != null and params.jssj != ''">
and bbkssj &lt;= #{params.jssj}
</if>
GROUP BY
fzr_sfzh,
fzr_xm
</select>
<select id="getBbidByXq" resultType="com.mosty.base.model.entity.qwzx.TbQwXfbb">
select id, xfpb_id, qwdj_id, qwdj, qwbc_id, jz_id, jz_mc,bblx,qwlx,
xfbm,xfbmid, xfbmdm, fzr_sfzh, fzr_xm, fzr_id, fzr_lxdh, xfrq, kssj, jssj,
zqsc, jgts, mjsl, pbmj, fjsl, pbfj, jcsl, pbcl, txzbsl, txzb, jyqxsl,
jyqx, wzlx, zzlx, xlfs, xfzt, bbkssj, bbjssj, bbzt, dqwz, jd, wd,
zbsj, xfsc, xflc, xffwlx, xffwid, ssbm, ssbmdm, ssxgaj, ssxgajdm,ssbmid,ssxgajid,sssgajid,
sssgaj, sssgajdm, bz, xt_sjly, xt_sjzt, xt_scbz, xt_cjip,
xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid,
xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm,zylx,dzbq,wqzb from tb_qw_xfbb where xt_sjzt = '1' and xt_scbz = '0' and bbzt = '0'
<if test="xqid != null and xqid != ''">
and xffwid like concat('%',#{xqid},'%')
</if>
</select>
<select id="getScLc" resultType="java.util.Map">
SELECT
IFNULL( SUM( xflc ), 0 )/1000 xflc,
IFNULL( SUM( xfsc ), 0 )/3600 xfsc
FROM `tb_qw_xfbb`
WHERE xt_sjzt = '1' and xt_scbz = '0' and bblx = '01'
<if test="ssbmdm != null and ssbmdm != ''">
and ssbmdm like concat(#{ssbmdm},'%')
</if>
<if test="time != null and time != ''">
and xfrq = #{time}
</if>
</select>
<select id="getBbgj" resultType="com.mosty.base.model.entity.wzzx.TbWzLswz">
SELECT id,jd,wd,dwsj FROM mosty_wzzx.tb_wz_lswz
where ywid = #{bbid}
ORDER BY dwsj ASC
</select>
</mapper>