MmInfoTrainMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.maternitymatron.MmInfoTrainDao" >
  4. <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.maternitymatron.MmInfoTrain" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="servant_code" property="servant_code" jdbcType="INTEGER" />
  7. <result column="train_code" property="train_code" jdbcType="INTEGER" />
  8. <result column="train_date" property="train_date" jdbcType="DATE" />
  9. <result column="train_result" property="train_result" jdbcType="VARCHAR" />
  10. <result column="train_name" property="train_name" jdbcType="VARCHAR" />
  11. </resultMap>
  12. <sql id="Base_Column_List" >
  13. id, servant_code, train_code,train_date,train_result,train_name
  14. </sql>
  15. <!-- 得到所有的培训信息 -->
  16. <select id="getAll" resultMap="BaseResultMap" >
  17. select
  18. <include refid="Base_Column_List" />
  19. from mm_info_train
  20. </select>
  21. <select id="getTrainsCount" parameterType="java.lang.Integer" resultType="java.lang.Integer" >
  22. select
  23. count(1)
  24. from mm_info_train
  25. where servant_code = #{servant_code,jdbcType=INTEGER}
  26. </select>
  27. <select id="getInfoTrains" resultMap="BaseResultMap" parameterType="java.lang.Integer">
  28. select
  29. id,
  30. fgettrainname(train_code) train_name,
  31. train_code,
  32. train_date,
  33. train_result
  34. from mm_info_train
  35. where servant_code = #{servant_code,jdbcType=INTEGER}
  36. order by id asc
  37. </select>
  38. <!-- 根据id查找某个照片信息 -->
  39. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  40. select
  41. <include refid="Base_Column_List" />
  42. from mm_info_train
  43. where servant_code = #{servant_code,jdbcType=INTEGER}
  44. </select>
  45. <!-- 根据id删除某个照片信息 -->
  46. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  47. delete from mm_info_train
  48. where id = #{id,jdbcType=INTEGER}
  49. </delete>
  50. <!-- 插入一条照片信息 -->
  51. <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.maternitymatron.MmInfoTrain" >
  52. insert into mm_info_train
  53. <trim prefix="(" suffix=")" suffixOverrides="," >
  54. <if test="servant_code != null" >
  55. servant_code,
  56. </if>
  57. <if test="train_code != null" >
  58. train_code,
  59. </if>
  60. <if test="train_date != null" >
  61. train_date,
  62. </if>
  63. <if test="train_result != null" >
  64. train_result
  65. </if>
  66. </trim>
  67. <trim prefix="values (" suffix=")" suffixOverrides="," >
  68. <if test="servant_code != null" >
  69. #{servant_code,jdbcType=INTEGER},
  70. </if>
  71. <if test="train_code != null" >
  72. #{train_code,jdbcType=INTEGER},
  73. </if>
  74. <if test="train_date != null" >
  75. #{train_date,jdbcType=DATE},
  76. </if>
  77. <if test="train_result != null" >
  78. #{train_result,jdbcType=VARCHAR}
  79. </if>
  80. </trim>
  81. </insert>
  82. <!-- 根据id更新一条照片信息 -->
  83. <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.maternitymatron.MmInfoTrain" >
  84. update mm_info_train
  85. <set >
  86. <if test="servant_code != null" >
  87. servant_code = #{servant_code,jdbcType=INTEGER},
  88. </if>
  89. <if test="train_code != null" >
  90. train_code = #{train_code,jdbcType=VARCHAR},
  91. </if>
  92. <if test="train_date != null" >
  93. train_date = #{train_date,jdbcType=DATE},
  94. </if>
  95. <if test="train_result != null" >
  96. train_result = #{train_result,jdbcType=VARCHAR}
  97. </if>
  98. </set>
  99. where id = #{id,jdbcType=INTEGER}
  100. </update>
  101. </mapper>