<?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.TbYsXsajMapper">

    <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"/>
    </resultMap>

    <!--行事案件-->
    <resultMap type="com.mosty.base.model.entity.yszx.TbYsXsaj" id="tbYsXsaj">
        <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="insertXsaj" parameterType="com.mosty.base.model.entity.yszx.TbYsXsaj">
        insert into tb_ys_xsaj
        (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="selectXsAjById" resultMap="tbYsXsaj">
        select
        <include refid="base_column"/>
        from tb_ys_xsaj
        where id = #{id}
    </select>


    <!--修改行事案件-->
    <update id="updateXsEntity" parameterType="com.mosty.base.model.entity.yszx.TbYsXsaj">
        update tb_ys_xsaj
        <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>
</mapper>


