MonitorCompanyNewMapper.xml
10.6 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
171
172
173
174
175
176
<?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.monitorCompanyNew.mapper.MonitorCompanyNewMapper">
<resultMap type="MonitorCompanyNew" id="MonitorCompanyNewResult">
<result property="id" column="id" />
<result property="userId" column="userId" />
<result property="userType" column="user_type" />
<result property="deptId" column="dept_id" />
<result property="groupId" column="group_id" />
<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="base" column="base" />
<result property="monitorStatus" column="monitor_status" />
<result property="status" column="status" />
<result property="createTime" column="createTime" />
<result property="updateTime" column="updateTime" />
</resultMap>
<sql id="selectMonitorCompanyNewVo">
select id, userId, user_type, dept_id, group_id, company_id, ename, lr_name, reg_status, reg_capital, establish_date, credit_code, base, monitor_status, status, createTime, updateTime from monitor_company_new
</sql>
<select id="selectMonitorCompanyNewList" parameterType="MonitorCompanyNew" resultMap="MonitorCompanyNewResult">
<include refid="selectMonitorCompanyNewVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="userId != null and userId != '' "> and userId = #{userId}</if>
<if test="userType != null and userType != '' "> and user_type = #{userType}</if>
<if test="deptId != null and deptId != '' "> and dept_id = #{deptId}</if>
<if test="groupId != null "> and group_id = #{groupId}</if>
<if test="companyId != null and companyId != '' "> and company_id = #{companyId}</if>
<if test="ename != null and ename != '' "> and ename like concat('%', #{ename}, '%')</if>
<if test="lrName != null and lrName != '' "> and lr_name = #{lrName}</if>
<if test="regStatus != null and regStatus != '' "> and reg_status like concat('%', #{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="base != null and base != '' "> and base = #{base}</if>
<if test="monitorStatus != null and monitorStatus != '' "> and monitor_status = #{monitorStatus}</if>
<if test="status != null and status != '' "> and status = #{status}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(createTime,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(createTime,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="updateTime != null "> and updateTime = #{updateTime}</if>
</where>
</select>
<select id="selectMonitorCompanyNewById" parameterType="Integer" resultMap="MonitorCompanyNewResult">
<include refid="selectMonitorCompanyNewVo"/>
where id = #{id}
</select>
<select id="selectMonitorCompanyList"
resultType="com.ruoyi.web.controller.monitorCompanyNew.domain.MonitorCompanyNew" resultMap="MonitorCompanyNewResult">
<include refid="selectMonitorCompanyNewVo"/>
<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="groupId != null "> and group_id = #{groupId}</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="selectMonitorByUserId"
resultType="com.ruoyi.web.controller.monitorCompanyNew.domain.MonitorCompanyNew" resultMap="MonitorCompanyNewResult">
SELECT
*
FROM
monitor_company_new
WHERE
userId = #{userId} AND monitor_status = '0'
</select>
<insert id="insertMonitorCompanyNew" parameterType="MonitorCompanyNew" useGeneratedKeys="true" keyProperty="id">
insert into monitor_company_new
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null and userId != '' ">userId,</if>
<if test="userType != null and userType != '' ">user_type,</if>
<if test="deptId != null and deptId != '' ">dept_id,</if>
<if test="groupId != null ">group_id,</if>
<if test="companyId != null and companyId != '' ">company_id,</if>
<if test="ename != null and ename != '' ">ename,</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="base != null and base != '' ">base,</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="userType != null and userType != '' ">#{userType},</if>
<if test="deptId != null and deptId != '' ">#{deptId},</if>
<if test="groupId != null ">#{groupId},</if>
<if test="companyId != null and companyId != '' ">#{companyId},</if>
<if test="ename != null and ename != '' ">#{ename},</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="base != null and base != '' ">#{base},</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="updateMonitorCompanyNew" parameterType="MonitorCompanyNew">
update monitor_company_new
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null and userId != '' ">userId = #{userId},</if>
<if test="userType != null and userType != '' ">user_type = #{userType},</if>
<if test="deptId != null and deptId != '' ">dept_id = #{deptId},</if>
<if test="groupId != null ">group_id = #{groupId},</if>
<if test="companyId != null and companyId != '' ">company_id = #{companyId},</if>
<if test="ename != null and ename != '' ">ename = #{ename},</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="base != null and base != '' ">base = #{base},</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>
<update id="updateMonitorCode">
update monitor_company_new set monitor_status='0',updateTime=now() where userId=#{userId} and ename = #{ename}
</update>
<update id="updateMonitorStatusForCode" parameterType="String">
update monitor_company_new set monitor_status='1',updateTime=now() where userId= #{userId} and credit_code = #{code}
</update>
<delete id="deleteMonitorCompanyNewById" parameterType="Integer">
delete from monitor_company_new where id = #{id}
</delete>
<delete id="deleteMonitorCompanyNewByIds" parameterType="String">
delete from monitor_company_new where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>