DegreeMapper.xml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.ym.mec.biz.dal.mapper.DegreeMapper">
  4. <select id="selectPage" resultType="com.ym.mec.biz.dal.entity.Degree">
  5. SELECT
  6. t.*
  7. FROM degree t
  8. <where>
  9. <if test="param.keyword != null and param.keyword != ''">
  10. AND (t.name_ LIKE CONCAT('%',#{param.keyword},'%') OR t.id_ LIKE CONCAT('%',#{param.keyword},'%'))
  11. </if>
  12. <if test="param.startTime !=null and param.endTime != null">
  13. and t.start_time_ &lt;= #{param.endTime} and t.end_time_ &gt;= #{param.startTime}
  14. </if>
  15. <if test="param.status != null">
  16. and t.status_ = #{param.status}
  17. </if>
  18. <if test="param.tenantId != null">
  19. and t.tenant_id_ = #{param.tenantId}
  20. </if>
  21. <if test="param.organId != null">
  22. AND FIND_IN_SET(#{param.organId},t.organ_ids_)
  23. </if>
  24. <if test="param.degreeStatuses != null">
  25. AND t.status_ IN (<foreach collection="param.degreeStatuses" separator="," item="item">#{item}</foreach>)
  26. </if>
  27. </where>
  28. </select>
  29. <update id="degreeStatusChange">
  30. UPDATE degree SET status_ =
  31. case
  32. when start_time_ &lt; now() and end_time_ &gt; now() then 'START'
  33. when end_time_ &lt;= now() then 'END'
  34. else 'NOT_START'
  35. end
  36. WHERE status_ != 'END' and start_time_ &lt; now()
  37. </update>
  38. </mapper>