MmInfoCertificateMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.MmInfoCertificateDao" >
  4. <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.maternitymatron.MmInfoCertificate" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="servant_code" property="servant_code" jdbcType="INTEGER" />
  7. <result column="certificate_code" property="certificate_code" jdbcType="INTEGER" />
  8. <result column="start_date" property="start_date" jdbcType="VARCHAR" />
  9. <result column="end_date" property="end_date" jdbcType="VARCHAR" />
  10. <result column="certificate_name" property="certificate_name" jdbcType="VARCHAR" />
  11. <result column="organization" property="organization" jdbcType="VARCHAR" />
  12. </resultMap>
  13. <sql id="Base_Column_List" >
  14. id, servant_code, certificate_code,start_date,end_date,certificate_name,organization
  15. </sql>
  16. <!-- 得到月嫂证书信息 -->
  17. <select id="getAll" resultMap="BaseResultMap" >
  18. select
  19. <include refid="Base_Column_List" />
  20. from mm_info_certificate
  21. </select>
  22. <select id="getCertificateCount" parameterType="java.lang.Integer" resultType="java.lang.Integer" >
  23. select
  24. count(1)
  25. from mm_info_certificate
  26. where servant_code = #{servant_code,jdbcType=INTEGER}
  27. </select>
  28. <select id="getInfoCertificate" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  29. select
  30. id,
  31. fgetcertificatename(certificate_code) certificate_name,
  32. certificate_code,
  33. organization,
  34. DATE_FORMAT(start_date,'%Y-%m-%d') start_date,
  35. DATE_FORMAT(end_date,'%Y-%m-%d') end_date
  36. from mm_info_certificate
  37. where servant_code = #{servant_code,jdbcType=INTEGER}
  38. </select>
  39. <!-- 根据id删除月嫂证书信息 -->
  40. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  41. delete from mm_info_certificate
  42. where id = #{id,jdbcType=INTEGER}
  43. </delete>
  44. <!-- 插入一条月嫂证书信息 -->
  45. <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.maternitymatron.MmInfoCertificate" >
  46. insert into mm_info_certificate
  47. <trim prefix="(" suffix=")" suffixOverrides="," >
  48. <if test="servant_code != null" >
  49. servant_code,
  50. </if>
  51. <if test="certificate_code != null" >
  52. certificate_code,
  53. </if>
  54. <if test="organization != null" >
  55. organization,
  56. </if>
  57. <if test="start_date != null" >
  58. start_date,
  59. </if>
  60. <if test="end_date != null" >
  61. end_date
  62. </if>
  63. </trim>
  64. <trim prefix="values (" suffix=")" suffixOverrides="," >
  65. <if test="servant_code != null" >
  66. #{servant_code,jdbcType=INTEGER},
  67. </if>
  68. <if test="certificate_code != null" >
  69. #{certificate_code,jdbcType=INTEGER},
  70. </if>
  71. <if test="organization != null" >
  72. #{organization,jdbcType=INTEGER},
  73. </if>
  74. <if test="start_date != null" >
  75. #{start_date,jdbcType=DATE},
  76. </if>
  77. <if test="end_date != null" >
  78. #{end_date,jdbcType=DATE}
  79. </if>
  80. </trim>
  81. </insert>
  82. <!-- 根据id更新一条月嫂证书信息 -->
  83. <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.maternitymatron.MmInfoCertificate" >
  84. update mm_info_certificate
  85. <set >
  86. <if test="servant_code != null" >
  87. servant_code = #{servant_code,jdbcType=VARCHAR},
  88. </if>
  89. <if test="certificate_code != null" >
  90. certificate_code = #{certificate_code,jdbcType=VARCHAR},
  91. </if>
  92. <if test="organization != null" >
  93. organization = #{organization,jdbcType=VARCHAR},
  94. </if>
  95. <if test="start_date != null" >
  96. start_date = #{start_date,jdbcType=DATE},
  97. </if>
  98. <if test="end_date != null" >
  99. end_date = #{end_date,jdbcType=DATE}
  100. </if>
  101. </set>
  102. where id = #{id,jdbcType=INTEGER}
  103. </update>
  104. </mapper>