StudentPreVisitMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.ym.mec.biz.dal.dao.StudentPreVisitDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.StudentPreVisit" id="StudentPreVisit">
  9. <result column="id_" property="id" />
  10. <result column="organ_id_" property="organId" />
  11. <result column="student_id_" property="studentId" />
  12. <result column="student_name" property="studentName" />
  13. <result column="teacher_id_" property="teacherId" />
  14. <result column="teacher_name" property="teacherName" />
  15. <result column="phone" property="phone" />
  16. <result column="orgName" property="orgname" />
  17. <result column="tenant_id_" property="tenantId" />
  18. <result column="is_visit" property="isVisit" />
  19. <result column="visit_cycle" property="visitCycle" />
  20. </resultMap>
  21. <!-- 根据主键查询一条记录 -->
  22. <select id="get" resultMap="StudentPreVisit" >
  23. SELECT * FROM student_pre_visit WHERE id_ = #{id}
  24. </select>
  25. <!-- 全查询 -->
  26. <select id="findAll" resultMap="StudentPreVisit">
  27. SELECT * FROM student_pre_visit ORDER BY id_
  28. </select>
  29. <!-- 向数据库增加一条记录 -->
  30. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentPreVisit" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  31. <!--
  32. <selectKey resultClass="int" keyProperty="id" >
  33. SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
  34. </selectKey>
  35. -->
  36. INSERT INTO student_pre_visit (id_,organ_id_,student_id_,student_name,teacher_id_,teacher_name,phone,orgName,tenant_id_,is_visit,visit_cycle) VALUES(#{id},#{organId},#{studentId},#{studentName},#{teacherId},#{teacherName},#{phone},#{orgname},#{tenantId},#{isVisit},#{visitCycle})
  37. </insert>
  38. <insert id="batchInsert" parameterType="java.util.List">
  39. INSERT INTO student_pre_visit (id_,organ_id_,student_id_,student_name,teacher_id_,teacher_name,phone,orgName,tenant_id_,is_visit,visit_cycle) VALUES
  40. <foreach collection="studentPreVisits" item="item" index="index" separator=",">
  41. (#{item.id},#{item.organId},#{item.studentId},#{item.studentName},#{item.teacherId},#{item.teacherName},#{item.phone},#{item.orgname},#{item.tenantId},#{item.isVisit},#{item.visitCycle})
  42. </foreach>
  43. </insert>
  44. <update id="updateVisit">
  45. UPDATE student_pre_visit set is_visit = 1 where visit_cycle =#{visitCycle} and student_id_ = #{studentId}
  46. </update>
  47. <select id="getPageList" resultMap="StudentPreVisit">
  48. SELECT sv.* FROM
  49. student_pre_visit sv
  50. <include refid="queryPageSql"/>
  51. </select>
  52. <sql id="queryPageSql">
  53. <where>
  54. <if test="student !=null and student != ''" >
  55. AND sv.student_id_ = #{student} OR sv.student_name =#{student} or sv.phone = #{student}
  56. </if>
  57. <if test="organId != null and organId != ''">
  58. AND FIND_IN_SET(sv.organ_id_,#{organId})
  59. </if>
  60. <if test="isVisit != null and isVisit != ''">
  61. AND sv.is_visit = #{isVisit}
  62. </if>
  63. <if test="visitCycle != null and visitCycle != ''">
  64. AND sv.visit_cycle = #{visitCycle}
  65. </if>
  66. </where>
  67. </sql>
  68. <!-- 根据主键查询一条记录 -->
  69. <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentPreVisit">
  70. UPDATE student_pre_visit <set>
  71. <if test="studentName != null">
  72. student_name = #{studentName},
  73. </if>
  74. <if test="organId != null">
  75. organ_id_ = #{organId},
  76. </if>
  77. <if test="teacherName != null">
  78. teacher_name = #{teacherName},
  79. </if>
  80. <if test="isVisit != null">
  81. is_visit = #{isVisit},
  82. </if>
  83. <if test="orgname != null">
  84. orgName = #{orgname},
  85. </if>
  86. <if test="id != null">
  87. id_ = #{id},
  88. </if>
  89. <if test="phone != null">
  90. phone = #{phone},
  91. </if>
  92. <if test="teacherId != null">
  93. teacher_id_ = #{teacherId},
  94. </if>
  95. <if test="tenantId != null">
  96. tenant_id_ = #{tenantId},
  97. </if>
  98. <if test="studentId != null">
  99. student_id_ = #{studentId},
  100. </if>
  101. <if test="visitCycle != null">
  102. visit_cycle = #{visitCycle},
  103. </if>
  104. </set> WHERE id_ = #{id}
  105. </update>
  106. <!-- 根据主键删除一条记录 -->
  107. <delete id="delete" >
  108. DELETE FROM student_pre_visit WHERE id_ = #{id}
  109. </delete>
  110. <!-- 分页查询 -->
  111. <select id="queryPage" resultMap="StudentPreVisit" parameterType="map">
  112. SELECT * FROM student_pre_visit ORDER BY id_ <include refid="global.limit"/>
  113. </select>
  114. <!-- 查询当前表的总记录数 -->
  115. <select id="queryCount" resultType="int">
  116. SELECT COUNT(*) FROM student_pre_visit
  117. </select>
  118. </mapper>