<?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.ruoyi.cms.mapper.CompanyCardMapper">

    <resultMap type="CompanyCard" id="CompanyCardResult">
        <result property="companyCardId"    column="company_card_id"    />
        <result property="name"    column="name"    />
        <result property="targ"    column="targ"    />
        <result property="backgroudColor"    column="backgroud_color"    />
        <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"    />
        <result property="remark"    column="remark"    />
        <result property="status"    column="status"    />
        <result property="companyNature"    column="company_nature"    />
        <result property="cardOrder"    column="card_order"    />
        <result property="description"    column="description"    />
    </resultMap>

    <sql id="selectCompanyCardVo">
        select company_card_id, name, targ, backgroud_color, del_flag, create_by, create_time, update_by, update_time, remark,status,company_nature,card_order,description from company_card
    </sql>

    <select id="selectCompanyCardList" parameterType="CompanyCard" resultMap="CompanyCardResult">
        <include refid="selectCompanyCardVo"/>
        <where>  del_flag = '0'
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="targ != null  and targ != ''"> and targ = #{targ}</if>
            <if test="backgroudColor != null  and backgroudColor != ''"> and backgroud_color = #{backgroudColor}</if>
            <if test="companyNature != null  and companyNature != ''"> and company_nature = #{companyNature}</if>
            <if test="status != null"> and status = #{status}</if>
        </where>
    </select>
    <select id="selectCompanyCardListVO" resultType="com.ruoyi.cms.domain.vo.CompanyCardVO">
        <include refid="selectCompanyCardVo"/>
        <where>  del_flag = '0'
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="targ != null  and targ != ''"> and targ = #{targ}</if>
            <if test="backgroudColor != null  and backgroudColor != ''"> and backgroud_color = #{backgroudColor}</if>
            <if test="companyNature != null  and companyNature != ''"> and company_nature = #{companyNature}</if>
            <if test="status != null"> and status = #{status}</if>
        </where>
    </select>
</mapper>