package com.example.spring2.mapper;标签:Map,name,6.10,Select,policy,import,SELECT From: https://www.cnblogs.com/kongxiangzeng/p/18246600
import com.example.spring2.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface UserMapper {
@Select("SELECT COUNT(*) FROM policy WHERE name LIKE CONCAT('%', #{name}, '%')")
Map<String, User> getCountByName(@Param("name") String name);
@Select("SELECT COUNT(*) FROM policy WHERE document LIKE CONCAT('%', #{document}, '%')")
Map<String, User> getCountByDocument(@Param("document") String document);
@Select("SELECT COUNT(*) FROM policy WHERE organ LIKE CONCAT('%', #{organ}, '%')")
Map<String, User> getCountByOrgan(@Param("organ") String organ);
@Select("SELECT COUNT(*) FROM policy WHERE text LIKE CONCAT('%', #{text}, '%')")
Map<String, User> getCountByText(@Param("text") String text);
@Select("SELECT COUNT(*) FROM policy")
Map<String, User> getTotalCount();
@Select("SELECT name FROM policy")
List<User> getAllPolicies();
@Select("SELECT text FROM policy WHERE name LIKE CONCAT('%',#{name},'%')")
List<String> getAllPolicies2(String name);
@Select("SELECT name FROM policy WHERE name LIKE CONCAT('%',#{name},'%')")
List<User> getAllPolicies3(String name);
}