| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 | 
							- <?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.ym.mec.biz.dal.dao.ReplacementInstrumentCooperationDao">
 
-     <resultMap id="ReplacementInstrumentCooperation" type="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation">
 
-         <!--@mbg.generated-->
 
-         <!--@Table replacement_instrument_cooperation-->
 
-         <result column="id_" property="id"/>
 
-         <result column="organ_id_" property="organId"/>
 
-         <result column="cooperation_organ_id_" property="cooperationOrganId"/>
 
-         <result column="topic_id_" property="topicId"/>
 
-         <result column="topic_title_" property="topicTitle"/>
 
-         <result column="open_pay_" property="openPay" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
-         <result column="show_question_" property="showQuestion" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
-         <result column="organName" property="organName"/>
 
-         <result column="cooperationOrganName" property="cooperationOrganName"/>
 
-         <result column="create_time_" property="createTime"/>
 
-         <result column="update_time_" property="updateTime"/>
 
-     </resultMap>
 
-     <!-- 根据主键查询一条记录 -->
 
-     <select id="get" resultMap="ReplacementInstrumentCooperation">
 
-         SELECT *
 
-         FROM replacement_instrument_cooperation
 
-         WHERE id_ = #{id}
 
-     </select>
 
-     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation"
 
-             useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 
-         <!--@mbg.generated-->
 
-         insert into replacement_instrument_cooperation (organ_id_, cooperation_organ_id_, open_pay_,show_question_,topic_id_, create_time_,
 
-         update_time_
 
-         )
 
-         values (#{organId}, #{cooperationOrganId},
 
-         #{openPay,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{showQuestion,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-         #{topicId}, #{createTime}, #{updateTime}
 
-         )
 
-     </insert>
 
-     <delete id="delete">
 
-         <!--@mbg.generated-->
 
-         delete from replacement_instrument_cooperation WHERE id_ = #{id}
 
-     </delete>
 
-     <update id="update" parameterType="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation">
 
-         <!--@mbg.generated-->
 
-         update replacement_instrument_cooperation
 
-         <set>
 
-             <if test="topicId != null">
 
-                 topic_id_ = #{topicId},
 
-             </if>
 
-             <if test="organId != null">
 
-                 organ_id_ = #{organId},
 
-             </if>
 
-             <if test="cooperationOrganId != null">
 
-                 cooperation_organ_id_ = #{cooperationOrganId},
 
-             </if>
 
-             <if test="openPay != null">
 
-                 open_pay_ = #{openPay,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-             </if>
 
-             <if test="updateTime != null">
 
-                 update_time_ = NOW(),
 
-             </if>
 
-         </set>
 
-         WHERE id_ = #{id}
 
-     </update>
 
-     <!-- 分页查询 -->
 
-     <select id="queryPage" resultMap="ReplacementInstrumentCooperation" parameterType="map">
 
-         SELECT ric.*,o.name_ organName,co.name_ cooperationOrganName,qt.title_ topic_title_ FROM replacement_instrument_cooperation ric
 
-         LEFT JOIN cooperation_organ co ON co.id_ = ric.cooperation_organ_id_
 
-         LEFT JOIN organization o ON o.id_ = ric.organ_id_
 
-         LEFT JOIN questionnaire_topic qt ON qt.id_ = ric.topic_id_
 
-         <include refid="queryPageSql"/>
 
-         ORDER BY ric.id_ DESC
 
-         <include refid="global.limit"/>
 
-     </select>
 
-     <sql id="queryPageSql">
 
-         <where>
 
-             <if test="organId != null">
 
-                 AND FIND_IN_SET(ric.organ_id_ , #{organId})
 
-             </if>
 
-             <if test="openPay != null">
 
-                 AND ric.open_pay_ = #{openPay,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 
-             </if>
 
-             <if test="showQuestion != null">
 
-                 AND ric.show_question_ = #{showQuestion,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 
-             </if>
 
-             <if test="search != null and search != ''">
 
-                 AND (ric.cooperation_organ_id_ = #{search} OR co.name_ LIKE CONCAT('%',#{search},'%'))
 
-             </if>
 
-         </where>
 
-     </sql>
 
-     <!-- 查询当前表的总记录数 -->
 
-     <select id="queryCount" resultType="int">
 
-         SELECT COUNT(*) FROM replacement_instrument_cooperation ric
 
-         LEFT JOIN cooperation_organ co ON co.id_ = ric.cooperation_organ_id_
 
-         <include refid="queryPageSql"/>
 
-     </select>
 
-     <select id="getByCooperationId" resultMap="ReplacementInstrumentCooperation">
 
-         SELECT *
 
-         FROM replacement_instrument_cooperation
 
-         WHERE cooperation_organ_id_ = #{cooperationId}
 
-     </select>
 
-     <select id="countAllReplacementsInfo" resultType="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation">
 
-         SELECT cooperation_organ_id_              cooperationOrganId,
 
-                COUNT(*)                           activeNum,
 
-                SUM(IF(instruments_id_ > 0, 1, 0)) replaceNum,
 
-                SUM(IF(pay_status_ = 2, 1, 0)) payNum
 
-         FROM replacement_instrument_activity
 
-         GROUP BY cooperation_organ_id_
 
-     </select>
 
- </mapper>
 
 
  |