Files
mosty-dyga-cloud/mosty-yszx/src/main/resources/mapper/TbYsXzajMapper.xml
2025-09-04 18:25:00 +08:00

419 lines
18 KiB
XML

<?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.yszx.mapper.TbYsXzajMapper">
<resultMap type="com.mosty.base.model.vo.yszx.TbYsAjVo" id="tbYsAjVo">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sjlyid" column="sjlyid" jdbcType="VARCHAR"/>
<result property="ajbh" column="ajbh" jdbcType="VARCHAR"/>
<result property="ajmc" column="ajmc" jdbcType="VARCHAR"/>
<result property="ajnr" column="ajnr" jdbcType="VARCHAR"/>
<result property="farq" column="farq" jdbcType="TIMESTAMP"/>
<result property="fasj" column="fasj" jdbcType="TIMESTAMP"/>
<result property="ajlb" column="ajlb" jdbcType="VARCHAR"/>
<result property="aymc" column="aymc" jdbcType="VARCHAR"/>
<result property="jd" column="jd" jdbcType="NUMERIC"/>
<result property="wd" column="wd" jdbcType="NUMERIC"/>
<result property="xzqhdm" column="xzqhdm" jdbcType="VARCHAR"/>
<result property="dzmc" column="dzmc" jdbcType="VARCHAR"/>
<result property="jsnr" column="jsnr" jdbcType="VARCHAR"/>
<result property="ssbm" column="ssbm" jdbcType="VARCHAR"/>
<result property="ssbmdm" column="ssbmdm" jdbcType="VARCHAR"/>
<result property="ssxgaj" column="ssxgaj" jdbcType="VARCHAR"/>
<result property="ssxgajdm" column="ssxgajdm" jdbcType="VARCHAR"/>
<result property="sssgaj" column="sssgaj" jdbcType="VARCHAR"/>
<result property="sssgajdm" column="sssgajdm" jdbcType="VARCHAR"/>
<result property="distance" column="distance" jdbcType="NUMERIC"/>
<result property="sssgajid" column="sssgajid" jdbcType="VARCHAR"/>
<result property="ssxgajid" column="ssxgajid" jdbcType="VARCHAR"/>
<result property="ssbmid" column="ssbmid" jdbcType="VARCHAR"/>
</resultMap>
<!--行政案件-->
<resultMap type="com.mosty.base.model.entity.yszx.TbYsXzaj" id="tbYsXzaj">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sjlyid" column="sjlyid" jdbcType="VARCHAR"/>
<result property="ajbh" column="ajbh" jdbcType="VARCHAR"/>
<result property="ajmc" column="ajmc" jdbcType="VARCHAR"/>
<result property="ajnr" column="ajnr" jdbcType="VARCHAR"/>
<result property="farq" column="farq" jdbcType="TIMESTAMP"/>
<result property="fasj" column="fasj" jdbcType="TIMESTAMP"/>
<result property="ajlb" column="ajlb" jdbcType="VARCHAR"/>
<result property="aymc" column="aymc" jdbcType="VARCHAR"/>
<result property="jd" column="jd" jdbcType="NUMERIC"/>
<result property="wd" column="wd" jdbcType="NUMERIC"/>
<result property="zb" column="zb" typeHandler="com.mosty.base.feign.handle.PointTypeHandler"/>
<result property="zbhash" column="zbhash" jdbcType="VARCHAR"/>
<result property="xzqhdm" column="xzqhdm" jdbcType="VARCHAR"/>
<result property="dzmc" column="dzmc" jdbcType="VARCHAR"/>
<result property="jsnr" column="jsnr" jdbcType="VARCHAR"/>
<result property="ssbm" column="ssbm" jdbcType="VARCHAR"/>
<result property="ssbmdm" column="ssbmdm" jdbcType="VARCHAR"/>
<result property="ssxgaj" column="ssxgaj" jdbcType="VARCHAR"/>
<result property="ssxgajdm" column="ssxgajdm" jdbcType="VARCHAR"/>
<result property="sssgaj" column="sssgaj" jdbcType="VARCHAR"/>
<result property="sssgajdm" column="sssgajdm" jdbcType="VARCHAR"/>
<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 property="bz" column="bz" jdbcType="VARCHAR"/>
<result property="distance" column="distance" jdbcType="NUMERIC"/>
<result property="sssgajid" column="sssgajid" jdbcType="VARCHAR"/>
<result property="ssxgajid" column="ssxgajid" jdbcType="VARCHAR"/>
<result property="ssbmid" column="ssbmid" jdbcType="VARCHAR"/>
</resultMap>
<sql id="base_column_list">
id
, ajfl, sjlyid, ajbh, ajmc, ajnr, farq, fasj,ssbmid,ssxgajid,sssgajid,
ajlb, aymc, jd, wd, zbhash, xzqhdm, dzmc, jsnr, ssbm,
ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, 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, bz
</sql>
<sql id="base_column">
id
, sjlyid, ajbh, ajmc, ajnr, farq, fasj,ssbmid,ssxgajid,sssgajid,
ajlb, aymc, jd, wd, zbhash, xzqhdm, dzmc, jsnr, ssbm,
ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, 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, bz
</sql>
<sql id="blob_column_List">
ST_ASWKT
(zb) as zb
</sql>
<!--新增行政案件-->
<insert id="insertXzaj" parameterType="com.mosty.base.model.entity.yszx.TbYsXzaj">
insert into tb_ys_xzaj
(id, sjlyid, ajbh, ajmc, ajnr, farq, fasj,ssbmid,ssxgajid,sssgajid,
ajlb, aymc, jd, wd, zb, zbhash, xzqhdm, dzmc, jsnr, ssbm,
ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, 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, bz)
values (#{id}, #{sjlyid}, #{ajbh}, #{ajmc}, #{ajnr}, #{farq}, #{fasj},#{ssbmid},#{ssxgajid},#{sssgajid},
#{ajlb}, #{aymc}, #{jd}, #{wd},
ST_GEOMFROMTEXT(#{zb,typeHandler=com.mosty.base.feign.handle.PointTypeHandler}),
#{zbhash}, #{xzqhdm}, #{dzmc}, #{jsnr}, #{ssbm},
#{ssbmdm}, #{ssxgaj}, #{ssxgajdm}, #{sssgaj}, #{sssgajdm}, #{xtSjly},
#{xtSjzt}, #{xtScbz}, #{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr},
#{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip}, #{xtZhgxsj}, #{xtZhgxrid},
#{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz})
</insert>
<!--查询行政案件详情-->
<select id="selectXzAjById" resultMap="tbYsXzaj">
select
<include refid="base_column"/>
from tb_ys_xzaj
where id = #{id}
</select>
<!--修改行政案件-->
<update id="updateXzEntity" parameterType="com.mosty.base.model.entity.yszx.TbYsXzaj">
update tb_ys_xzaj
<set>
<if test="sjlyid != null and sjlyid != ''">
sjlyid = #{sjlyid},
</if>
<if test="ajbh != null and ajbh != ''">
ajbh = #{ajbh},
</if>
<if test="ajmc != null and ajmc != ''">
ajmc = #{ajmc},
</if>
<if test="ajnr != null and ajnr != ''">
ajnr = #{ajnr},
</if>
<if test="farq != null">
farq = #{farq},
</if>
<if test="fasj != null">
fasj = #{fasj},
</if>
<if test="ajlb != null and ajlb != ''">
ajlb = #{ajlb},
</if>
<if test="aymc != null and aymc != ''">
aymc = #{aymc},
</if>
<if test="jd != null">
jd = #{jd},
</if>
<if test="wd != null">
wd = #{wd},
</if>
<if test="zb != null">
zb = ST_GEOMFROMTEXT(#{zb,typeHandler=com.mosty.base.feign.handle.PointTypeHandler}),
</if>
<if test="zbhash != null and zbhash != ''">
zbhash = #{zbhash},
</if>
<if test="xzqhdm != null and xzqhdm != ''">
xzqhdm = #{xzqhdm},
</if>
<if test="dzmc != null and dzmc != ''">
dzmc = #{dzmc},
</if>
<if test="jsnr != null and jsnr != ''">
jsnr = #{jsnr},
</if>
<if test="ssbm != null and ssbm != ''">
ssbm = #{ssbm},
</if>
<if test="ssbmdm != null and ssbmdm != ''">
ssbmdm = #{ssbmdm},
</if>
<if test="ssxgaj != null and ssxgaj != ''">
ssxgaj = #{ssxgaj},
</if>
<if test="ssxgajdm != null and ssxgajdm != ''">
ssxgajdm = #{ssxgajdm},
</if>
<if test="sssgaj != null and sssgaj != ''">
sssgaj = #{sssgaj},
</if>
<if test="sssgajdm != null and sssgajdm != ''">
sssgajdm = #{sssgajdm},
</if>
<if test="xtSjly != null and xtSjly != ''">
xt_sjly = #{xtSjly},
</if>
<if test="xtSjzt != null and xtSjzt != ''">
xt_sjzt = #{xtSjzt},
</if>
<if test="xtScbz != null and xtScbz != ''">
xt_scbz = #{xtScbz},
</if>
<if test="xtCjip != null and xtCjip != ''">
xt_cjip = #{xtCjip},
</if>
<if test="xtCjsj != null">
xt_cjsj = #{xtCjsj},
</if>
<if test="xtCjrId != null and xtCjrId != ''">
xt_cjr_id = #{xtCjrId},
</if>
<if test="xtCjr != null and xtCjr != ''">
xt_cjr = #{xtCjr},
</if>
<if test="xtCjbmdm != null and xtCjbmdm != ''">
xt_cjbmdm = #{xtCjbmdm},
</if>
<if test="xtCjbmmc != null and xtCjbmmc != ''">
xt_cjbmmc = #{xtCjbmmc},
</if>
<if test="xtZhgxip != null and xtZhgxip != ''">
xt_zhgxip = #{xtZhgxip},
</if>
<if test="xtZhgxsj != null">
xt_zhgxsj = #{xtZhgxsj},
</if>
<if test="xtZhgxrid != null and xtZhgxrid != ''">
xt_zhgxrid = #{xtZhgxrid},
</if>
<if test="xtZhgxr != null and xtZhgxr != ''">
xt_zhgxr = #{xtZhgxr},
</if>
<if test="xtZhgxbmdm != null and xtZhgxbmdm != ''">
xt_zhgxbmdm = #{xtZhgxbmdm},
</if>
<if test="xtZhgxbm != null and xtZhgxbm != ''">
xt_zhgxbm = #{xtZhgxbm},
</if>
<if test="bz != null and bz != ''">
bz = #{bz}
</if>
<if test="ssbmid != null and ssbmid != ''">
ssbmid = #{ssbmid},
</if>
<if test="ssxgajid != null and ssxgajid != ''">
ssxgajid = #{ssxgajid},
</if>
<if test="sssgajid != null and sssgajid != ''">
sssgajid = #{sssgajid},
</if>
</set>
where id = #{id}
</update>
<!--获取案件总数-->
<select id="getCount" resultType="Integer" parameterType="Map">
select count(1) from
<if test='dto.ajfl == "0"'>
(
select * from tb_ys_xsaj union all
select * from tb_ys_xzaj
) as tb
</if>
<if test='dto.ajfl == "1"'>
tb_ys_xsaj
</if>
<if test='dto.ajfl == "2"'>
tb_ys_xzaj
</if>
where xt_scbz = '0' and xt_sjzt = '1'
<if test="dto.ajmc != null and dto.ajmc != ''">
and ajmc like concat('%',#{dto.ajmc},'%')
</if>
<if test="dto.ajnr != null and dto.ajnr != ''">
and ajnr like concat('%',#{dto.ajnr},'%')
</if>
<if test="dto.ajlb != null and dto.ajlb != ''">
and ajlb = #{dto.ajlb}
</if>
<if test="dto.startTime != null and dto.startTime != '' and endTime != null and endTime != ''">
and fasj between #{dto.startTime} and #{endTime}
</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}]]>
</if>
${useSql}
</select>
<!--分页获取案件列表-->
<select id="getList" resultMap="tbYsAjVo" parameterType="Map">
select
<include refid="base_column_list"/>
<if test="dto.jd != null and dto.wd != null and dto.radius != null">
,distance
</if>
<if test='dto.ajfl == "0"'>
from (
select *,1 as ajfl
<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_ys_xsaj union all
select *,2 as ajfl
<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_ys_xzaj
) as tb
</if>
<if test='dto.ajfl == "1"'>
from (select * ,1 as ajfl
<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_ys_xsaj) as tb
</if>
<if test='dto.ajfl == "2"'>
from (select * ,2 as ajfl
<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_ys_xzaj) as tb
</if>
where xt_scbz = '0' and xt_sjzt = '1'
<if test="dto.ajmc != null and dto.ajmc != ''">
and ajmc like concat('%',#{dto.ajmc},'%')
</if>
<if test="dto.ajnr != null and dto.ajnr != ''">
and dto.ajnr like concat('%',#{dto.ajnr},'%')
</if>
<if test="dto.ajlb != null and dto.ajlb != ''">
and ajlb = #{dto.ajlb}
</if>
<if test="dto.startTime != null and dto.startTime != '' and endTime != null and endTime != ''">
and fasj between #{dto.startTime} and #{endTime}
</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}]]>
</if>
${useSql}
order by fasj desc
limit #{pageIndex},#{pageSize}
</select>
<!--查询案件列表不分页-->
<select id="getListAll" resultMap="tbYsAjVo" parameterType="Map">
select
<include refid="base_column_list"/>
<if test="dto.jd != null and dto.wd != null and dto.radius != null">
,distance
</if>
<if test='dto.ajfl == "0"'>
from (
select *,1 as ajfl
<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_ys_xsaj union all
select *,2 as ajfl
<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_ys_xzaj
) as tb
</if>
<if test='dto.ajfl == "1"'>
from (select * ,1 as ajfl
<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_ys_xsaj) as tb
</if>
<if test='dto.ajfl == "2"'>
from (select * ,2 as ajfl
<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_ys_xzaj) as tb
</if>
where xt_scbz = '0' and xt_sjzt = '1'
<if test="dto.ajmc != null and dto.ajmc != ''">
and ajmc like concat('%',#{dto.ajmc},'%')
</if>
<if test="dto.ajnr != null and dto.ajnr != ''">
and ajnr like concat('%',#{dto.ajnr},'%')
</if>
<if test="dto.ajlb != null and dto.ajlb != ''">
and ajlb = #{dto.ajlb}
</if>
<if test="dto.startTime != null and dto.startTime != '' and endTime != null and endTime != ''">
and fasj between #{dto.startTime} and #{endTime}
</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}]]>
</if>
${useSql}
order by fasj desc
</select>
<!--删除案件信息-->
<update id="delAj" parameterType="com.mosty.base.model.dto.yszx.TbYsAjDelDto">
update
<if test='ajfl == "1"'>
tb_ys_xsaj
</if>
<if test='ajfl == "2"'>
tb_ys_xzaj
</if>
set xt_scbz = '1'
where id = #{id}
</update>
</mapper>