<?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.ltgk.catches.mapper.TcFishLimitAllocationMapper">
    <resultMap id="BaseResultMap" type="com.ltgk.catches.domain.entity.TcFishLimitAllocation">
        <!--@mbg.generated-->
        <!--@Table tc_fish_limit_allocation-->
        <id column="id" jdbcType="VARCHAR" property="id"/>
        <result column="boat_id" jdbcType="VARCHAR" property="boatId"/>
        <result column="boat_name" jdbcType="VARCHAR" property="boatName"/>
        <result column="set_id" jdbcType="VARCHAR" property="setId"/>
        <result column="aquatic_dict_id" jdbcType="BIGINT" property="aquaticDictId"/>
        <result column="aquatic_dict_code" jdbcType="VARCHAR" property="aquaticDictCode"/>
        <result column="aquatic_dict_name" jdbcType="VARCHAR" property="aquaticDictName"/>
        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
        <result column="area_code" jdbcType="VARCHAR" property="areaCode"/>
        <result column="area_name" jdbcType="VARCHAR" property="areaName"/>
        <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
        <result column="create_at" jdbcType="TIMESTAMP" property="createAt"/>
        <result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
        <result column="update_at" jdbcType="TIMESTAMP" property="updateAt"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
        <result column="fish_limit" jdbcType="BIGINT" property="fishLimit"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, boat_id, boat_name, set_id, del_flag, area_code, area_name, create_by, create_at,
        update_by, update_at, remark, fish_limit
    </sql>

    <select id="getFishLimitAllocationVo" resultType="com.ltgk.catches.domain.vo.FishLimitAllocationVo">
        select t.id,t.boat_id as boatId,t.boat_name as boatName,t.set_id as setId,t.area_code as areaCode,
        t.area_name as areaName,t.fish_limit as fishLimit,s.title as setTitle,
        t.aquatic_dict_id as aquaticDictId, t.aquatic_dict_code as aquaticDictCode, t.aquatic_dict_name as
        aquaticDictName
        from tc_fish_limit_allocation as t
        left join tc_fish_limit_set as s on t.set_id = s.id
        where
        t.del_flag = 0
        <if test="boatName != null and boatName != ''">
            and t.boat_name like concat('%',#{boatName},'%')
        </if>
        <if test="aquaticDictId != null and aquaticDictId != ''">
            and t.aquatic_dict_id = #{aquaticDictId}
        </if>
    </select>
</mapper>