<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
~
|
~ Copyright (c) 2018-2025, ztt All rights reserved.
|
~
|
~ Redistribution and use in source and binary forms, with or without
|
~ modification, are permitted provided that the following conditions are met:
|
~
|
~ Redistributions of source code must retain the above copyright notice,
|
~ this list of conditions and the following disclaimer.
|
~ Redistributions in binary form must reproduce the above copyright
|
~ notice, this list of conditions and the following disclaimer in the
|
~ documentation and/or other materials provided with the distribution.
|
~ Neither the name of the pig4cloud.com developer nor the names of its
|
~ contributors may be used to endorse or promote products derived from
|
~ this software without specific prior written permission.
|
~ Author: ztt
|
~
|
-->
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.chinaztt.mes.basic.mapper.ParamMapper">
|
|
<resultMap id="paramMap" type="com.chinaztt.mes.basic.dto.ParamDTO">
|
<id property="id" column="id"/>
|
<result property="code" column="code"/>
|
<result property="parameterItem" column="parameter_item"/>
|
<result property="parameterFormat" column="parameter_format"/>
|
<result property="type" column="type"/>
|
<result property="unit" column="unit"/>
|
<result property="createUser" column="create_user"/>
|
<result property="updateUser" column="update_user"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="technologyOperationTemplateId" column="technology_operation_template_id"/>
|
<result property="index" column="index"/>
|
<result property="paramValue" column="param_value"/>
|
<result property="defaultValue" column="default_value"/>
|
<result property="dict" column="dict"/>
|
<collection property="sysDictItemList" ofType="com.chinaztt.ztt.admin.api.entity.SysDictItem"
|
column="dict" select="com.chinaztt.mes.basic.mapper.ParamMapper.getDict">
|
</collection>
|
</resultMap>
|
|
<select id="getDict" resultType="com.chinaztt.ztt.admin.api.entity.SysDictItem">
|
SELECT *
|
FROM sys_dict_item
|
WHERE type = #{dict}
|
</select>
|
|
<select id="getTechnologyParamPage" resultMap="paramMap">
|
SELECT A.*
|
FROM basic_param A
|
LEFT JOIN technology_join_operation_param B ON B.technology_param_id = A."id"
|
LEFT JOIN technology_operation C ON C."id" = B.technology_operation_id
|
WHERE C."id" = #{id}
|
<if test="ew.emptyOfWhere == false">
|
and ${ew.SqlSegment}
|
</if>
|
</select>
|
<select id="getParamById" resultMap="paramMap">
|
SELECT D.*,B.technology_operation_template_id,B.sort as index,B.default_value
|
FROM basic_template A
|
LEFT JOIN basic_param_join_template B ON B.technology_operation_template_id = A."id"
|
LEFT JOIN basic_param D ON D."id" = B.technology_operation_param_id
|
<if test="ew.emptyOfWhere == false">
|
${ew.customSqlSegment}
|
</if>
|
ORDER BY B.sort
|
</select>
|
<select id="getParam" resultMap="paramMap">
|
SELECT D.*,B.default_value
|
FROM basic_param D
|
LEFT JOIN basic_param_join_template B ON B.technology_operation_param_id = D."id"
|
WHERE B.technology_operation_template_id = #{id}
|
order by B.sort
|
</select>
|
<select id="getTemplateParam" resultMap="paramMap">
|
SELECT D.*,B.sort as index,B.default_value,B.technology_operation_template_id
|
FROM basic_param D
|
LEFT JOIN basic_param_join_template B ON B.technology_operation_param_id = D."id"
|
WHERE B.technology_operation_template_id = #{id}
|
order by B.sort
|
</select>
|
|
<select id="getLastParamById" resultMap="paramMap">
|
SELECT
|
D.*,
|
B.technology_operation_template_id,
|
B.sort AS index,
|
B.default_value,
|
tempA.param_value
|
FROM basic_template A
|
LEFT JOIN basic_param_join_template B ON B.technology_operation_template_id = A."id"
|
LEFT JOIN basic_param D ON D."id" = B.technology_operation_param_id
|
LEFT JOIN (SELECT *
|
FROM production_operation_task_param potp
|
WHERE potp.operation_task_record_id =
|
(SELECT potr."id"
|
FROM production_operation_task_record potr
|
LEFT JOIN production_operation_task pot ON pot."id" = potr.operation_task_id
|
WHERE pot.workstation_id = #{paramDTO.workstationId}
|
AND potr.operation_template_id = #{paramDTO.technologyOperationTemplateId}
|
ORDER BY potr.create_time DESC
|
LIMIT 1)
|
)
|
tempA
|
ON tempA
|
.
|
code =
|
D
|
.
|
code
|
WHERE A."id" = #{paramDTO.technologyOperationTemplateId}
|
ORDER BY B.sort
|
</select>
|
</mapper>
|