郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
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
<?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.gk.hotwork.Mapper.MajorEquipmentMapper" >
  <resultMap id="BaseResultMap" type="com.gk.hotwork.Domain.MajorEquipment" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="valid_flag" property="validFlag" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="update_by" property="updateBy" jdbcType="VARCHAR" />
 
    <result column="serial_number" property="serialNumber" jdbcType="BIGINT" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="status" property="status" jdbcType="VARCHAR" />
    <result column="volume" property="volume" jdbcType="VARCHAR" />
    <result column="user_id" property="userId" jdbcType="BIGINT" />
    <result column="user_name" property="userName" jdbcType="VARCHAR" />
    <result column="area_id" property="areaId" jdbcType="BIGINT" />
    <result column="area_name" property="areaName" jdbcType="VARCHAR" />
 
  </resultMap>
  <select id="selectPages" resultMap="BaseResultMap">
    SELECT
    a.*,
    b.realname user_name,
    c.
    VALUE
    AS area_name
    FROM
    major_equipment AS a
    LEFT JOIN USER AS b ON a.user_id = b.id
    AND b.isdel = 0
    LEFT JOIN dictionaryitem AS c ON a.area_id = c.id
    AND c.STATUS = 1
    WHERE
    a.valid_flag = 1
    <if test="params.name != null  and params.name != ''">
      and a.name like concat("%",#{params.name},"%")
    </if>
    <if test="params.status != null">
      and a.status = #{params.status}
    </if>
    <if test="params.areaId != null">
      and a.area_id = #{params.areaId}
    </if>
    order by a.create_time desc
  </select>
 
 
  <select id="getMajorEquipment" resultMap="BaseResultMap">
    select id , name , serial_number
    from major_equipment
    where valid_flag = 1 and status=0
  </select>
 
  <select id="getBySerialNumber" resultMap="BaseResultMap">
    select id , name , serial_number
    from major_equipment
    where valid_flag = 1 and serial_number= #{serialNumber}
    <if test="id != null">
      and id != #{id}
    </if>
  </select>
 
</mapper>