<?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="org.springblade.modules.dictBszn.mapper.DictBsznMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="dictBsznResultMap" type="org.springblade.modules.dictBszn.pojo.entity.DictBsznEntity">
        <result column="parent_id" property="parentId"/>
        <result column="dict_value" property="dictValue"/>
        <result column="sxlx" property="sxlx"/>
        <result column="xzcj" property="xzcj"/>
        <result column="fdsx" property="fdsx"/>
        <result column="cnsx" property="cnsx"/>
        <result column="bjlx" property="bjlx"/>
        <result column="spjglx" property="spjglx"/>
        <result column="spjgmc" property="spjgmc"/>
        <result column="sltj" property="sltj"/>
        <result column="sdyj" property="sdyj"/>
        <result column="sfsf" property="sfsf"/>
        <result column="sfbz" property="sfbz"/>
        <result column="sfyj" property="sfyj"/>
        <result column="sqcl" property="sqcl"/>
        <result column="bllc" property="bllc"/>
    </resultMap>

    <select id="selectDictBsznPage" resultMap="dictBsznResultMap">
        select * from dict_bszn where is_deleted = 0
    </select>

    <select id="exportDictBszn" resultType="org.springblade.modules.dictBszn.excel.DictBsznExcel">
        SELECT * FROM dict_bszn ${ew.customSqlSegment}
    </select>

    <select id="selectListByMc" resultMap="dictBsznResultMap">
        select * from jdrh.dict_bszn where status = '2' and dict_value like '%' || #{dictValue} || '%' order by id
    </select>

    <select id="detailById" resultMap="dictBsznResultMap">
        select * from jdrh.dict_bszn where parent_id = #{id}
    </select>

    <select id="selectTop" resultType="org.springblade.modules.dictBszn.pojo.vo.BsznVO">
        select
            id as value,
            dict_value as label
        from jdrh.dict_bszn
        where parent_id = 0 and dict_value != '详情' order by id
    </select>

    <select id="selectOneList" resultType="org.springblade.modules.dictBszn.pojo.vo.BsznVO">
        select
            id as value,
            dict_value as label
        from jdrh.dict_bszn
        where parent_id = #{value} :: int8 and dict_value != '详情' order by id
    </select>
</mapper>
