Fixiaobai
2023-10-17 c3ae5731addf58b173a4a5339ad4093030956424
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?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.BasicParamTemplateMapper">
 
    <resultMap id="operationTemplateMap" type="com.chinaztt.mes.basic.entity.Template">
        <id property="id" column="id"/>
        <result property="templateName" column="template_name"/>
        <result property="templateNo" column="template_no"/>
        <result property="templateType" column="template_type"/>
        <result property="remark" column="remark"/>
        <result property="dataType" column="data_type"/>
    </resultMap>
    <select id="getOperationTemplate" resultMap="operationTemplateMap">
        SELECT A.*
        FROM basic_template A
                 LEFT JOIN technology_join_operation_template B ON B.technology_template_id = A."id"
        WHERE B.technology_operation_id = #{id}
    </select>
    <select id="getTemplate" resultMap="operationTemplateMap">
        SELECT A.*
        FROM basic_template A
                 LEFT JOIN technology_join_operation_template B ON B.technology_template_id = A."id"
        WHERE B.technology_operation_id = #{id}
          and A.data_type = '生产要求'
    </select>
    <select id="getOperationTemplateByType" resultType="com.chinaztt.mes.basic.entity.TemplateTypeRelation">
        SELECT A.template_type_name
        FROM basic_template_type_relation A
        <if test="ew.emptyOfWhere == false">
            <where>
                ${ew.SqlSegment}
            </where>
        </if>
        GROUP BY A.template_type_name
    </select>
    <select id="getTemplateUpdate" resultMap="operationTemplateMap">
        SELECT
        A.*
        FROM
        basic_template
        A LEFT JOIN technology_join_operation_template B ON B.technology_template_id = A."id"
        LEFT JOIN plan_manufacturing_order_rou
            ting_operation C ON C.operation_id = B.technology_operation_id
        LEFT JOIN production_operation_task D ON D.mo_routing_operation_id = C."id"
        WHERE D."id" = #{id}
        <if test="template.dataType != null and template.dataType != ''">
            and A.data_type = #{template.dataType}
        </if>
        <if test="template.templateType != null and template.templateType != ''">
            and A.template_type = #{template.templateType}
        </if>
    </select>
    <select id="getTemplateByType" resultMap="operationTemplateMap">
        SELECT
        *
        FROM
        basic_template
        <if test="ew.emptyOfWhere == false">
            <where>
                ${ew.SqlSegment}
            </where>
        </if>
    </select>
</mapper>