BaseDegreeDao.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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.liang.dao.BaseDegreeDao">
  4. <resultMap type="com.liang.entity.BaseDegree" id="BaseDegreeMap">
  5. <result property="Genid" column="_genid" jdbcType="INTEGER"/>
  6. <result property="tdi142" column="tdi142" jdbcType="VARCHAR"/>
  7. <result property="tdi169" column="tdi169" jdbcType="VARCHAR"/>
  8. </resultMap>
  9. <!--查询单个-->
  10. <select id="queryById" resultMap="BaseDegreeMap">
  11. select
  12. _genid, tdi142, tdi169
  13. from base_Degree
  14. where _genid = #{Genid}
  15. </select>
  16. <!--查询指定行数据-->
  17. <select id="queryAllByLimit" resultMap="BaseDegreeMap">
  18. select
  19. _genid, tdi142, tdi169
  20. from base_Degree
  21. <where>
  22. <if test="Genid != null">
  23. and _genid = #{Genid}
  24. </if>
  25. <if test="tdi142 != null and tdi142 != ''">
  26. and tdi142 = #{tdi142}
  27. </if>
  28. <if test="tdi169 != null and tdi169 != ''">
  29. and tdi169 = #{tdi169}
  30. </if>
  31. </where>
  32. limit #{pageable.offset}, #{pageable.pageSize}
  33. </select>
  34. <!--统计总行数-->
  35. <select id="count" resultType="java.lang.Long">
  36. select count(1)
  37. from base_Degree
  38. <where>
  39. <if test="Genid != null">
  40. and _genid = #{Genid}
  41. </if>
  42. <if test="tdi142 != null and tdi142 != ''">
  43. and tdi142 = #{tdi142}
  44. </if>
  45. <if test="tdi169 != null and tdi169 != ''">
  46. and tdi169 = #{tdi169}
  47. </if>
  48. </where>
  49. </select>
  50. <!--新增所有列-->
  51. <insert id="insert" keyProperty="Genid" useGeneratedKeys="true">
  52. insert into base_Degree(tdi142, tdi169)
  53. values (#{tdi142}, #{tdi169})
  54. </insert>
  55. <insert id="insertBatch" keyProperty="Genid" useGeneratedKeys="true">
  56. insert into base_Degree(tdi142, tdi169)
  57. values
  58. <foreach collection="entities" item="entity" separator=",">
  59. (#{entity.tdi142}, #{entity.tdi169})
  60. </foreach>
  61. </insert>
  62. <insert id="insertOrUpdateBatch" keyProperty="Genid" useGeneratedKeys="true">
  63. insert into base_Degree(tdi142, tdi169)
  64. values
  65. <foreach collection="entities" item="entity" separator=",">
  66. (#{entity.tdi142}, #{entity.tdi169})
  67. </foreach>
  68. on duplicate key update
  69. tdi142 = values(tdi142),
  70. tdi169 = values(tdi169)
  71. </insert>
  72. <!--通过主键修改数据-->
  73. <update id="update">
  74. update base_Degree
  75. <set>
  76. <if test="tdi142 != null and tdi142 != ''">
  77. tdi142 = #{tdi142},
  78. </if>
  79. <if test="tdi169 != null and tdi169 != ''">
  80. tdi169 = #{tdi169},
  81. </if>
  82. </set>
  83. where _genid = #{Genid}
  84. </update>
  85. <!--通过主键删除-->
  86. <delete id="deleteById">
  87. delete
  88. from base_Degree
  89. where _genid = #{Genid}
  90. </delete>
  91. <!--获取学位-->
  92. <select id="getDegreeList" resultType="map">
  93. select BM as code, MC as name
  94. from base_Degree
  95. </select>
  96. </mapper>