<?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.sky.scientific.mapper.YsZjtrfyMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="ResultMap" type="org.sky.scientific.pojo.entity.YsZjtrfyEntity">
        <result column="id" property="id"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="XM_ID" property="xmId"/>
        <result column="WZMC" property="wzmc"/>
        <result column="yong_liang" property="yongLiang"/>
        <result column="dan_jia" property="danJia"/>
        <result column="YQSBMC" property="yqsbmc"/>
        <result column="YSJE" property="ysje"/>
        <result column="GDZCMC" property="gdzcmc"/>
        <result column="ZLFYYS" property="zlfyys"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>

    <resultMap id="ResultVoMap" type="org.sky.scientific.pojo.vo.YsZjtrfyVO" extends="ResultMap">

    </resultMap>

    <delete id="physicalDeleteByIds">
        DELETE FROM kd_ys_zjtrfy
        WHERE id IN
        <foreach item="id" collection="list" separator="," close=")" open="(" index="">
            #{id}
        </foreach>
    </delete>

    <select id="selectYsZjtrfyPage" resultMap="ResultVoMap">
        select
            id,XM_ID,WZMC,ifnull(yong_liang,0) as yong_liang ,ifnull(dan_jia,0) as dan_jia,YQSBMC,ifnull(YSJE,0) as YSJE,GDZCMC,ifnull(ZLFYYS,0) as ZLFYYS
        from kd_ys_zjtrfy
        where is_deleted = 0
        <if test="ysZjtrfy.xmId!=null">and XM_ID = #{ysZjtrfy.xmId}</if>
    </select>
</mapper>
