<?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.wzzx.mapper.TbSjCyjlMapper">

    <resultMap id="BaseResultMap" type="com.mosty.base.model.entity.sjzx.TbSjCyjl">
        <id column="id" property="id" jdbcType="VARCHAR"/>
        <result column="sj_id" property="sjId"/>
        <result column="bb_id" property="bbId"/>
        <result column="jl_id" property="jlId"/>
        <result column="jl_sfzh" property="jlSfzh"/>
        <result column="jl_xm" property="jlXm"/>
        <result column="jl_lxdh" property="jlLxdh"/>
        <result column="sdzlsj" property="sdzlsj"/>
        <result column="qszlsj" property="qszlsj"/>
        <result column="ddxcsj" property="ddxcsj"/>
        <result column="jssj" property="jssj"/>
        <result column="mjfj" property="mjfj"/>
        <result column="sfzyjz" property="sfzyjz"/>
        <result column="zybqdm" property="zybqdm"/>
        <result column="zybq" property="zybq"/>
        <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="jlzt" property="jlzt"/>
        <result column="tp_id" property="tpId"/>
        <result column="ssbm" property="ssbm"/>
        <result column="ssbmdm" property="ssbmdm"/>
        <result column="ssxgaj" property="ssxgaj"/>
        <result column="ssxgajdm" property="ssxgajdm"/>
        <result column="sssgaj" property="sssgaj"/>
        <result column="sssgajdm" property="sssgajdm"/>
        <result property="sssgajid" column="sssgajid" jdbcType="VARCHAR"/>
        <result property="ssxgajid" column="ssxgajid" jdbcType="VARCHAR"/>
        <result property="ssbmid" column="ssbmid" jdbcType="VARCHAR"/>
        <result column="bz" property="bz"/>
        <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="TIMESTAMP"/>
        <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="TIMESTAMP"/>
        <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, sj_id, bb_id, jl_id, jl_sfzh, jl_xm, jl_lxdh, sdzlsj, qszlsj, ddxcsj,
        jssj, mjfj, sfzyjz, zybqdm, zybq, dqwz, jd, wd, zbhash, zbsj, jlzt, tp_id,
        ssbm, ssbmdm, ssxgaj, ssxgajdm, 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,ssbmid,ssxgajid,sssgajid,bz
    </sql>

    <sql id="zb_sql">
        ST_ASWKT
        (zb) as zb
    </sql>

    <!--身份证号码查询-->
    <select id="queryBySfzh" resultMap="BaseResultMap">
        select
        <include refid="base_column_list"/>,
        <include refid="zb_sql"/>
        from mosty_sjzx.tb_sj_cyjl
        where xt_scbz = '0' and jssj is null and jl_sfzh = #{sfzh,jdbcType=VARCHAR}
    </select>

    <!--更新坐标-->
    <update id="updateZb">
        update mosty_sjzx.tb_sj_cyjl
        <set>
            <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="dqwz != null and dqwz != ''">
                dqwz = #{dqwz},
            </if>
            <if test="zbsj != null">
                zbsj = #{zbsj},
            </if>
        </set>
        where id = #{id}
    </update>

</mapper>
