Commit 5a21792e by wangli

修改

1 parent 72b73e57
......@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.springframework.jdbc.core.SqlProvider;
import java.util.List;
......@@ -18,7 +19,7 @@ public interface EngineerInfoMPDao extends BaseMapper<EngineerInfo> {
@Select("select * from engineer_info where engineer_code = #{engineerCode}")
List<EngineerInfo> selectByEngineerCode(String engineerCode);
@SelectProvider(type=SqlProvider.class, method = "selectByOrderIds")
@SelectProvider(type= EngineerInfoSqlProvider.class, method = "selectByEngineerCodes")
List<EngineerInfo> selectByEngineerCodes(@Param("engineerCodes") List<String> engineerCodes);
@Select("select * from engineer_info where group_id = #{groupId}")
......@@ -26,11 +27,11 @@ public interface EngineerInfoMPDao extends BaseMapper<EngineerInfo> {
}
class SqlProvider {
public String selectByOrderIds(@Param("orderIds") List<String> orderIds) {
class EngineerInfoSqlProvider {
public String selectByEngineerCodes(@Param("engineerCodes") List<String> engineerCodes) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT * FROM order_request WHERE order_id IN ");
sb.append("<foreach item='orderId' collection='orderIds' open='(' separator=',' close=')'>#{orderId}</foreach>");
sb.append("SELECT * FROM engineer_info WHERE engineer_code IN ");
sb.append("<foreach item='engineerCode' collection='engineerCodes' open='(' separator=',' close=')'>#{engineerCode}</foreach>");
return sb.toString();
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
......@@ -17,6 +18,16 @@ public interface OrderRequestMPDao extends BaseMapper<OrderRequest> {
@Select("select * from order_request where order_id = #{orderId}")
List<OrderRequest> selectByOrderId(String orderId);
@Select({"select * from order_request where order_id in <foreach item='orderId' index='index' collection='orderIds' open='(' separator=',' close=')'>#{orderId}</foreach>"})
//@Select({"select * from order_request where order_id in <foreach item='orderId' index='index' collection='orderIds' open='(' separator=',' close=')'>#{orderId}</foreach>"})
@SelectProvider(type = OrderRequestSqlProvider.class, method = "selectByOrderIds")
List<OrderRequest> selectByOrderIds(@Param("orderIds") List<String> orderIds);
}
class OrderRequestSqlProvider {
public String selectByOrderIds(@Param("orderIds") List<String> orderIds) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT * FROM order_request WHERE order_id IN ");
sb.append("<foreach item='orderId' collection='orderIds' open='(' separator=',' close=')'>#{orderId}</foreach>");
return sb.toString();
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!