MonitorCompanyMapper.xml
8.9 KB
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
161
162
163
164
165
166
167
168
169
170
<?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.ruoyi.web.controller.business.mapper.MonitorCompanyMapper">
<resultMap type="com.ruoyi.web.controller.business.domain.MonitorCompany" id="MonitorCompanyResult">
<result property="id" column="id" />
<result property="userId" column="userId" />
<result property="companyId" column="company_id"/>
<result property="ename" column="ename" />
<result property="lrName" column="lr_name" />
<result property="regStatus" column="reg_status" />
<result property="regCapital" column="reg_capital" />
<result property="establishDate" column="establish_date" />
<result property="creditCode" column="credit_code" />
<result property="monitorStatus" column="monitor_status" />
<result property="status" column="status" />
<result property="createTime" column="createTime" />
<result property="updateTime" column="updateTime" />
</resultMap>
<sql id="selectMonitorCompanyVo">
select id, userId, company_id ,ename, lr_name, reg_status, reg_capital, establish_date, credit_code, monitor_status, status, createTime, updateTime from monitor_company
</sql>
<select id="selectMonitorCompanyList" parameterType="com.ruoyi.web.controller.business.domain.MonitorCompany" resultMap="MonitorCompanyResult">
<include refid="selectMonitorCompanyVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="userId != null and userId != '' "> and userId = #{userId}</if>
<if test="ename != null and ename != '' ">
<bind name="ename" value=" '%'+ename+'%'"/>
and ename like #{ename}
</if>
<if test="companyId != null and companyId !='' ">and company_id = #{companyId}</if>
<if test="lrName != null and lrName != '' "> and lr_name = #{lrName}</if>
<if test="regStatus != null and regStatus != '' "> and reg_status = #{regStatus}</if>
<if test="regCapital != null and regCapital != '' "> and reg_capital = #{regCapital}</if>
<if test="establishDate != null and establishDate != '' "> and establish_date = #{establishDate}</if>
<if test="creditCode != null and creditCode != '' "> and credit_code = #{creditCode}</if>
<if test="monitorStatus != null and monitorStatus != '' "> and monitor_status = #{monitorStatus}</if>
<if test="status != null and status != '' "> and status = #{status}</if>
<if test="createTime != null "> and createTime = #{createTime}</if>
<if test="updateTime != null "> and updateTime = #{updateTime}</if>
</where>
</select>
<select id="selectMonitorCompanyById" parameterType="Integer" resultMap="MonitorCompanyResult">
<include refid="selectMonitorCompanyVo"/>
where id = #{id}
</select>
<select id="selectMonitorByUserId"
resultType="com.ruoyi.web.controller.business.domain.MonitorCompany">
SELECT
*
FROM
monitor_company
WHERE
userId = #{userId} AND monitor_status = '0'
</select>
<select id="selectMonitorAuthorityList"
resultType="com.ruoyi.web.controller.business.domain.MonitorCompanyVo">
SELECT
com.id as id,
fu.userName as userName,
fu.org_id as orgId,
com.ename as ename,
com.lr_name as lrName,
com.reg_status as regStatus,
com.reg_capital as regCapital,
com.credit_code as creditCode,
com.establish_date as establishDate
FROM
monitor_company com
LEFT JOIN org_dept od ON com.company_id = od.dept_id
LEFT JOIN front_user fu on com.userId=fu.id
where od.org_id=#{orgId}
<if test="ename != null and ename != '' " >
AND com.ename like concat('%', #{ename}, '%')
</if>
<if test="status != null and status != '' " >
AND com.status = #{status}
</if>
<if test="monitorStatus != null and monitorStatus != '' " >
AND com.monitor_status = #{monitorStatus}
</if>
</select>
<select id="getMonitorCompanySearchCount" parameterType="String" resultType="java.lang.Long">
SELECT
COUNT( id )
FROM
monitor_company
WHERE
monitor_status = 0
AND `status` = 0
AND userId = #{id}
</select>
<insert id="insertMonitorCompany" parameterType="com.ruoyi.web.controller.business.domain.MonitorCompany" useGeneratedKeys="true" keyProperty="id">
insert into monitor_company
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null and userId != '' ">userId,</if>
<if test="ename != null and ename != '' ">ename,</if>
<if test="companyId != null and companyId !='' ">company_id,</if>
<if test="lrName != null and lrName != '' ">lr_name,</if>
<if test="regStatus != null and regStatus != '' ">reg_status,</if>
<if test="regCapital != null and regCapital != '' ">reg_capital,</if>
<if test="establishDate != null and establishDate != '' ">establish_date,</if>
<if test="creditCode != null and creditCode != '' ">credit_code,</if>
<if test="monitorStatus != null and monitorStatus != '' ">monitor_status,</if>
<if test="status != null and status != '' ">status,</if>
<if test="createTime != null ">createTime,</if>
<if test="updateTime != null ">updateTime,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null and userId != '' ">#{userId},</if>
<if test="ename != null and ename != '' ">#{ename},</if>
<if test="companyId != null and companyId !='' ">#{companyId},</if>
<if test="lrName != null and lrName != '' ">#{lrName},</if>
<if test="regStatus != null and regStatus != '' ">#{regStatus},</if>
<if test="regCapital != null and regCapital != '' ">#{regCapital},</if>
<if test="establishDate != null and establishDate != '' ">#{establishDate},</if>
<if test="creditCode != null and creditCode != '' ">#{creditCode},</if>
<if test="monitorStatus != null and monitorStatus != '' ">#{monitorStatus},</if>
<if test="status != null and status != '' ">#{status},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateTime != null ">#{updateTime},</if>
</trim>
</insert>
<update id="updateMonitorCompany" parameterType="com.ruoyi.web.controller.business.domain.MonitorCompany">
update monitor_company
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null and userId != '' ">userId = #{userId},</if>
<if test="ename != null and ename != '' ">ename = #{ename},</if>
<if test="companyId != null and companyId !='' ">company_id = #{companyId}</if>
<if test="lrName != null and lrName != '' ">lr_name = #{lrName},</if>
<if test="regStatus != null and regStatus != '' ">reg_status = #{regStatus},</if>
<if test="regCapital != null and regCapital != '' ">reg_capital = #{regCapital},</if>
<if test="establishDate != null and establishDate != '' ">establish_date = #{establishDate},</if>
<if test="creditCode != null and creditCode != '' ">credit_code = #{creditCode},</if>
<if test="monitorStatus != null and monitorStatus != '' ">monitor_status = #{monitorStatus},</if>
<if test="status != null and status != '' ">status = #{status},</if>
<if test="createTime != null ">createTime = #{createTime},</if>
<if test="updateTime != null ">updateTime = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMonitorCompanyById" parameterType="Integer">
delete from monitor_company where id = #{id}
</delete>
<delete id="deleteMonitorCompanyByIds" parameterType="String">
delete from monitor_company where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateMonitorStatus" parameterType="String">
update monitor_company set monitor_status='1',updateTime=now() where userId=#{userId} and ename = #{ename}
</update>
<update id="updateMonitorCode" parameterType="com.ruoyi.web.controller.business.domain.MonitorCompany">
update monitor_company set monitor_status='0',updateTime=now() where userId=#{userId} and ename = #{ename}
</update>
</mapper>