<?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.newfiber.api.pc.dao.AllocMapper"> <resultMap id="acceptAllotMap" type="com.newfiber.api.pc.model.meet.AcceptAllot"> <id property="allotId" column="allot_id"/> <result property="allotUserNo" column="allot_user_no"/> <result property="assignUserNo" column="assign_user_no"/> <result property="createTime" column="create_time"/> <result property="acceptTime" column="accept_time"/> <result property="state" column="state"/> <result property="allotName" column="allot_name"/> <collection property="sups" ofType="com.newfiber.api.pc.model.meet.AcceptSup" > <id property="sId" column="s_id"/> <result property="rollOutHouseSiteId" column="roll_out_house_site_id"/> <result property="rollOutSupId" column="roll_out_sup_id"/> <result property="rollOutSupCount" column="roll_out_sup_count"/> <result property="acceptHouseId" column="accept_house_id"/> <result property="otId" column="ot_id"/> <result property="rollOutSupName" column="roll_out_sup_name"/> </collection> </resultMap> <resultMap id="allocDetails" type="com.newfiber.api.pc.model.vo.AllotDeatilsVo"> <result property="allotId" column="allot_id"/> <result property="allotUserNo" column="allot_user_no"/> <result property="assignUserNo" column="assign_user_no"/> <result property="allotSiteName" column="allot_site_name"/> <result property="assignSiteName" column="assign_site_name"/> <result property="allotName" column="allot_name"/> <result property="createTime" column="create_time"/> <result property="accpetTime" column="accpet_time"/> </resultMap> <select id="selectAllotByAllotId" resultMap="acceptAllotMap" > SELECT aa.*,acs.* from accept_allot aa LEFT JOIN accept_sup acs ON aa.allot_id = acs.ot_id where aa.allot_id = #{allotId} </select> <select id="selectAllocDetails" resultMap="allocDetails" parameterType="list"> select aa.* ,hs1.site_name allot_site_name,hs2.site_name assign_site_name from accept_allot aa LEFT JOIN accept_sup ass ON aa.allot_id = ass.ot_id LEFT JOIN house_site hs1 on ass.roll_out_house_site_id = hs1.h_id LEFT JOIN house_site hs2 ON ass.accept_house_id = hs2.h_id where aa.allot_id in <foreach collection="list" item="item" open="(" separator="," close=")"> #{item} </foreach> GROUP BY aa.allot_id,ass.roll_out_house_site_id </select> </mapper>