PhotoMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.ygj.yuemum.dao.admin.PhotoDao" >
  4. <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.admin.Photo" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="photo_type" property="photo_type" jdbcType="INTEGER" />
  7. <result column="resume_code" property="resume_code" jdbcType="INTEGER" />
  8. <result column="servant_code" property="servant_code" jdbcType="VARCHAR" />
  9. <result column="photo_path" property="photo_path" jdbcType="VARCHAR" />
  10. <result column="photo_name" property="photo_name" jdbcType="VARCHAR" />
  11. <result column="comment" property="comment" jdbcType="VARCHAR" />
  12. </resultMap>
  13. <sql id="Base_Column_List" >
  14. id, photo_type, resume_code,photo_path,servant_code,photo_name,comment
  15. </sql>
  16. <!-- 得到所有的照片信息 -->
  17. <select id="getAll" resultMap="BaseResultMap" >
  18. select
  19. <include refid="Base_Column_List" />
  20. from mm_info_photo
  21. </select>
  22. <select id="queryPhoto" resultMap="BaseResultMap" parameterType="com.ygj.yuemum.domain.admin.Photo">
  23. select
  24. photo_name,photo_path
  25. from mm_info_photo
  26. where 1=1
  27. <if test="photo_type != null and photo_type !=''">
  28. and photo_type = #{photo_type,jdbcType=VARCHAR}
  29. </if>
  30. <if test="servant_code != null and servant_code !=''">
  31. and servant_code = #{servant_code,jdbcType=VARCHAR}
  32. </if>
  33. </select>
  34. <!-- 根据id查找某个照片信息 -->
  35. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  36. select
  37. <include refid="Base_Column_List" />
  38. from mm_info_photo
  39. where resume_code = #{resume_code,jdbcType=INTEGER}
  40. </select>
  41. <select id="selectDisplay" resultType="java.lang.String" parameterType="com.ygj.yuemum.domain.admin.Photo" >
  42. select
  43. photo_name
  44. from mm_info_photo
  45. where 1=1
  46. <if test="servant_code != null and servant_code !=''">
  47. and servant_code = #{servant_code,jdbcType=INTEGER}
  48. </if>
  49. <if test="photo_type != null and photo_type !=''">
  50. and photo_type = #{photo_type,jdbcType=INTEGER}
  51. </if>
  52. </select>
  53. <!-- 根据id删除某个照片信息 -->
  54. <delete id="deletePhoto" parameterType="com.ygj.yuemum.domain.admin.Photo">
  55. delete from mm_info_photo
  56. where 1 = 1
  57. <if test="photo_name != null and photo_name !=''">
  58. and photo_name = #{photo_name,jdbcType=VARCHAR}
  59. </if>
  60. <if test="servant_code != null and servant_code !=''">
  61. and servant_code = #{servant_code,jdbcType=VARCHAR}
  62. </if>
  63. </delete>
  64. <!-- 插入一条照片信息 -->
  65. <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.admin.Photo" >
  66. insert into mm_info_photo
  67. <trim prefix="(" suffix=")" suffixOverrides="," >
  68. <if test="resume_code != null" >
  69. resume_code,
  70. </if>
  71. <if test="photo_type != null" >
  72. photo_type,
  73. </if>
  74. <if test="photo_path != null" >
  75. photo_path,
  76. </if>
  77. <if test="servant_code != null" >
  78. servant_code,
  79. </if>
  80. <if test="photo_name != null" >
  81. photo_name
  82. </if>
  83. </trim>
  84. <trim prefix="values (" suffix=")" suffixOverrides="," >
  85. <if test="resume_code != null" >
  86. #{resume_code,jdbcType=INTEGER},
  87. </if>
  88. <if test="photo_type != null" >
  89. #{photo_type,jdbcType=VARCHAR},
  90. </if>
  91. <if test="photo_path != null" >
  92. #{photo_path,jdbcType=VARCHAR},
  93. </if>
  94. <if test="servant_code != null" >
  95. #{servant_code,jdbcType=VARCHAR},
  96. </if>
  97. <if test="photo_name != null" >
  98. #{photo_name,jdbcType=VARCHAR}
  99. </if>
  100. </trim>
  101. </insert>
  102. <!-- 根据id更新一条照片信息 -->
  103. <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.admin.Photo" >
  104. update mm_info_photo
  105. <set >
  106. <if test="resume_code != null" >
  107. resume_code = #{resume_code,jdbcType=INTEGER},
  108. </if>
  109. <if test="photo_type != null" >
  110. photo_type = #{photo_type,jdbcType=VARCHAR},
  111. </if>
  112. <if test="photo_path != null" >
  113. photo_path = #{photo_path,jdbcType=VARCHAR},
  114. </if>
  115. <if test="servant_code != null" >
  116. servant_code = #{servant_code,jdbcType=VARCHAR},
  117. </if>
  118. <if test="photo_name != null" >
  119. photo_name = #{photo_name,jdbcType=VARCHAR}
  120. </if>
  121. </set>
  122. where id = #{id,jdbcType=INTEGER}
  123. </update>
  124. </mapper>