<?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.mdc.mapper.Mapper">
<resultMap id="BaseResultMap" type="Sch">
<result column="id" property="Id" />
<result column="Code" property="Code" />
</resultMap>
<select id="getSchCodesByAoiIds" resultMap="BaseResultMap">
select id,GROUP_CONCAT(code) as Code from table
<where>
<if test="cityCode != null and cityCode != ''">
and city_code=#{cityCode}
</if>
<if test="Ids != null">
AND id IN
<foreach item="item" index="index" collection="Ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY city_code,id
</select>
</mapper>
Mybatis xml例子
最新推荐文章于 2023-10-11 15:39:07 发布