TAttaInfoMapper.xml 5.08 KB
Newer Older
huyuchen's avatar
huyuchen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
<?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.yifu.cloud.plus.v1.yifu.social.mapper.TAttaInfoMapper">
      <resultMap id="tAttaInfoMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TAttaInfo">
            <id property="id" column="id"/>
            <result property="attaName" column="atta_name"/>
            <result property="attaSrc" column="atta_src"/>
            <result property="attaSize" column="atta_size"/>
            <result property="attaType" column="atta_type"/>
            <result property="createBy" column="create_by"/>
            <result property="createTime" column="create_time"/>
            <result property="relationType" column="relation_type"/>
            <result property="domainId" column="domain_id"/>
      </resultMap>
      <sql id="Base_Column_List">
                 a.id,
                      a.atta_name,
                      a.atta_src,
                      a.atta_size,
                      a.atta_type,
                      a.create_by,
                      a.create_time,
                      a.relation_type,
                      a.domain_id
      </sql>
      <sql id="tAttaInfo_where">
            <if test="tAttaInfo != null">
                <if test="tAttaInfo.id != null and tAttaInfo.id.trim() != ''">
                    AND a.id = #{tAttaInfo.id}
                </if>
                <if test="tAttaInfo.attaName != null and tAttaInfo.attaName.trim() != ''">
                    AND a.atta_name = #{tAttaInfo.attaName}
                </if>
                <if test="tAttaInfo.attaSrc != null and tAttaInfo.attaSrc.trim() != ''">
                    AND a.atta_src = #{tAttaInfo.attaSrc}
                </if>
                <if test="tAttaInfo.attaSize != null">
                    AND a.atta_size = #{tAttaInfo.attaSize}
                </if>
                <if test="tAttaInfo.attaType != null and tAttaInfo.attaType.trim() != ''">
                    AND a.atta_type = #{tAttaInfo.attaType}
                </if>
                <if test="tAttaInfo.createBy != null and tAttaInfo.createBy.trim() != ''">
                    AND a.create_by = #{tAttaInfo.createBy}
                </if>
                <if test="tAttaInfo.createTime != null">
                    AND a.create_time = #{tAttaInfo.createTime}
                </if>
                <if test="tAttaInfo.relationType != null and tAttaInfo.relationType.trim() != ''">
                    AND a.relation_type = #{tAttaInfo.relationType}
                </if>
                <if test="tAttaInfo.domainId != null and tAttaInfo.domainId.trim() != ''">
                    AND a.domain_id = #{tAttaInfo.domainId}
                </if>
            </if>
      </sql>
    <!--tAttaInfo简单分页查询-->
    <select id="getTAttaInfoPage" resultMap="tAttaInfoMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_atta_info a
        <where>
            1=1
            <include refid="tAttaInfo_where"/>
        </where>
    </select>

    <!--tAttaInfo 获取list-->
    <select id="getTAttaInfoList" resultMap="tAttaInfoMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_atta_info a
        <where>
            1=1
            <include refid="tAttaInfo_where"/>
        </where>
    </select>

    <!--根据domainId 获取list-->
    <select id="getTAttaInfoListByDoMainId" resultMap="tAttaInfoMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_atta_info a
        where a.domain_id = #{domainId}
    </select>

    <select id="getKeenAtta" resultMap="tAttaInfoMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_atta_info a
        <where>
            1=1
            <if test="values != null and values.size() > 0">
                and  a.domain_id in
                <foreach collection="values" item="param" index="index" open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
            and a.create_time >= #{dayStart}
            and a.relation_type in ("3","4")
        </where>
    </select>

	<update id="updateDomainId">
		update t_atta_info
		<trim prefix="set" suffixOverrides=",">
			domain_id=#{domainId}
		</trim>
		WHERE
		<if test="ids != null and ids.size() > 0">
			id in
			<foreach collection="ids" item="param" index="index" open="(" close=")" separator=",">
				#{param}
			</foreach>
		</if>
	</update>

	<select id="getAttaByApplyId" resultMap="tAttaInfoMap">
		SELECT
			<include refid="Base_Column_List"/>
		FROM t_atta_info a
		where EXISTS (select 1 from m_salary_prova_atta b where b.SALARY_PROVA_ID = #{applyId} and a.id = b.ATTA_ID);
	</select>

	<delete id="deleteByDomainId">
		delete from t_atta_info where domain_id=#{domainId}
	</delete>

	<delete id="deleteByDomainIdAndType">
		delete from t_atta_info where domain_id=#{domainId} and relation_type = #{relationType}
	</delete>

	<delete id="deleteByDomainIdAndOther">
		delete from t_atta_info where domain_id=#{domainId} and relation_type not in ('0','2','26','27')
	</delete>

</mapper>