<?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.engine.organization.mapper.personnelcard.CardButtonMapper">
    <resultMap id="BaseResultMap" type="com.engine.organization.entity.personnelcard.po.CardButtonPO">
        <result column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="status" property="status"/>
        <result column="url" property="url"/>
        <result column="roles" property="roles"/>
        <result column="sys_default" property="sysDefault"/>
        <result column="show_order" property="showOrder"/>
        <result column="open" property="open"/>
        <result column="creator" property="creator"/>
        <result column="delete_type" property="deleteType"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>


    <!-- 表字段 -->
    <sql id="baseColumns">
        t
        .
        id
        , t.name
        , t.status
        , t.url
        , t.roles
        , t.sys_default
        , t.show_order
        , t.open
        , t.creator
        , t.delete_type
        , t.create_time
        , t.update_time
    </sql>
    <delete id="deleteByIds">
        delete from jcl_org_cardbutton where id in
        <foreach collection="ids" open="(" item="id" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <select id="listAll" resultType="com.engine.organization.entity.personnelcard.po.CardButtonPO">
        select
        <include refid="baseColumns"/>
        from jcl_org_cardbutton t where t.delete_type = 0 order by t.show_order
    </select>

    <select id="listEnableButton" resultType="com.engine.organization.entity.personnelcard.po.CardButtonPO">
        select
        <include refid="baseColumns"/>
        from jcl_org_cardbutton t where t.delete_type = 0 and t.status = 1 order by t.show_order
    </select>
    <select id="listAllId" resultType="java.lang.Long">
        select t.id
        from jcl_org_cardbutton t
        where t.delete_type = 0
    </select>

</mapper>