<?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.sjzx.mapper.TbSjMapper">

    <resultMap type="com.mosty.base.model.entity.sjzx.TbSj" id="TbSjMap">
        <result property="id" column="id" jdbcType="VARCHAR"/>
        <result property="ywId" column="yw_id" jdbcType="VARCHAR"/>
        <result property="sjFl" column="sj_fl" jdbcType="VARCHAR"/>
        <result property="sjJb" column="sj_jb" jdbcType="VARCHAR"/>
        <result property="sjFssj" column="sj_fssj" jdbcType="TIMESTAMP"/>
        <result property="sjBt" column="sj_bt" jdbcType="VARCHAR"/>
        <result property="sjNr" column="sj_nr" jdbcType="VARCHAR"/>
        <result property="bjrxm" column="bjrxm" jdbcType="VARCHAR"/>
        <result property="bjrlxdh" column="bjrlxdh" jdbcType="VARCHAR"/>
        <result property="csjd" column="csjd" jdbcType="NUMERIC"/>
        <result property="cswd" column="cswd" jdbcType="NUMERIC"/>
        <result property="cszb" column="cszb" typeHandler="com.mosty.base.feign.handle.PolygonTypeHandler"/>
        <result property="cszbhash" column="cszbhash" jdbcType="VARCHAR"/>
        <result property="csdzxzqh" column="csdzxzqh" jdbcType="VARCHAR"/>
        <result property="csdz" column="csdz" jdbcType="VARCHAR"/>
        <result property="dqjd" column="dqjd" jdbcType="NUMERIC"/>
        <result property="dqwd" column="dqwd" jdbcType="NUMERIC"/>
        <result property="dqzb" column="dqzb" typeHandler="com.mosty.base.feign.handle.PolygonTypeHandler"/>
        <result property="dqzbhash" column="dqzbhash" jdbcType="VARCHAR"/>
        <result property="dqdzxzqh" column="dqdzxzqh" jdbcType="VARCHAR"/>
        <result property="dqdz" column="dqdz" jdbcType="VARCHAR"/>
        <result property="czkssj" column="czkssj" jdbcType="TIMESTAMP"/>
        <result property="czjssj" column="czjssj" jdbcType="TIMESTAMP"/>
        <result property="qcHx" column="qc_hx" jdbcType="INTEGER"/>
        <result property="qcJj" column="qc_jj" jdbcType="INTEGER"/>
        <result property="qcGz" column="qc_gz" jdbcType="INTEGER"/>
        <result property="qcGxcs" column="qc_gxcs" jdbcType="INTEGER"/>
        <result property="qcGxsj" column="qc_gxsj" jdbcType="TIMESTAMP"/>
        <result property="tpId" column="tp_id" jdbcType="VARCHAR"/>
        <result property="czzt" column="czzt" jdbcType="VARCHAR"/>
        <result property="czsm" column="czsm" 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="sssgajid" column="sssgajid" jdbcType="VARCHAR"/>
        <result property="ssxgajid" column="ssxgajid" jdbcType="VARCHAR"/>
        <result property="ssbmid" column="ssbmid" 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"/>
    </resultMap>

    <sql id="base_column_list">
        id
        ,yw_id,sj_fl,sj_jb,bjrxm,bjrlxdh,sj_fssj,sj_bt,sj_nr,csjd,cswd,ST_ASWKT (cszb) as cszb,cszbhash,csdzxzqh,csdz,dqjd,dqwd,
        ST_ASWKT (dqzb) as dqzb,dqzbhash,dqdzxzqh,dqdz,czkssj,czjssj,qc_hx,qc_jj,qc_gz,qc_gxcs,qc_gxsj,tp_id,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,ssbmid,ssxgajid,sssgajid,czzt,czsm
    </sql>

    <!--查询单个-->
    <select id="queryById" resultMap="TbSjMap">
        select
        <include refid="base_column_list"/>
        from tb_sj
        where id = #{id}
    </select>

    <!--新增所有列-->
    <insert id="insertEntity">
        insert into tb_sj(id, yw_id, sj_fl, sj_jb, bjrxm, bjrlxdh, sj_fssj, sj_bt, sj_nr, csjd, cswd, cszb, cszbhash,
                          csdzxzqh, csdz,ssbmid,ssxgajid,sssgajid,czzt,czsm,
                          dqjd, dqwd, dqzb, dqzbhash, dqdzxzqh, dqdz, czkssj, czjssj, qc_hx, qc_jj, qc_gz, qc_gxcs,
                          qc_gxsj,
                          tp_id, 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}, #{ywId}, #{sjFl}, #{sjJb}, #{bjrxm}, #{bjrlxdh}, #{sjFssj}, #{sjBt}, #{sjNr}, #{csjd}, #{cswd},
                ST_GEOMFROMTEXT(#{cszb,typeHandler = com.mosty.base.feign.handle.PolygonTypeHandler}),
                #{cszbhash}, #{csdzxzqh}, #{csdz},#{ssbmid},#{ssxgajid},#{sssgajid},#{czzt},#{czsm}, #{dqjd}, #{dqwd},
                ST_GEOMFROMTEXT(#{dqzb,typeHandler = com.mosty.base.feign.handle.PolygonTypeHandler}), #{dqzbhash},
                #{dqdzxzqh}, #{dqdz}, #{czkssj}, #{czjssj}, #{qcHx}, #{qcJj}, #{qcGz}, #{qcGxcs}, #{qcGxsj},
                #{tpId}, #{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm}, #{sssgaj}, #{sssgajdm}, #{xtSjly},
                #{xtSjzt}, #{xtScbz}, #{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr}, #{xtCjbmdm}, #{xtCjbmmc},
                #{xtZhgxip}, #{xtZhgxsj}, #{xtZhgxrid}, #{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz})
    </insert>

    <!--通过主键修改数据-->
    <update id="updateEntity">
        update tb_sj
        <set>
            <if test="ywId != null and ywId != ''">
                yw_id = #{ywId},
            </if>
            <if test="sjFl != null and sjFl != ''">
                sj_fl = #{sjFl},
            </if>
            <if test="sjJb != null and sjJb != ''">
                sj_jb = #{sjJb},
            </if>
            <if test="bjrxm != null and bjrxm != ''">
                bjrxm = #{bjrxm},
            </if>
            <if test="bjrlxdh != null and bjrlxdh != ''">
                bjrlxdh = #{bjrlxdh},
            </if>
            <if test="sjFssj != null">
                sj_fssj = #{sjFssj},
            </if>
            <if test="sjBt != null and sjBt != ''">
                sj_bt = #{sjBt},
            </if>
            <if test="sjNr != null and sjNr != ''">
                sj_nr = #{sjNr},
            </if>
            <if test="csjd != null">
                csjd = #{csjd},
            </if>
            <if test="cswd != null">
                cswd = #{cswd},
            </if>
            <if test="cszb != null">
                cszb = ST_GEOMFROMTEXT(#{cszb, typeHandler = com.mosty.base.feign.handle.PolygonTypeHandler}),
            </if>
            <if test="cszbhash != null and cszbhash != ''">
                cszbhash = #{cszbhash},
            </if>
            <if test="csdzxzqh != null and csdzxzqh != ''">
                csdzxzqh = #{csdzxzqh},
            </if>
            <if test="csdz != null and csdz != ''">
                csdz = #{csdz},
            </if>
            <if test="dqjd != null">
                dqjd = #{dqjd},
            </if>
            <if test="dqwd != null">
                dqwd = #{dqwd},
            </if>
            <if test="dqzb != null">
                dqzb = ST_GEOMFROMTEXT(#{dqzb, typeHandler = com.mosty.base.feign.handle.PolygonTypeHandler}),
            </if>
            <if test="dqzbhash != null and dqzbhash != ''">
                dqzbhash = #{dqzbhash},
            </if>
            <if test="dqdzxzqh != null and dqdzxzqh != ''">
                dqdzxzqh = #{dqdzxzqh},
            </if>
            <if test="dqdz != null and dqdz != ''">
                dqdz = #{dqdz},
            </if>
            <if test="czkssj != null">
                czkssj = #{czkssj},
            </if>
            <if test="czjssj != null">
                czjssj = #{czjssj},
            </if>
            <if test="qcHx != null">
                qc_hx = #{qcHx},
            </if>
            <if test="qcJj != null">
                qc_jj = #{qcJj},
            </if>
            <if test="qcGz != null">
                qc_gz = #{qcGz},
            </if>
            <if test="qcGxcs != null">
                qc_gxcs = #{qcGxcs},
            </if>
            <if test="qcGxsj != null">
                qc_gxsj = #{qcGxsj},
            </if>
            <if test="tpId != null and tpId != ''">
                tp_id = #{tpId},
            </if>
            <if test="czzt != null and czzt != ''">
                czzt = #{czzt},
            </if>
            <if test="czsm != null and czsm != ''">
                czsm = #{czsm},
            </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="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>
            <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>
        </set>
        where id = #{id}
    </update>

    <!--通过主键删除-->
    <delete id="deleteById">
        delete
        from tb_sj
        where id = #{id}
    </delete>

</mapper>


