resultMap
<resultMap type="com.pb.party.entity.PbPartyDepartment" id="PbPartyDepartmentMap">    <result property="id" column="id" jdbcType="INTEGER"/>    <result property="name" column="name" jdbcType="VARCHAR"/>    <result property="creationTime" column="creation_time" jdbcType="TIMESTAMP"/>    <result property="introduction" column="introduction" jdbcType="LONGVARCHAR"/>    <result property="xCoordinate" column="x_coordinate" jdbcType="DOUBLE"/>    <result property="yCoordinate" column="y_coordinate" jdbcType="DOUBLE"/>    <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>    <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>    <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>    <association property="project" javaType="com.pb.party.entity.PbProject" column="{id=project_id}" select="com.pb.party.mapper.PbProjectMapper.selectOneById"></association>    <association property="parent" javaType="com.pb.party.entity.PbPartyDepartment" column="{id=parent_id}" select="com.pb.party.mapper.PbPartyDepartmentMapper.selectOneById1"></association>    <collection property="files" javaType="java.util.ArrayList" column="{ids=file_id}" ofType="com.pb.party.entity.PbFile" select="com.pb.party.mapper.PbFileMapper.selectListId"></collection><collection property="files" javaType="java.util.List" column="{ids=file_id}"            ofType="com.pb.projects.entity.PbFile" select="com.pb.projects.mapper.PbFileMapper.selectListId"></collection><association property="file" javaType="com.pb.projects.entity.PbFile" column="{id=file_id}" select="com.pb.projects.mapper.PbFileMapper.selectOneById"></association></resultMap>
<resultMap type="com.pb.projects.vo.line.ResearchAchievementVo" id="researchAchievementMap">    <result property="ids" column="ids" jdbcType="VARCHAR"/>    <result property="type" column="type" jdbcType="VARCHAR"/>    <collection property="researchAchievementSecVos" javaType="java.util.List" column="{ids=ids}" ofType="com.pb.projects.vo.line.ResearchAchievementSecVo" select="com.pb.projects.mapper.PbProSubResearchMapper.selectResearchAchievementSec"></collection></resultMap>
<resultMap type="com.pb.projects.vo.line.ResearchAchievementSecVo" id="ResearchAchievementSecVo">    <result property="ResearchAchievementId" column="ResearchAchievementId" jdbcType="VARCHAR"/>    <result property="ResearchAchievementName" column="ResearchAchievementName" jdbcType="VARCHAR"/>    <collection property="files" javaType="java.util.List" column="{ids=file_id}"                ofType="com.pb.projects.entity.PbFile" select="com.pb.projects.mapper.PbFileMapper.selectListId"></collection></resultMap>
select
<select id="selectPageById" resultType="com.pb.party.entity.PbPartyDepartment">        SELECT        *        from        pb_party_department        WHERE        pb_party_department.project_id=#{projectId}        AND pb_party_department.del_flag= 0</select><select id="selectAllByPage" resultType="com.pb.party.entity.PbPartyDepartment">        SELECT        *        from        pb_party_department        WHERE        pb_party_department.del_flag= 0</select>
<select id="problemPinNumber" resultType="com.pb.projects.entity.PbProProblem">        SELECT        pb_pro_sub.alias,        pb_pro_sub.`name`,        pb_pro_problem.*    FROM        pb_pro_problem        LEFT JOIN pb_pro_sub ON pb_pro_sub.id = pb_pro_problem.pro_sub_id    WHERE        pb_pro_sub.id = #{proSubId}</select>
<!-- 换流站 待建/在建-换流容量 --><select id="selectSubCommutationCapacity" resultType="java.util.Map">    SELECT    IFNULL(SUM(pro.capacity),0) AS 'capacity'    FROM    pb_pro pro    LEFT JOIN pb_pro_sub sub ON sub.parent_code = pro.`code`    <include refid="whereSql"></include></select>
<select id="selectAll" resultMap="PbOrganizationalLifeMap">    SELECT        life.*    FROM        pb_organizational_life life    <where>        life.del_flag = 0        <if test="partyId != null">            AND life.party_department_id = #{partyId}        </if>        <if test="title!='' and title!=null">            AND life.title LIKE CONCAT('%',#{title},'%')        </if>        <if test="title!='' and title!=null">            OR life.content LIKE CONCAT('%',#{title},'%')        </if>    </where></select>
<!--综合管理-科研管理列表--><select id="scientificResearchManagement" resultType="com.pb.projects.vo.integratedmanagement.PbProResearchVo">    SELECT        pro.type,        pro.`code`,        pro.`name`,        pro.alias,        IFNULL( COUNT( DISTINCT research.id ), 0 ) AS 'total',        IFNULL( SUM( research.expenditure ), 0 ) AS 'money'    FROM        pb_pro pro        LEFT JOIN pb_pro_sub sub ON sub.parent_code = pro.`code`        LEFT JOIN pb_pro_sub_research research ON research.pro_sub_id = sub.id    GROUP BY        pro.id</select>
<!--综合管理-科研管理资金累计--><select id="selectAccumulation" resultType="java.util.Map">    SELECT        IFNULL( COUNT( DISTINCT research.id ), 0 ) AS counts,        IFNULL( SUM( research.expenditure ), 0 ) AS accumulation    FROM        `pb_pro_sub_research` research        LEFT JOIN pb_pro_sub sub ON sub.id = research.pro_sub_id        LEFT JOIN pb_pro pro ON pro.`code` = sub.parent_code</select>
<!--根据ids查询vo列表-换流站变电站-工程列表的容量和投资--><select id="selectCapacityAndInvestment" resultType="com.pb.projects.vo.substation.PbProSubListVo">    SELECT        pro.type,        sub.id,        sub.`name`,        sub.alias,        pro.capacity,        IFNULL( SUM( research.expenditure ), 0 ) AS expenditure    FROM        pb_pro_sub_research research        LEFT JOIN pb_pro_sub sub ON sub.id = research.pro_sub_id        LEFT JOIN pb_pro pro ON pro.`code` = sub.parent_code    WHERE        research.pro_sub_id = #{proSubId}    GROUP BY        pro.id,        research.pro_sub_id</select>
<!--线路工程-设计进度--><select id="statisticsOfDesign" resultMap="PbProDesignMap">    SELECT    pro.id AS proId,    sub.id AS proSubId,    pro.type AS proType,    pro.`name` AS proName,    pro.alias AS proAlias,    sub.`name` AS proSubName,    sub.alias AS proSubAlias,    GROUP_CONCAT( pb_pro_sub_stage.`name` ) AS stage,    GROUP_CONCAT( pb_pro_sub_stage.`status` ) AS statuses,    pb_pro_sub_pos_info.*    FROM    pb_pro_sub_stage    LEFT JOIN pb_pro_sub sub ON sub.id = pb_pro_sub_stage.pro_sub_id    LEFT JOIN pb_pro pro ON pro.`code` = sub.parent_code    LEFT JOIN pb_pro_sub_pos_info ON pb_pro_sub_pos_info.pro_sub_id = pb_pro_sub_stage.pro_sub_id    WHERE    sub.state = #{subState} AND sub.type = #{subType}    <if test='proType != "q"'>        AND pro.type = #{proType}    </if>    <if test="proSubId != null and proSubId != ''">        AND sub.id = #{proSubId}    </if>    AND pb_pro_sub_stage.`name` IN ('可研','初设','施工图')    GROUP BY    pro.id,sub.id,pb_pro_sub_pos_info.id</select>
<!--线路工程-建设进度--><select id="statisticsOfBuild" resultMap="PbProBuildMap">    SELECT    pro.id AS proId,    sub.id AS proSubId,    pro.type AS proType,    pro.`name` AS proName,    pro.alias AS proAlias,    sub.`name` AS proSubName,    sub.alias AS proSubAlias,    GROUP_CONCAT( pb_pro_sub_stage.`name` ) AS stage,    GROUP_CONCAT( pb_stage_rate.rate ) AS statuses,    pb_pro_sub_pos_info.*    FROM    pb_stage_rate    LEFT JOIN pb_pro_sub_stage ON pb_pro_sub_stage.id = pb_stage_rate.stage_id    LEFT JOIN pb_pro_sub sub ON sub.id = pb_pro_sub_stage.pro_sub_id    LEFT JOIN pb_pro pro ON pro.`code` = sub.parent_code    LEFT JOIN pb_pro_sub_pos_info ON pb_pro_sub_pos_info.pro_sub_id = pb_pro_sub_stage.pro_sub_id    WHERE    sub.state = #{subState} AND sub.type = #{subType}    <if test='proType != "q"'>        AND pro.type = #{proType}    </if>    <if test="proSubId != null and proSubId != ''">        AND sub.id = #{proSubId}    </if>    AND pb_pro_sub_stage.`name` IN ('具备进场条件','已进场','开挖','浇筑','组塔','架线')    GROUP BY    pro.id,sub.id,pb_pro_sub_pos_info.id</select>
<select id="getPbLineDrawingProcessList" resultMap="PbLineDrawingProcessListMap">    SELECT        COUNT(draw.id) volumeCount,        draw.volume volume    FROM        pb_line_drawing_process draw    <where>        <if test="drawIds != null and drawIds != ''">            draw.id IN            <foreach item="item" index="index" collection="drawIds.split(',')" open="(" separator="," close=")">#{item}</foreach>        </if>    </where>    GROUP BY        draw.volume
<select id="selectOneById" resultMap="PbPartyDepartmentMap">        SELECT            party.*        FROM            pb_party_department party        WHERE            party.del_flag = 0 AND party.id =#{id}</select>
<select id="selectSubLineResearchAchievement" resultMap="researchAchievementMap">        SELECT            GROUP_CONCAT( ach.id ) ids,            ach.type type        FROM            `pb_pro_sub_research_achievement` ach        WHERE     ach.research_id=#{researchId}        GROUP BY            ach.type</select>
<select id="selectResearchAchievementSec" resultMap="researchAchievementSecMap">        SELECT            ach.id researchAchievementId,ach.name researchAchievementName,ach.file_id        FROM            `pb_pro_sub_research_achievement` ach        WHERE            ach.id IN        <foreach item="item" index="index" collection="ids.split(',')" open="(" separator="," close=")">#{item}</foreach></select>
DATE_FORMAT(production_time, '%Y-%m-%d %H:%i:%S') pdtime,DATE_FORMAT(planning_time, '%Y-%m-%d %H:%i:%S') plantime,DATE_FORMAT(plan_cmpl_time, '%Y-%m-%d %H:%i:%S') plancltime,DATE_FORMAT(cst_cmpl_time, '%Y-%m-%d %H:%i:%S') cstctimeAND DATE_FORMAT( t.ACTUALSTARTTIME, '%Y-%m-%d' ) = #{riskDate}
<!--党员统计弹窗-党内人员分页--><select id="selectPartyMemberPageByIds" resultType="com.pb.party.vo.PartyMember.PartyMemberVo">    SELECT        me.*    FROM        party_member me    WHERE        me.del_flag = 0    <if test="ids != null and ids.length != 0 ">        AND me.id IN        <foreach item="id" collection="ids" separator="," open="(" close=")" index="">            #{id}        </foreach>    </if></select>
SELECT    me.id,    me.`name`,    me.party_dutyFROM    `party_member` meWHERE    me.party_department_id = #{partyId}    AND me.party_duty NOT IN ${partyDuty}ORDER BY field( me.party_duty, '支部副书记', '组织委员', '宣传委员', '纪检委员', '群(青)工委员', '党小组长' )
<!--首页-在建工程党组织列表/中间地图坐标点--><select id="selectList" resultType="com.pb.party.entity.PartyDepartment">    SELECT        party.*    FROM        party_department party        LEFT JOIN core_project pro ON pro.id = party.project_id    WHERE        party.del_flag = 0        AND pro.`code` LIKE '${projectUnicode}%'</select>
<select id="getDeviceList" resultType="com.xqny.model.DeviceVo">    SELECT        sbdybm id,        sbmc deviceName    FROM        `device_list_collect`    WHERE        sbmc LIKE '%电抗器'      AND sblxmc LIKE '%电抗器'</select>
<select id="getTemperatureAndHumidity" resultType="com.xqny.model.TemperatureAndHumidity">  select         id id,         temperature  temperature,         humidity humidity  from local_weather_data where id =  (select max(id) from local_weather_data)</select>
insert
<!-- mybatis获取刚刚插入到数据库的数据的id --><insert id="insertOne" parameterType="com.xqny.logtest.entity.User" useGeneratedKeys="true" keyProperty="uid">    INSERT INTO user ( user_name ) VALUES ( "rrrrrr" )</insert>
<insert id="addBatchCpsEquipment" parameterType="java.util.List">    INSERT INTO cps_equipment    (project_id,node_num,lifetime,min_load,max_load,installation_cost,electrical_efficiency,    heat_efficiency,cop,max_contribute,compress,operating_cost,capacity,maintenance_cost_factor,tyo,dt)    VALUES    <foreach collection ="cpsEquipmentList" item="cpsEquipment" separator =",">        (#{cpsEquipment.projectId}, #{cpsEquipment.nodeNum}, #{cpsEquipment.lifetime},        #{cpsEquipment.minLoad}, #{cpsEquipment.maxLoad}, #{cpsEquipment.installationCost},        #{cpsEquipment.electricalEfficiency}, #{cpsEquipment.heatEfficiency},        #{cpsEquipment.cop},#{cpsEquipment.maxContribute},#{cpsEquipment.compress},        #{cpsEquipment.operatingCost},#{cpsEquipment.capacity},        #{cpsEquipment.maintenanceCostFactor},#{cpsEquipment.tyo},#{cpsEquipment.dt})    </foreach ></insert>
update
<!-- 批量更新 -- ><update id="batchUpdate">    <foreach collection="studentArrayList" item="item" separator=";"  index="index">        update student    <trim prefix="set " suffixOverrides=",">        <if test="item.getName() != null">            name = #{item.name},        </if>        <if test="item.getAge() != null">            age = #{item.age},        </if>      </trim>        where id = #{item.id}    </foreach></update>
<update id="batchUpdatePowerSimulation">    <foreach collection="powerSimulationResults" item="item" separator=";" index="index">        UPDATE cps_power_simulation_results SET         power_purchase_price = #{item.powerPurchasePrice},        electricity_selling_price = #{item.electricitySellingPrice},        gas_turbine_output = #{item.gasTurbineOutput},        electric_energy_storage_discharge = #{item.electricEnergyStorageDischarge},        electric_vehicle_discharge = #{item.electricVehicleDischarge},        electric_load = #{item.electricLoad},        electric_vehicle_charging = #{item.electricVehicleCharging},        heat_pump_consumption = #{item.heatPumpConsumption},        consumption_of_electric_refrigerator = #{item.consumptionOfElectricRefrigerator},        energy_storage_and_charging = #{item.energyStorageAndCharging},        selling_electricity = #{item.sellingElectricity}        WHERE        project_id = #{item.projectId}        AND type=#{item.type}    </foreach></update>
whereSQL
<sql id="whereSql">    <where>        <if test="projectName != null and projectName != ''">            AND pm.project_name = #{projectName}        </if>        <if test="type != null and type != ''">            AND pm.type = #{type}        </if>        <if test="projectId =='qwer'">            AND (pm.project_id is not null OR pm.project_id !='')        </if>        <if test="projectId == null or projectId == ''">            AND (pm.project_id is null OR pm.project_id='')        </if><if test="date != null and date != ''">            AND DATE_FORMAT(life.active_time,'%Y') = #{date}</if>    </where></sql>
<sql id="whereSql">    <where>        <if test="proType != null and proType != ''">            AND pro.type = #{proType}        </if>        <if test="subType != null">            AND sub.type = #{subType}        </if>        <if test="subStage != null">            AND sub.state = #{subStage}        </if>        <if test="proSubId != null and proSubId != ''">da            AND sub.id = #{proSubId}        </if>    </where></sql>
if分支
<if test="obj.searchType!=null and obj.searchType !=''"><choose>    <when test="obj.searchType ='pwNum'">        AND `pw_num` like CONCAT('%',#{obj.searchValue},'%')    </when>    <when test="obj.searchType ='pwDesc'">        AND `pw_desc` like CONCAT('%',#{obj.searchValue},'%')    </when>    <otherwise>        AND `pw_name` like CONCAT('%',#{obj.searchValue},'%')    </otherwise></choose></if>