Mybatis Mapper.xml 需要查询返回List<String>

<?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.xinwei.process.dao.RoleServiceTypeMapper" >
  <resultMap id="BaseResultMap" type="com.xinwei.process.entity.RoleServiceType" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="role_id" property="roleId" jdbcType="INTEGER" />
    <result column="service_type" property="serviceType" jdbcType="VARCHAR" />
  </resultMap>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from tb_role_service_type
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.xinwei.process.entity.RoleServiceType" >
    insert into tb_role_service_type (id, role_id, service_type
      )
    values (#{id,jdbcType=BIGINT}, #{roleId,jdbcType=INTEGER}, #{serviceType,jdbcType=VARCHAR}
      )
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.xinwei.process.entity.RoleServiceType" >
    update tb_role_service_type
    set role_id = #{roleId,jdbcType=INTEGER},
      service_type = #{serviceType,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select id, role_id, service_type
    from tb_role_service_type
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectAll" resultMap="BaseResultMap" >
    select id, role_id, service_type
    from tb_role_service_type
  </select>


 <select id="selectServiceTypeListByRole"  resultType="java.lang.String">
    select service_type
    from tb_role_service_type
    where role_id = #{roleId,jdbcType=INTEGER}
  </select>

 

</mapper>


posted @ 2017-02-25 19:07  Alamps  阅读(20253)  评论(1编辑  收藏  举报