<?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.bootdo.datas.dao.GyUnitDao">
    <select id="getGyUnitByCreditCode" resultType="com.bootdo.datas.domain.GyUnitDO">
        SELECT
            a.ID as id,
            a.REPORTER_UNIT as reporterUnit,
            a.CREDIT_CODE as creditCode,
            a.UNIT_CHARACTER as unitCharacter,
            a.INDUSTRY_TYPE_ONE as industryTypeOne,
            a.INDUSTRY_TYPE_TWO as industryTypeTwo,
            a.UNIT_PROVINCE as unitProvince,
            a.UNIT_CITY as unitCity,
            a.SUPERVISORY_ORG as supervisoryOrg,
            a.UNIT_MAN as unitMan,
            a.UNIT_OFFICE as unitOffice,
            a.DATA_SECURITY_MAN as dataSecurityMan,
            a.DATA_SECURITY_OFFICE as dataSecurityOffice,
            a.DATA_SECURITY_WAY as dataSecurityWay,
            a.CREATE_TIME as createTime,
            a.UPDATE_TIME as updateTime,
            a.audit_status as auditStatus,
            a.mobile_phone as mobilePhone
        from gy_unit a
            where
            a.STATUS = '0' and a.CREDIT_CODE = #{creditCode}
    </select>
    <select id="getGyUnit" resultType="java.lang.Integer">
        SELECT
            count(*)
        FROM gy_unit
        <where>
            STATUS = '0' and CREDIT_CODE = #{creditCode}
        </where>
    </select>

    <insert id="save" parameterType="com.bootdo.datas.domain.GyUnitDO" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
        insert into gy_unit
        (
         REPORTER_UNIT,
         CREDIT_CODE,
         UNIT_CHARACTER,
         INDUSTRY_TYPE_ONE,
         INDUSTRY_TYPE_TWO,
         UNIT_PROVINCE,
         UNIT_CITY,
         DATA_SECURITY_MAN,
         DATA_SECURITY_OFFICE,
         DATA_SECURITY_WAY,
         STATUS,
         CREATE_TIME,
         UPDATE_TIME,
         NOTE)
        values (
            #{reporterUnit},
            #{creditCode},
            #{unitCharacter},
            #{industryTypeOne},
            #{industryTypeTwo},
            #{unitProvince},
            #{unitCity},
            #{dataSecurityMan},
            #{dataSecurityOffice},
            #{dataSecurityWay},
            #{status},
            #{createTime},
            #{updateTime},
            #{note}
        )
    </insert>

</mapper>