<?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="cn.cecep.talroad.mapper.PcIndustryMapper">

    <resultMap type="cn.cecep.talroad.domain.PcIndustry" id="PcIndustryResult">
        <result property="id"    column="id"    />
        <result property="indusCode"    column="indus_code"    />
        <result property="indusName"    column="indus_name"    />
    </resultMap>


    <sql id="selectPcIndustryVo">
        select id, indus_code, indus_name from pc_industry
    </sql>

    <select id="selectPcIndustryList" parameterType="cn.cecep.talroad.domain.PcIndustry" resultMap="PcIndustryResult">
        <include refid="selectPcIndustryVo"/>
        <where>
            <if test="indusCode != null  and indusCode != ''"> and indus_code = #{indusCode}</if>
            <if test="indusName != null  and indusName != ''"> and indus_name like concat('%', #{indusName}, '%')</if>
        </where>
        ORDER BY order_num asc
    </select>

    <select id="industryPermissionList" resultMap="PcIndustryResult">
        SELECT industry_permission_name indus_code,industry_permission_name indus_name from pc_factory
        <where>
             industry_permission_name is not null
            <if test="indusCode != null  and indusCode != ''"> and industry_permission_name  like concat('%', #{indusCode}, '%')</if>
            <if test="indusName != null  and indusName != ''"> and industry_permission_name like concat('%', #{indusName}, '%')</if>
        </where>
        GROUP BY industry_permission_name order by industry_permission_name
    </select>
</mapper>
