MesProductArcWeldingDao.xml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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.jeesite.modules.mes.dao.MesProductArcWeldingDao">
  4. <select id="findLatestById" resultType="com.jeesite.modules.mes.entity.MesProductArcWelding">
  5. SELECT
  6. id,
  7. sn,
  8. oprno,
  9. line_sn AS lineSn,
  10. content,
  11. create_date AS createDate
  12. FROM
  13. mes_product_arc_welding
  14. WHERE
  15. id = #{id}
  16. ORDER BY create_date DESC
  17. LIMIT 1
  18. </select>
  19. <!-- 查询数据
  20. <select id="findList" resultType="MesProductArcWelding">
  21. SELECT ${sqlMap.column.toSql()}
  22. FROM ${sqlMap.table.toSql()}
  23. <where>
  24. ${sqlMap.where.toSql()}
  25. </where>
  26. ORDER BY ${sqlMap.order.toSql()}
  27. </select> -->
  28. <select id="findList" resultType="MesProductArcWelding">
  29. SELECT
  30. ${sqlMap.column.toSql()},
  31. (
  32. SELECT r.update_by
  33. FROM mes_product_record r
  34. WHERE r.sn = a.sn
  35. AND r.oprno = a.oprno
  36. AND (r.line_sn = a.line_sn OR r.cate_sn = a.line_sn)
  37. ORDER BY CASE WHEN r.update_by IS NOT NULL AND r.update_by != '' AND r.update_by != 'system' THEN 0 ELSE 1 END,
  38. r.update_date DESC, r.create_date DESC
  39. LIMIT 1
  40. ) AS "createBy"
  41. FROM ${sqlMap.table.toSql()}
  42. <where>
  43. ${sqlMap.where.toSql()}
  44. </where>
  45. ORDER BY ${sqlMap.order.toSql()}
  46. </select>
  47. <select id="findProductRecordUpdateBy" resultType="String">
  48. SELECT r.update_by
  49. FROM mes_product_record r
  50. WHERE r.sn = #{sn}
  51. AND r.oprno = #{oprno}
  52. AND (r.line_sn = #{lineSn} OR r.cate_sn = #{lineSn})
  53. ORDER BY CASE WHEN r.update_by IS NOT NULL AND r.update_by != '' AND r.update_by != 'system' THEN 0 ELSE 1 END,
  54. r.update_date DESC, r.create_date DESC
  55. LIMIT 1
  56. </select>
  57. </mapper>