mapper.xml文件
<?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.xxx.xx.cms.dal.extdao.GroupByMaterialMapper">
<select id="groupByMaterialIds" resultType="com.xxx.xx..cms.dal.extdomain.GroupByMaterialDO">
select t1.material_id AS materialId, t2.material_name AS materialName,
t2.material_type AS materialType, t1.position_id AS positionId,
t5.position_name AS positionName, t1.project_id AS projectId,
t3.project_name AS projectName, t1.task_id AS taskId,t4.task_name AS taskName
from xspace_task_material_pre t1
left join xspace_material_pre t2 on t1.material_id = t2.id
left join xspace_delivery_project_pre t3 on t1.project_id = t3.id
left join xspace_delivery_task_pre t4 on t1.task_id = t4.id
left join xspace_content_position_pre t5 on t1.position_id = t5.id
<where>
t1.material_id in
<foreach close=")" collection="materialIds" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</where>
order BY t1.material_id
</select>
</mapper>
mapper.java文件
import com.xxx.xx.cms.dal.extdomain.GroupByMaterialDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* @author
* @version 2017/12/5 17:38:29
*/
@Mapper
public interface GroupByMaterialMapper {
/**
*
*
* @param materialIds
* @return
*/
List<GroupByMaterialDO> groupByMaterialIds(@Param("materialIds") List<Long> materialIds);
}