ExamInfoMapper.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.miaxis.exam.mapper.ExamInfoMapper">
  6. <resultMap type="ExamInfo" id="ExamInfoResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="image" column="image" />
  10. <result property="provinceId" column="province_id" />
  11. <result property="province" column="province" />
  12. <result property="cityId" column="city_id" />
  13. <result property="city" column="city" />
  14. <result property="price" column="price" />
  15. <result property="createTime" column="create_time" />
  16. <result property="updateTime" column="update_time" />
  17. </resultMap>
  18. <sql id="selectExamInfoVo">
  19. select * from exam_info
  20. </sql>
  21. <select id="selectExamInfoList" parameterType="ExamInfo" resultMap="ExamInfoResult">
  22. <include refid="selectExamInfoVo"/>
  23. <where>
  24. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  25. <if test="image != null and image != ''"> and image = #{image}</if>
  26. <if test="provinceId != null and provinceId != ''"> and province_id = #{provinceId}</if>
  27. <if test="province != null and province != ''"> and province = #{province}</if>
  28. <if test="cityId != null and cityId != ''"> and city_id = #{cityId}</if>
  29. <if test="city != null and city != ''"> and city = #{city}</if>
  30. </where>
  31. </select>
  32. <select id="getProvice" resultType="com.miaxis.exam.vo.ExamInfoProviceVo">
  33. select province_id,province from exam_info group by province_id,province
  34. </select>
  35. <select id="getCity" resultType="com.miaxis.exam.vo.ExamInfoCityVo">
  36. select city_id,city from exam_info where province_id = #{provinceId}
  37. GROUP BY city_id,city
  38. </select>
  39. </mapper>