• 徐俊's avatar
    xujun · 602d9030
    徐俊 authored
    602d9030
ComPersonScientificGainDAO.xml 2.17 KB
<?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.yiboshi.science.dao.ComPersonScientificGainDAO">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.yiboshi.science.entity.ComPersonScientificGain">
        <id column="id" property="id"/>
        <result column="gain_type" property="gainType"/>
        <result column="gain_date" property="gainDate"/>
        <result column="gain_name" property="gainName"/>
        <result column="gain_description" property="gainDescription"/>
        <result column="gain_remark" property="gainRemark"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="create_user" property="createUser"/>
        <result column="update_user" property="updateUser"/>
        <result column="del_flag" property="delFlag"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, gain_type, gain_date, gain_name, gain_description, gain_remark,
        create_time, update_time, create_user, update_user, del_flag
    </sql>

    <!-- 分页查询 -->
    <select id="selectPage" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM com_person_scientific_gain
        WHERE del_flag = 0
        <if test="query.gainType != null and query.gainType != ''">
            AND gain_type = #{query.gainType}
        </if>
        <if test="query.gainName != null and query.gainName != ''">
            AND gain_name LIKE CONCAT('%', #{query.gainName}, '%')
        </if>
        ORDER BY gain_date DESC
    </select>

    <select id="getListByTalentId" parameterType="java.lang.String" resultType="com.yiboshi.science.param.dto.ComPersonScientificGainDTO">
        SELECT a.*,b.name as gainTypeName,b.code,b.gb_code type,b.tree_code level,b.system_code
        FROM com_person_scientific_gain a
            left join system_parameter b on a.gain_type = b.id and b.type_id = 19
        where talent_id=#{talentId} order by a.gain_type, a.show_index asc
    </select>
</mapper>