yangys
2025-11-18 8e944cfabb253fc2556588e308e282586043f7b0
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
<?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.qianwen.smartman.modules.smis.mapper.ProcessMapper">
 
 
    <select id="listPage" resultType="com.qianwen.smartman.modules.smis.dto.ProcessDTO">
        SELECT
        p.id,p.code,p.name,p.type,p.description,bd.dict_value as typeName,p.status
        FROM blade_process p
        LEFT JOIN blade_dict bd on bd.dict_key = p.type and bd.code = 'work_type'
        WHERE p.is_deleted = 0 and p.status = #{status}
        <if test="keyword != null and keyword != ''">
            AND (p.code LIKE concat(#{keyword},'%') or p.name LIKE concat(#{keyword},'%') or bd.dict_value LIKE
            concat(#{keyword},'%'))
        </if>
        ORDER BY p.create_time DESC , p.id DESC ;
        <!--        ORDER BY p.create_time DESC-->
        <!--        <if test="keywords != null and keywords != ''">-->
        <!--            &lt;!&ndash; bind标签的两个属性都是必选项,name为绑定到上下文的变量名,value为OGNL表达式 &ndash;&gt;-->
        <!--            <bind name="temp" value="'%' + keywords + '%'"/>-->
        <!--            and CONCAT_WS("-",w.code) like #{temp}-->
        <!--        </if>-->
    </select>
    <resultMap id="BaseResultMap" type="com.qianwen.smartman.modules.smis.dto.ProcessDTO">
        <id property="id" column="id"/>
        <result column="code" property="code"/>
        <result column="name" property="name"/>
        <result column="type" property="type"/>
        <result column="description" property="description"/>
    </resultMap>
 
    <select id="selectByIdWithType" resultType="com.qianwen.smartman.modules.smis.vo.ProcessDetailVO" parameterType="long">
        SELECT p.id,
               p.CODE,
               p.NAME,
               p.type,
               p.description,
               bd.dict_value AS typeName
        FROM blade_process p
                 LEFT JOIN blade_dict bd ON bd.dict_key = p.type
            AND bd.CODE = 'work_type'
        WHERE p.is_deleted = 0
          AND p.id = #{processId}
    </select>
 
    <select id="existCraftProcess" resultType="java.lang.Integer">
        select count(*)
        from blade_process bp
        where bp.is_deleted = 0
        and exists(select *
        from blade_production_craft_process bpcp
        where bpcp.is_deleted = 0
        and bpcp.process_id = bp.id
        and bp.id in
        <foreach collection="processIds" item="processId" index="index" open="(" close=")" separator=",">
            #{processId}
        </foreach>
        )
    </select>
 
    <select id="listProcessExcel" resultType="com.qianwen.smartman.modules.smis.excel.ProcessExcel">
        SELECT p.code,p.name,p.description,bd.dict_value as typeName
        FROM blade_process p
        LEFT JOIN blade_dict bd on bd.dict_key = p.type and bd.code = 'work_type'
        WHERE p.is_deleted = 0 and p.status = #{status}
        <if test="keyword != null and keyword != ''">
            AND (p.code LIKE concat(#{keyword},'%') or p.name LIKE concat(#{keyword},'%') or bd.dict_value LIKE
            concat(#{keyword},'%'))
        </if>
        ORDER BY p.create_time DESC , p.id DESC ;
    </select>
</mapper>