CreditGlobalEntityMapper.xml 13.8 KB
<?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.credit.cy.business.mapper.CreditGlobalEntityMapper">
    
    <resultMap type="CreditGlobalEntity" id="CreditGlobalEntityResult">
        <result property="id"    column="id"    />
        <result property="creditName"    column="credit_name"    />
        <result property="creditCode"    column="credit_code"    />
        <result property="creditType"    column="credit_type"    />
        <result property="registerCode"    column="register_code"    />
        <result property="orgCode"    column="org_code"    />
        <result property="taxCode"    column="tax_code"    />
        <result property="sectorCode"    column="sector_code"    />
        <result property="societyCode"    column="society_code"    />
        <result property="dataSource"    column="data_source"    />
        <result property="runStatus"    column="run_status"    />
        <result property="belongIndustry"    column="belong_industry"    />
        <result property="foundDate"    column="found_date"    />
        <result property="companyType"    column="company_type"    />
        <result property="runExpire"    column="run_expire"    />
        <result property="delegate"    column="delegate"    />
        <result property="auditDate"    column="audit_date"    />
        <result property="registerFund"    column="register_fund"    />
        <result property="registerParty"    column="register_party"    />
        <result property="registerAddr"    column="register_addr"    />
        <result property="runRange"    column="run_range"    />
        <result property="dataStatus"    column="data_status"    />
        <result property="dataMsg"    column="data_msg"    />
        <result property="dataRef"    column="data_ref"    />
        <result property="reportDate"    column="report_date"    />
        <result property="readCount"    column="read_count"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectCreditGlobalEntityVo">
        select id, credit_name, credit_code, credit_type, register_code, org_code, tax_code, sector_code, society_code, data_source, run_status, belong_industry, found_date, company_type, run_expire, delegate, audit_date, register_fund, register_party, register_addr, run_range, data_status, data_msg, data_ref, report_date, read_count, del_flag, create_by, create_time, update_by, update_time from credit_global_entity
    </sql>

    <select id="selectCreditGlobalEntityList" parameterType="CreditGlobalEntity" resultMap="CreditGlobalEntityResult">
        <include refid="selectCreditGlobalEntityVo"/>
        <where>  
            <if test="creditName != null  and creditName != ''"> and credit_name like concat('%', #{creditName}, '%')</if>
            <if test="creditCode != null  and creditCode != ''"> and credit_code = #{creditCode}</if>
            <if test="creditType != null  and creditType != ''"> and credit_type = #{creditType}</if>
            <if test="registerCode != null  and registerCode != ''"> and register_code = #{registerCode}</if>
            <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if>
            <if test="taxCode != null  and taxCode != ''"> and tax_code = #{taxCode}</if>
            <if test="sectorCode != null  and sectorCode != ''"> and sector_code = #{sectorCode}</if>
            <if test="societyCode != null  and societyCode != ''"> and society_code = #{societyCode}</if>
            <if test="dataSource != null  and dataSource != ''"> and data_source = #{dataSource}</if>
            <if test="runStatus != null  and runStatus != ''"> and run_status = #{runStatus}</if>
            <if test="belongIndustry != null  and belongIndustry != ''"> and belong_industry = #{belongIndustry}</if>
            <if test="foundDate != null "> and found_date = #{foundDate}</if>
            <if test="companyType != null  and companyType != ''"> and company_type = #{companyType}</if>
            <if test="runExpire != null "> and run_expire = #{runExpire}</if>
            <if test="delegate != null  and delegate != ''"> and delegate = #{delegate}</if>
            <if test="auditDate != null "> and audit_date = #{auditDate}</if>
            <if test="registerFund != null "> and register_fund = #{registerFund}</if>
            <if test="registerParty != null  and registerParty != ''"> and register_party = #{registerParty}</if>
            <if test="registerAddr != null  and registerAddr != ''"> and register_addr = #{registerAddr}</if>
            <if test="runRange != null  and runRange != ''"> and run_range = #{runRange}</if>
            <if test="dataStatus != null "> and data_status = #{dataStatus}</if>
            <if test="dataMsg != null  and dataMsg != ''"> and data_msg = #{dataMsg}</if>
            <if test="dataRef != null "> and data_ref = #{dataRef}</if>
            <if test="reportDate != null "> and report_date = #{reportDate}</if>
        </where>
    </select>
    
    <select id="selectCreditGlobalEntityById" parameterType="Long" resultMap="CreditGlobalEntityResult">
        <include refid="selectCreditGlobalEntityVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertCreditGlobalEntity" parameterType="CreditGlobalEntity" useGeneratedKeys="true" keyProperty="id">
        insert into credit_global_entity
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="creditName != null and creditName != ''">credit_name,</if>
            <if test="creditCode != null and creditCode != ''">credit_code,</if>
            <if test="creditType != null and creditType != ''">credit_type,</if>
            <if test="registerCode != null">register_code,</if>
            <if test="orgCode != null">org_code,</if>
            <if test="taxCode != null">tax_code,</if>
            <if test="sectorCode != null">sector_code,</if>
            <if test="societyCode != null">society_code,</if>
            <if test="dataSource != null">data_source,</if>
            <if test="runStatus != null">run_status,</if>
            <if test="belongIndustry != null">belong_industry,</if>
            <if test="foundDate != null">found_date,</if>
            <if test="companyType != null">company_type,</if>
            <if test="runExpire != null">run_expire,</if>
            <if test="delegate != null">delegate,</if>
            <if test="auditDate != null">audit_date,</if>
            <if test="registerFund != null">register_fund,</if>
            <if test="registerParty != null">register_party,</if>
            <if test="registerAddr != null">register_addr,</if>
            <if test="runRange != null">run_range,</if>
            <if test="dataStatus != null">data_status,</if>
            <if test="dataMsg != null">data_msg,</if>
            <if test="dataRef != null">data_ref,</if>
            <if test="reportDate != null">report_date,</if>
            <if test="readCount != null">read_count,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="creditName != null and creditName != ''">#{creditName},</if>
            <if test="creditCode != null and creditCode != ''">#{creditCode},</if>
            <if test="creditType != null and creditType != ''">#{creditType},</if>
            <if test="registerCode != null">#{registerCode},</if>
            <if test="orgCode != null">#{orgCode},</if>
            <if test="taxCode != null">#{taxCode},</if>
            <if test="sectorCode != null">#{sectorCode},</if>
            <if test="societyCode != null">#{societyCode},</if>
            <if test="dataSource != null">#{dataSource},</if>
            <if test="runStatus != null">#{runStatus},</if>
            <if test="belongIndustry != null">#{belongIndustry},</if>
            <if test="foundDate != null">#{foundDate},</if>
            <if test="companyType != null">#{companyType},</if>
            <if test="runExpire != null">#{runExpire},</if>
            <if test="delegate != null">#{delegate},</if>
            <if test="auditDate != null">#{auditDate},</if>
            <if test="registerFund != null">#{registerFund},</if>
            <if test="registerParty != null">#{registerParty},</if>
            <if test="registerAddr != null">#{registerAddr},</if>
            <if test="runRange != null">#{runRange},</if>
            <if test="dataStatus != null">#{dataStatus},</if>
            <if test="dataMsg != null">#{dataMsg},</if>
            <if test="dataRef != null">#{dataRef},</if>
            <if test="reportDate != null">#{reportDate},</if>
            <if test="readCount != null">#{readCount},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateCreditGlobalEntity" parameterType="CreditGlobalEntity">
        update credit_global_entity
        <trim prefix="SET" suffixOverrides=",">
            <if test="creditName != null and creditName != ''">credit_name = #{creditName},</if>
            <if test="creditCode != null and creditCode != ''">credit_code = #{creditCode},</if>
            <if test="creditType != null and creditType != ''">credit_type = #{creditType},</if>
            <if test="registerCode != null">register_code = #{registerCode},</if>
            <if test="orgCode != null">org_code = #{orgCode},</if>
            <if test="taxCode != null">tax_code = #{taxCode},</if>
            <if test="sectorCode != null">sector_code = #{sectorCode},</if>
            <if test="societyCode != null">society_code = #{societyCode},</if>
            <if test="dataSource != null">data_source = #{dataSource},</if>
            <if test="runStatus != null">run_status = #{runStatus},</if>
            <if test="belongIndustry != null">belong_industry = #{belongIndustry},</if>
            <if test="foundDate != null">found_date = #{foundDate},</if>
            <if test="companyType != null">company_type = #{companyType},</if>
            <if test="runExpire != null">run_expire = #{runExpire},</if>
            <if test="delegate != null">delegate = #{delegate},</if>
            <if test="auditDate != null">audit_date = #{auditDate},</if>
            <if test="registerFund != null">register_fund = #{registerFund},</if>
            <if test="registerParty != null">register_party = #{registerParty},</if>
            <if test="registerAddr != null">register_addr = #{registerAddr},</if>
            <if test="runRange != null">run_range = #{runRange},</if>
            <if test="dataStatus != null">data_status = #{dataStatus},</if>
            <if test="dataMsg != null">data_msg = #{dataMsg},</if>
            <if test="dataRef != null">data_ref = #{dataRef},</if>
            <if test="reportDate != null">report_date = #{reportDate},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCreditGlobalEntityById" parameterType="Long">
        delete from credit_global_entity where id = #{id}
    </delete>

    <delete id="deleteCreditGlobalEntityByIds" parameterType="String">
        delete from credit_global_entity where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <select id="selectInfoList" parameterType="CreditGlobalEntity" resultMap="CreditGlobalEntityResult">
        <include refid="selectCreditGlobalEntityVo"/> where del_flag = '0' and data_status = 1
        <if test="creditName != null  and creditName != ''"> and credit_name like concat('%',#{creditName}, '%')</if>
        <if test="creditCode != null  and creditCode != ''"> and credit_code like concat('%',#{creditCode}, '%')</if>
        <if test="creditType != null  and creditType != ''"> and credit_type = #{creditType}</if>
        <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
            AND date_format(found_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
        </if>
        <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
            AND date_format(found_date,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>

    <select id="selectExistsGlobalEntityList" parameterType="CreditGlobalEntity" resultMap="CreditGlobalEntityResult">
        <include refid="selectCreditGlobalEntityVo"/> where del_flag = '0' and data_status = 1
        <if test="creditName != null  and creditName != ''"> and credit_name = #{creditName}</if>
        <if test="creditCode != null  and creditCode != ''"> and credit_code = #{creditCode}</if>
        <if test="creditType != null  and creditType != ''"> and credit_type = #{creditType}</if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>
</mapper>