mybatis 记录
删除list集合
**Mapper.xml
<delete id="deleteBackstageRecommend" parameterType="java.util.List"> delete from backPersonConfig where (agentCode,guaranteeType) in <foreach collection="list" item="item" index="index" separator="," open="(" close=")"> (#{item.agentCode},#{item.guaranteeType}) </foreach> </delete>
**Mapper
/** * 删除推荐产品 * @param backPersonConfig */ public void deleteBackstageRecommend(List<BackPersonConfig> backPersonConfig);
将多条记录合并为一条展示所有数据
mysql: 使用group_concat
select sales_code,count( distinct stat_month) as a ,
group_concat( item_id order by sales_code desc separator ',') ,
group_concat( index_name order by sales_code desc separator ',')
from t_saleswageinfo
where 1=1
group by sales_code
oracle: 使用 listagg ... within group
select * from (select sales_code, listagg(to_char(item_id), ',') within group(order by sales_code) indexId ,listagg(to_char(index_name), ',') within group(order by sales_code)indexName from t_salesWageInfo group by sales_code) a