郑永安
2023-06-19 59e91a4e9ddaf23cebb12993c774aa899ab22d16
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?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.firework.Mapper.PatrolOrderInfoMapper" >
  <resultMap id="BaseResultMap" type="com.gk.firework.Domain.PatrolOrderInfo" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="userid" property="userid" jdbcType="BIGINT" />
    <result column="companyid" property="companyid" jdbcType="BIGINT" />
    <result column="ismend" property="ismend" jdbcType="TINYINT" />
    <result column="createdby" property="createdby" jdbcType="VARCHAR" />
    <result column="createddate" property="createddate" jdbcType="TIMESTAMP" />
    <result column="modifiedby" property="modifiedby" jdbcType="VARCHAR" />
    <result column="modifieddate" property="modifieddate" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, userid, companyid, ismend, createdby, createddate, modifiedby, modifieddate
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    <!--          -->
    select
    <include refid="Base_Column_List" />
    from patrolorder
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectDataGrid" resultType="com.gk.firework.Domain.Vo.PatrolOrderVo">
    SELECT
      patrolorder.id,
      patrolorder.ismend,
      patrolorder.createdby,
      patrolorder.createddate,
      patrolorder.modifiedby,
      patrolorder.modifieddate,
      `user`.username as checkname,
      enterprise.enterprisename,
      enterprise.safetysupervision,
      enterprise.officeaddress,
      enterprise.officephone,
      mainprincipal.`name` as mainperson
    FROM
    patrolorder
    LEFT JOIN `user` on `user`.id = patrolorder.userid
    LEFT JOIN enterprise on enterprise.id = patrolorder.companyid
    LEFT JOIN enterprisestaff as mainprincipal ON enterprise.id = mainprincipal.belongid and mainprincipal.type = '主要负责人'
    <where>
      1=1
      and `user`.isdel = 0
      and enterprise.validflag = 1
      <if test="condition.starttime != null">
        and patrolorder.modifieddate &gt;= #{condition.starttime}
      </if>
      <if test="condition.endtime != null">
        and patrolorder.modifieddate &lt;= #{condition.endtime}
      </if>
      <if test="condition.ismend != null">
        and patrolorder.ismend = #{condition.ismend}
      </if>
      <if test="condition.enterprisename != null and condition.enterprisename != ''">
        and enterprise.enterprisename like CONCAT('%',#{condition.enterprisename},'%')
      </if>
      <if test="condition.enterprisetype != null and condition.enterprisetype != ''">
        and enterprise.enterprisetype = #{condition.enterprisetype}
      </if>
      <if test="condition.province != null and condition.province != ''">
        and enterprise.province = #{condition.province}
      </if>
      <if test="condition.city != null and condition.city != ''">
        and enterprise.city = #{condition.city}
      </if>
      <if test="condition.area != null and condition.area != ''">
        and enterprise.district = #{condition.area}
      </if>
      <if test="condition.town != null and condition.town != ''">
        and enterprise.street = #{condition.town}
      </if>
      <if test="condition.community != null and condition.community != ''">
        and enterprise.committee = #{condition.community}
      </if>
      <if test="condition.checkname != null and condition.checkname != ''">
        and `user`.username LIKE CONCAT('%',#{condition.checkname},'%')
      </if>
    </where>
  </select>
  <select id="selectListByEnterprise" resultType="com.gk.firework.Domain.Vo.PatrolOrderVo">
    SELECT
    patrolorder.id,
    patrolorder.ismend,
    patrolorder.createdby,
    patrolorder.createddate,
    patrolorder.modifiedby,
    patrolorder.modifieddate,
    `user`.username as checkname,
    enterprise.enterprisename,
    enterprise.safetysupervision,
    enterprise.officeaddress,
    enterprise.officephone,
    mainprincipal.`name` as mainperson
    FROM
    patrolorder
    LEFT JOIN `user` on `user`.id = patrolorder.userid
    LEFT JOIN enterprise on enterprise.id = patrolorder.companyid
    LEFT JOIN enterprisestaff as mainprincipal ON enterprise.id = mainprincipal.belongid and mainprincipal.type = '主要负责人'
    <where>
      1=1
      and `user`.isdel = 0
      and enterprise.validflag = 1
      <if test="enterprisename != null and enterprisename != ''">
        and enterprise.enterprisename like CONCAT('%',#{enterprisename},'%')
      </if>
      <if test="username != null and username != ''">
        and `user`.username LIKE CONCAT('%',#{username},'%')
      </if>
    </where>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    <!--          -->
    delete from patrolorder
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <update id="updateByPrimaryKeySelective" parameterType="com.gk.firework.Domain.PatrolOrderInfo" >
    <!--          -->
    update patrolorder
    <set >
      <if test="userid != null" >
        userid = #{userid,jdbcType=BIGINT},
      </if>
      <if test="companyid != null" >
        companyid = #{companyid,jdbcType=BIGINT},
      </if>
      <if test="ismend != null" >
        ismend = #{ismend,jdbcType=TINYINT},
      </if>
      <if test="createdby != null" >
        createdby = #{createdby,jdbcType=VARCHAR},
      </if>
      <if test="createddate != null" >
        createddate = #{createddate,jdbcType=TIMESTAMP},
      </if>
      <if test="modifiedby != null" >
        modifiedby = #{modifiedby,jdbcType=VARCHAR},
      </if>
      <if test="modifieddate != null" >
        modifieddate = #{modifieddate,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gk.firework.Domain.PatrolOrderInfo" >
    <!--          -->
    update patrolorder
    set userid = #{userid,jdbcType=BIGINT},
      companyid = #{companyid,jdbcType=BIGINT},
      ismend = #{ismend,jdbcType=TINYINT},
      createdby = #{createdby,jdbcType=VARCHAR},
      createddate = #{createddate,jdbcType=TIMESTAMP},
      modifiedby = #{modifiedby,jdbcType=VARCHAR},
      modifieddate = #{modifieddate,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>