You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?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.example.demo.mapper.coin.MarketMapper"> <select id="getMarket" resultType="com.example.demo.domain.entity.Market"> select * from market </select>
<!-- 根据名称列表查询对应的市场ID及其子市场ID --> <select id="getMarketIds" parameterType="java.util.List" resultType="java.lang.String"> SELECT id FROM market WHERE -- 匹配名称的市场ID name IN <foreach collection="list" item="name" open="(" separator="," close=")"> #{name} </foreach> OR -- 父ID是上述市场ID的子市场 parent_id IN ( SELECT id FROM market WHERE name IN <foreach collection="list" item="name" open="(" separator="," close=")"> #{name} </foreach> ) </select> <select id="getMarketId" resultType="java.lang.String"> select id from market where name=#{market} </select> <select id="getMarketIdDao" resultType="com.example.demo.domain.entity.Market"> select * from markets where name=#{country} </select> <select id="getMarketIdBytype" resultType="com.example.demo.domain.entity.Market"> select * from market where parent_id=#{parentId} </select> <select id="getMarketById" resultType="java.lang.String"> select name from market where id=#{market} </select> <select id="getMarketByIds" resultType="com.example.demo.domain.entity.Market"> select id, name from market where 1 = 0 <if test="marketIds != null and marketIds.size() > 0"> OR id IN <foreach collection="marketIds" item="marketId" open="(" separator="," close=")"> #{marketId} </foreach> </if> </select></mapper>
|