| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?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.keao.edu.user.dao.ExamAgencyRelationDao">
-
- <resultMap type="com.keao.edu.user.entity.ExamAgencyRelation" id="ExamAgencyRelation">
- <result column="id_" property="id" />
- <result column="examination_basic_id_" property="examinationBasicId" />
- <result column="agency_id_" property="agencyId" />
- <result column="settlement_type_" property="settlementType" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
- <result column="share_profit_amount_" property="shareProfitAmount" />
- <result column="total_registration_student_num_" property="totalRegistrationStudentNum"/>
- <result column="total_payment_amount_" property="totalPaymentAmount"/>
- <result column="url_" property="url" />
- <result column="send_url_flag_" property="sendUrlFlag" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- <result column="tenant_id_" property="tenantId" />
- </resultMap>
- <resultMap id="ExamAgencyRelationExtraDto" type="com.keao.edu.user.dto.ExamAgencyRelationExtraDto" extends="ExamAgencyRelation">
- <result column="agency_name_" property="agencyName"/>
- </resultMap>
-
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="ExamAgencyRelation" >
- SELECT * FROM exam_agency_relation WHERE id_ = #{id}
- </select>
-
- <!-- 全查询 -->
- <select id="findAll" resultMap="ExamAgencyRelation">
- SELECT * FROM exam_agency_relation WHERE tenant_id_#{tenantId} ORDER BY id_
- </select>
-
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.keao.edu.user.entity.ExamAgencyRelation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- INSERT INTO exam_agency_relation (examination_basic_id_,agency_id_,settlement_type_,share_profit_amount_,total_registration_student_num_,total_payment_amount_,url_,send_url_flag_,create_time_,update_time_,tenant_id_)
- VALUES(#{examinationBasicId},#{agencyId},#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{shareProfitAmount},#{totalRegistrationStudentNum},#{totalPaymentAmount},#{url},#{sendUrlFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},NOW(),NOW(),#{tenantId})
- </insert>
- <insert id="batchInsert" parameterType="com.keao.edu.user.entity.ExamAgencyRelation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- INSERT INTO exam_agency_relation (examination_basic_id_,agency_id_,settlement_type_,share_profit_amount_,total_registration_student_num_,total_payment_amount_,url_,send_url_flag_,create_time_,update_time_,tenant_id_)
- VALUES
- <foreach collection="examAgencyRelations" item="examAgencyRelation" separator=",">
- (#{examAgencyRelation.examinationBasicId},#{examAgencyRelation.agencyId},#{examAgencyRelation.settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examAgencyRelation.shareProfitAmount},#{examAgencyRelation.totalRegistrationStudentNum},#{examAgencyRelation.totalPaymentAmount},#{examAgencyRelation.url},#{examAgencyRelation.sendUrlFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},NOW(),NOW(),#{examAgencyRelation.tenantId})
- </foreach>
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.keao.edu.user.entity.ExamAgencyRelation">
- UPDATE exam_agency_relation
- <set>
- <if test="examinationBasicId != null">
- examination_basic_id_ = #{examinationBasicId},
- </if>
- <if test="id != null">
- id_ = #{id},
- </if>
- <if test="sendUrlFlag != null">
- send_url_flag_ = #{sendUrlFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="url != null">
- url_ = #{url},
- </if>
- <if test="tenantId != null">
- tenant_id_ = #{tenantId},
- </if>
- <if test="updateTime != null">
- update_time_ = #{updateTime},
- </if>
- <if test="shareProfitAmount != null">
- share_profit_amount_ = #{shareProfitAmount},
- </if>
- <if test="totalRegistrationStudentNum != null">
- total_registration_student_num_ = #{totalRegistrationStudentNum},
- </if>
- <if test="totalPaymentAmount != null">
- total_payment_amount_ = #{totalPaymentAmount},
- </if>
- <if test="agencyId != null">
- agency_id_ = #{agencyId},
- </if>
- <if test="settlementType != null">
- settlement_type_ = #{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="createTime != null">
- create_time_ = #{createTime},
- </if>
- </set> WHERE id_ = #{id}
- </update>
- <update id="batchUpdateSendUrlFlag">
- UPDATE exam_agency_relation SET send_url_flag_=#{sendUrlFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
- WHERE examination_basic_id_=#{examId} AND agency_id_ IN
- <foreach collection="agencyIds" item="agencyId" separator="," open="(" close=")">
- #{agencyId}
- </foreach>
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete" >
- DELETE FROM exam_agency_relation WHERE id_ = #{id}
- </delete>
- <sql id="queryCondition">
- <where>
- ear.tenant_id_=#{tenantId}
- <if test="settlementType!=null">
- AND ear.settlement_type_=#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="search!=null">
- AND (ear.agency_id_=#{agencyId} OR a.name_ LIKE CONCAT(#{search}, '%'))
- </if>
- </where>
- </sql>
-
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="ExamAgencyRelationExtraDto" parameterType="map">
- SELECT
- ear.*,
- a.name_ agency_name_
- FROM agency a
- LEFT JOIN exam_agency_relation ear ON ear.agency_id_=a.id_
- <if test="examId!=null">
- AND ear.examination_basic_id_=#{examId}
- </if>
- <include refid="queryCondition"/>
- ORDER BY id_ <include refid="global.limit"/>
- </select>
-
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*) FROM agency a
- LEFT JOIN exam_agency_relation ear ON ear.agency_id_=a.id_
- <if test="examId!=null">
- AND ear.examination_basic_id_=#{examId}
- </if>
- <include refid="queryCondition"/>
- </select>
- <select id="getWithExam" resultMap="ExamAgencyRelation">
- SELECT * FROM exam_agency_relation WHERE examination_basic_id_=#{examId}
- </select>
- <select id="getAgencyIdsWithExam" resultType="int">
- SELECT agency_id_ FROM exam_agency_relation WHERE examination_basic_id_=#{examId} FOR UPDATE
- </select>
- </mapper>
|