| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.jeesite.modules.mes.dao.MesProductArcWeldingDao">
- <select id="findLatestById" resultType="com.jeesite.modules.mes.entity.MesProductArcWelding">
- SELECT
- id,
- sn,
- oprno,
- line_sn AS lineSn,
- content,
- create_date AS createDate
- FROM
- mes_product_arc_welding
- WHERE
- id = #{id}
- ORDER BY create_date DESC
- LIMIT 1
- </select>
-
- <!-- 查询数据
- <select id="findList" resultType="MesProductArcWelding">
- SELECT ${sqlMap.column.toSql()}
- FROM ${sqlMap.table.toSql()}
- <where>
- ${sqlMap.where.toSql()}
- </where>
- ORDER BY ${sqlMap.order.toSql()}
- </select> -->
- <select id="findList" resultType="MesProductArcWelding">
- SELECT
- ${sqlMap.column.toSql()},
- (
- SELECT r.update_by
- FROM mes_product_record r
- WHERE r.sn = a.sn
- AND r.oprno = a.oprno
- AND (r.line_sn = a.line_sn OR r.cate_sn = a.line_sn)
- ORDER BY CASE WHEN r.update_by IS NOT NULL AND r.update_by != '' AND r.update_by != 'system' THEN 0 ELSE 1 END,
- r.update_date DESC, r.create_date DESC
- LIMIT 1
- ) AS "createBy"
- FROM ${sqlMap.table.toSql()}
- <where>
- ${sqlMap.where.toSql()}
- </where>
- ORDER BY ${sqlMap.order.toSql()}
- </select>
- <select id="findProductRecordUpdateBy" resultType="String">
- SELECT r.update_by
- FROM mes_product_record r
- WHERE r.sn = #{sn}
- AND r.oprno = #{oprno}
- AND (r.line_sn = #{lineSn} OR r.cate_sn = #{lineSn})
- ORDER BY CASE WHEN r.update_by IS NOT NULL AND r.update_by != '' AND r.update_by != 'system' THEN 0 ELSE 1 END,
- r.update_date DESC, r.create_date DESC
- LIMIT 1
- </select>
-
- </mapper>
|