瀏覽代碼

设备表更新

lamphua 1 年之前
父節點
當前提交
3906291a1f

+ 13
- 12
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarApprovalController.java 查看文件

@@ -163,19 +163,20 @@ public class CmcCarApprovalController extends BaseController
163 163
         if (formDataJson.getString("dispatchComment") != null) {
164 164
             cmcCarApproval.setDispatcher(getLoginUser().getUserId());
165 165
             cmcCarApproval.setDispatchComment(formDataJson.getString("dispatchComment"));
166
-            if (formDataJson.getString("cars") != null && formDataJson.getString("drivers") != null) {
167
-                String carString = formDataJson.getString("cars").substring(1, formDataJson.getString("cars").length() - 1);
168
-                cmcCarApproval.setCars(carString);
169
-                cmcCarApproval.setDrivers(formDataJson.getString("drivers").substring(1, formDataJson.getString("drivers").length() - 1));
170
-                String[] cars = carString.split(",");
171
-                BigDecimal estimateCost = new BigDecimal(0);
172
-                for (String car : cars) {
173
-                    CmcCar cmcCar = cmcCarService.selectCmcCarByCarId(Integer.parseInt(car));
174
-                    if (cmcCar.getDayCost() != null)
175
-                        estimateCost = estimateCost.add(cmcCar.getDayCost().multiply(new BigDecimal(cmcCarApproval.getDays())));
176
-                }
177
-                cmcCarApproval.setEstimateCost(estimateCost);
166
+        }
167
+        if (formDataJson.getString("cars") != null && formDataJson.getString("drivers") != null) {
168
+            cmcCarApproval.setDispatcher(getLoginUser().getUserId());
169
+            String carString = formDataJson.getString("cars").substring(1, formDataJson.getString("cars").length() - 1);
170
+            cmcCarApproval.setCars(carString);
171
+            cmcCarApproval.setDrivers(formDataJson.getString("drivers").substring(1, formDataJson.getString("drivers").length() - 1));
172
+            String[] cars = carString.split(",");
173
+            BigDecimal estimateCost = new BigDecimal(0);
174
+            for (String car : cars) {
175
+                CmcCar cmcCar = cmcCarService.selectCmcCarByCarId(Integer.parseInt(car));
176
+                if (cmcCar.getDayCost() != null)
177
+                    estimateCost = estimateCost.add(cmcCar.getDayCost().multiply(new BigDecimal(cmcCarApproval.getDays())));
178 178
             }
179
+            cmcCarApproval.setEstimateCost(estimateCost);
179 180
         }
180 181
         cmcCarApprovalService.updateCmcCarApproval(cmcCarApproval);
181 182
         return AjaxResult.success("修改用车审批表成功");

+ 1
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarController.java 查看文件

@@ -74,7 +74,7 @@ public class CmcCarController extends BaseController
74 74
         CmcCar cmcCar = cmcCarService.selectCmcCarByCarId(carId);
75 75
         jsonObject.put("carId", cmcCar.getCarId());
76 76
         jsonObject.put("licensePlate", cmcCar.getLicensePlate());
77
-        jsonObject.put("driver", userService.selectUserById(cmcCar.getDriver()).getNickName());
77
+        jsonObject.put("driver", cmcCar.getDriver() != null ? userService.selectUserById(cmcCar.getDriver()).getNickName() : "");
78 78
         jsonObject.put("brand", cmcCar.getBrand());
79 79
         jsonObject.put("series", cmcCar.getSeries());
80 80
         jsonObject.put("cost", cmcCar.getCost());

+ 12
- 12
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceApprovalController.java 查看文件

@@ -152,25 +152,25 @@ public class CmcDeviceApprovalController extends BaseController
152 152
             cmcDeviceApproval.setManagerUserId(getLoginUser().getUserId());
153 153
             cmcDeviceApproval.setManagerComment(formDataJson.getString("managerComment"));
154 154
         }
155
-
156 155
         if (formDataJson.getDate("returnDate") != null) {
157 156
             cmcDeviceApproval.setReturnDate(formDataJson.getDate("returnDate"));
158 157
         }
159 158
         if (formDataJson.getString("dispatchComment") != null) {
160 159
             cmcDeviceApproval.setDispatcher(getLoginUser().getUserId());
161 160
             cmcDeviceApproval.setDispatchComment(formDataJson.getString("dispatchComment"));
162
-            if (formDataJson.getString("devices") != null) {
163
-                String deviceString = formDataJson.getString("devices").substring(1, formDataJson.getString("devices").length() - 1);
164
-                cmcDeviceApproval.setDevices(deviceString);
165
-                String[] devices = deviceString.split(",");
166
-                BigDecimal estimateCost = new BigDecimal(0);
167
-                for (String device : devices) {
168
-                    CmcDevice cmcDevice = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(device));
169
-                    if (cmcDevice.getDayCost() != null)
170
-                        estimateCost = estimateCost.add(cmcDevice.getDayCost().multiply(new BigDecimal(cmcDeviceApproval.getDays())));
171
-                }
172
-                cmcDeviceApproval.setEstimateCost(estimateCost);
161
+        }
162
+        if (formDataJson.getString("devices") != null) {
163
+            cmcDeviceApproval.setDispatcher(getLoginUser().getUserId());
164
+            String deviceString = formDataJson.getString("devices").substring(1, formDataJson.getString("devices").length() - 1);
165
+            cmcDeviceApproval.setDevices(deviceString);
166
+            String[] devices = deviceString.split(",");
167
+            BigDecimal estimateCost = new BigDecimal(0);
168
+            for (String device : devices) {
169
+                CmcDevice cmcDevice = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(device));
170
+                if (cmcDevice.getDayCost() != null)
171
+                    estimateCost = estimateCost.add(cmcDevice.getDayCost().multiply(new BigDecimal(cmcDeviceApproval.getDays())));
173 172
             }
173
+            cmcDeviceApproval.setEstimateCost(estimateCost);
174 174
         }
175 175
         cmcDeviceApprovalService.updateCmcDeviceApproval(cmcDeviceApproval);
176 176
         return AjaxResult.success("修改设备审批表成功");

+ 129
- 29
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcDevice.java 查看文件

@@ -10,9 +10,9 @@ import com.ruoyi.common.core.domain.BaseEntity;
10 10
 
11 11
 /**
12 12
  * cmc设备信息对象 cmc_device
13
- * 
13
+ *
14 14
  * @author cmc
15
- * @date 2024-03-05
15
+ * @date 2024-03-14
16 16
  */
17 17
 public class CmcDevice extends BaseEntity
18 18
 {
@@ -21,10 +21,14 @@ public class CmcDevice extends BaseEntity
21 21
     /** 设备id */
22 22
     private Integer deviceId;
23 23
 
24
-    /** 设备编号 */
25
-    @Excel(name = "设备编号")
24
+    /** 出厂编号 */
25
+    @Excel(name = "出厂编号")
26 26
     private String code;
27 27
 
28
+    /** 设备名称 */
29
+    @Excel(name = "设备名称")
30
+    private String name;
31
+
28 32
     /** 设备类别 */
29 33
     @Excel(name = "设备类别")
30 34
     private String type;
@@ -34,22 +38,47 @@ public class CmcDevice extends BaseEntity
34 38
     @Excel(name = "购置时间", width = 30, dateFormat = "yyyy-MM-dd")
35 39
     private Date acquisitionTime;
36 40
 
37
-    /** 总价 */
38
-    @Excel(name = "总价")
41
+    /** 购买价格 */
42
+    @Excel(name = "购买价格")
39 43
     private BigDecimal cost;
40 44
 
41 45
     /** 预计使用年限 */
42 46
     @Excel(name = "预计使用年限")
43 47
     private Integer expectLife;
44 48
 
45
-    /** 设备系列 */
46
-    @Excel(name = "设备系列")
49
+    /** 规格型号 */
50
+    @Excel(name = "规格型号")
47 51
     private String series;
48 52
 
53
+    /** 设备品牌 */
54
+    @Excel(name = "设备品牌")
55
+    private String brand;
56
+
49 57
     /** 单日成本 */
50 58
     @Excel(name = "单日成本")
51 59
     private BigDecimal dayCost;
52 60
 
61
+    /** 存放地点 */
62
+    @Excel(name = "存放地点")
63
+    private String place;
64
+
65
+    /** 校验周期(年) */
66
+    @Excel(name = "校验周期", readConverterExp = "年=")
67
+    private Integer checkTerm;
68
+
69
+    /** 校验时间 */
70
+    @JsonFormat(pattern = "yyyy-MM-dd")
71
+    @Excel(name = "校验时间", width = 30, dateFormat = "yyyy-MM-dd")
72
+    private Date checkTime;
73
+
74
+    /** 保修期(月) */
75
+    @Excel(name = "保修期", readConverterExp = "月=")
76
+    private Integer warranty;
77
+
78
+    /** 管理部门 */
79
+    @Excel(name = "管理部门")
80
+    private Long manageDept;
81
+
53 82
     public void setDeviceId(Integer deviceId)
54 83
     {
55 84
         this.deviceId = deviceId;
@@ -59,60 +88,78 @@ public class CmcDevice extends BaseEntity
59 88
     {
60 89
         return deviceId;
61 90
     }
62
-    public void setCode(String code) 
91
+    public void setCode(String code)
63 92
     {
64 93
         this.code = code;
65 94
     }
66 95
 
67
-    public String getCode() 
96
+    public String getCode()
68 97
     {
69 98
         return code;
70 99
     }
71
-    public void setType(String type) 
100
+    public void setName(String name)
101
+    {
102
+        this.name = name;
103
+    }
104
+
105
+    public String getName()
106
+    {
107
+        return name;
108
+    }
109
+    public void setType(String type)
72 110
     {
73 111
         this.type = type;
74 112
     }
75 113
 
76
-    public String getType() 
114
+    public String getType()
77 115
     {
78 116
         return type;
79 117
     }
80
-    public void setAcquisitionTime(Date acquisitionTime) 
118
+    public void setAcquisitionTime(Date acquisitionTime)
81 119
     {
82 120
         this.acquisitionTime = acquisitionTime;
83 121
     }
84 122
 
85
-    public Date getAcquisitionTime() 
123
+    public Date getAcquisitionTime()
86 124
     {
87 125
         return acquisitionTime;
88 126
     }
89
-    public void setCost(BigDecimal cost) 
127
+    public void setCost(BigDecimal cost)
90 128
     {
91 129
         this.cost = cost;
92 130
     }
93 131
 
94
-    public BigDecimal getCost() 
132
+    public BigDecimal getCost()
95 133
     {
96 134
         return cost;
97 135
     }
98
-    public void setExpectLife(Integer expectLife) 
136
+    public void setExpectLife(Integer expectLife)
99 137
     {
100 138
         this.expectLife = expectLife;
101 139
     }
102 140
 
103
-    public Integer getExpectLife() 
141
+    public Integer getExpectLife()
104 142
     {
105 143
         return expectLife;
106 144
     }
107
-    public void setSeries(String series) 
145
+    public void setSeries(String series)
108 146
     {
109 147
         this.series = series;
110 148
     }
111 149
 
112
-    public String getSeries() 
150
+    public String getSeries()
113 151
     {
114 152
         return series;
115 153
     }
154
+    public void setBrand(String brand)
155
+    {
156
+        this.brand = brand;
157
+    }
158
+
159
+    public String getBrand()
160
+    {
161
+        return brand;
162
+    }
116 163
     public void setDayCost(BigDecimal dayCost)
117 164
     {
118 165
         this.dayCost = dayCost;
@@ -122,18 +169,71 @@ public class CmcDevice extends BaseEntity
122 169
     {
123 170
         return dayCost;
124 171
     }
172
+    public void setPlace(String place)
173
+    {
174
+        this.place = place;
175
+    }
176
+
177
+    public String getPlace()
178
+    {
179
+        return place;
180
+    }
181
+    public void setCheckTerm(Integer checkTerm)
182
+    {
183
+        this.checkTerm = checkTerm;
184
+    }
185
+
186
+    public Integer getCheckTerm()
187
+    {
188
+        return checkTerm;
189
+    }
190
+    public void setCheckTime(Date checkTime)
191
+    {
192
+        this.checkTime = checkTime;
193
+    }
194
+
195
+    public Date getCheckTime()
196
+    {
197
+        return checkTime;
198
+    }
199
+    public void setWarranty(Integer warranty)
200
+    {
201
+        this.warranty = warranty;
202
+    }
203
+
204
+    public Integer getWarranty()
205
+    {
206
+        return warranty;
207
+    }
208
+    public void setManageDept(Long manageDept)
209
+    {
210
+        this.manageDept = manageDept;
211
+    }
212
+
213
+    public Long getManageDept()
214
+    {
215
+        return manageDept;
216
+    }
125 217
 
126 218
     @Override
127 219
     public String toString() {
128 220
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
129
-            .append("deviceId", getDeviceId())
130
-            .append("code", getCode())
131
-            .append("type", getType())
132
-            .append("acquisitionTime", getAcquisitionTime())
133
-            .append("cost", getCost())
134
-            .append("expectLife", getExpectLife())
135
-            .append("series", getSeries())
136
-            .append("dayCost", getDayCost())
137
-            .toString();
221
+                .append("deviceId", getDeviceId())
222
+                .append("code", getCode())
223
+                .append("name", getName())
224
+                .append("type", getType())
225
+                .append("acquisitionTime", getAcquisitionTime())
226
+                .append("cost", getCost())
227
+                .append("expectLife", getExpectLife())
228
+                .append("series", getSeries())
229
+                .append("brand", getBrand())
230
+                .append("dayCost", getDayCost())
231
+                .append("place", getPlace())
232
+                .append("remark", getRemark())
233
+                .append("checkTerm", getCheckTerm())
234
+                .append("checkTime", getCheckTime())
235
+                .append("warranty", getWarranty())
236
+                .append("manageDept", getManageDept())
237
+                .toString();
138 238
     }
139 239
 }

+ 49
- 10
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcDeviceMapper.xml 查看文件

@@ -7,28 +7,43 @@
7 7
     <resultMap type="CmcDevice" id="CmcDeviceResult">
8 8
         <result property="deviceId"    column="device_id"    />
9 9
         <result property="code"    column="code"    />
10
+        <result property="name"    column="name"    />
10 11
         <result property="type"    column="type"    />
11 12
         <result property="acquisitionTime"    column="acquisition_time"    />
12 13
         <result property="cost"    column="cost"    />
13 14
         <result property="expectLife"    column="expect_life"    />
14 15
         <result property="series"    column="series"    />
15
-        <result property="dayCost"    column="dayCost"    />
16
+        <result property="brand"    column="brand"    />
17
+        <result property="dayCost"    column="day_cost"    />
18
+        <result property="place"    column="place"    />
19
+        <result property="remark"    column="remark"    />
20
+        <result property="checkTerm"    column="check_term"    />
21
+        <result property="checkTime"    column="check_time"    />
22
+        <result property="warranty"    column="warranty"    />
23
+        <result property="manageDept"    column="manage_dept"    />
16 24
     </resultMap>
17 25
 
18 26
     <sql id="selectCmcDeviceVo">
19
-        select device_id, code, type, acquisition_time, cost, expect_life, series, day_cost from cmc_device
27
+        select device_id, code, name, type, acquisition_time, cost, expect_life, series, brand, day_cost, place, remark, check_term, check_time, warranty, manage_dept from cmc_device
20 28
     </sql>
21 29
 
22 30
     <select id="selectCmcDeviceList" parameterType="CmcDevice" resultMap="CmcDeviceResult">
23 31
         <include refid="selectCmcDeviceVo"/>
24 32
         <where>
25
-            <if test="code != null  and code != ''"> and code like concat('%', #{code}, '%')</if>
26
-            <if test="type != null  and type != ''"> and type like concat('%', #{type}, '%')</if>
33
+            <if test="code != null  and code != ''"> and code = #{code}</if>
34
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
35
+            <if test="type != null  and type != ''"> and type = #{type}</if>
27 36
             <if test="acquisitionTime != null "> and acquisition_time = #{acquisitionTime}</if>
28 37
             <if test="cost != null "> and cost = #{cost}</if>
29
-            <if test="dayCost != null "> and day_cost = #{dayCost}</if>
30 38
             <if test="expectLife != null "> and expect_life = #{expectLife}</if>
31
-            <if test="series != null  and series != ''"> and series like concat('%', #{series}, '%')</if>
39
+            <if test="series != null  and series != ''"> and series = #{series}</if>
40
+            <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
41
+            <if test="dayCost != null "> and day_cost = #{dayCost}</if>
42
+            <if test="place != null  and place != ''"> and place = #{place}</if>
43
+            <if test="checkTerm != null "> and check_term = #{checkTerm}</if>
44
+            <if test="checkTime != null "> and check_time = #{checkTime}</if>
45
+            <if test="warranty != null "> and warranty = #{warranty}</if>
46
+            <if test="manageDept != null "> and manage_dept = #{manageDept}</if>
32 47
         </where>
33 48
     </select>
34 49
 
@@ -41,21 +56,37 @@
41 56
         insert into cmc_device
42 57
         <trim prefix="(" suffix=")" suffixOverrides=",">
43 58
             <if test="code != null">code,</if>
59
+            <if test="name != null">name,</if>
44 60
             <if test="type != null">type,</if>
45 61
             <if test="acquisitionTime != null">acquisition_time,</if>
46 62
             <if test="cost != null">cost,</if>
47
-            <if test="dayCost != null">day_cost,</if>
48 63
             <if test="expectLife != null">expect_life,</if>
49 64
             <if test="series != null">series,</if>
65
+            <if test="brand != null">brand,</if>
66
+            <if test="dayCost != null">day_cost,</if>
67
+            <if test="place != null">place,</if>
68
+            <if test="remark != null">remark,</if>
69
+            <if test="checkTerm != null">check_term,</if>
70
+            <if test="checkTime != null">check_time,</if>
71
+            <if test="warranty != null">warranty,</if>
72
+            <if test="manageDept != null">manage_dept,</if>
50 73
         </trim>
51 74
         <trim prefix="values (" suffix=")" suffixOverrides=",">
52 75
             <if test="code != null">#{code},</if>
76
+            <if test="name != null">#{name},</if>
53 77
             <if test="type != null">#{type},</if>
54 78
             <if test="acquisitionTime != null">#{acquisitionTime},</if>
55 79
             <if test="cost != null">#{cost},</if>
56
-            <if test="dayCost != null">#{dayCost},</if>
57 80
             <if test="expectLife != null">#{expectLife},</if>
58 81
             <if test="series != null">#{series},</if>
82
+            <if test="brand != null">#{brand},</if>
83
+            <if test="dayCost != null">#{dayCost},</if>
84
+            <if test="place != null">#{place},</if>
85
+            <if test="remark != null">#{remark},</if>
86
+            <if test="checkTerm != null">#{checkTerm},</if>
87
+            <if test="checkTime != null">#{checkTime},</if>
88
+            <if test="warranty != null">#{warranty},</if>
89
+            <if test="manageDept != null">#{manageDept},</if>
59 90
         </trim>
60 91
     </insert>
61 92
 
@@ -63,17 +94,25 @@
63 94
         update cmc_device
64 95
         <trim prefix="SET" suffixOverrides=",">
65 96
             <if test="code != null">code = #{code},</if>
97
+            <if test="name != null">name = #{name},</if>
66 98
             <if test="type != null">type = #{type},</if>
67 99
             <if test="acquisitionTime != null">acquisition_time = #{acquisitionTime},</if>
68 100
             <if test="cost != null">cost = #{cost},</if>
69
-            <if test="dayCost != null">day_cost = #{dayCost},</if>
70 101
             <if test="expectLife != null">expect_life = #{expectLife},</if>
71 102
             <if test="series != null">series = #{series},</if>
103
+            <if test="brand != null">brand = #{brand},</if>
104
+            <if test="dayCost != null">day_cost = #{dayCost},</if>
105
+            <if test="place != null">place = #{place},</if>
106
+            <if test="remark != null">remark = #{remark},</if>
107
+            <if test="checkTerm != null">check_term = #{checkTerm},</if>
108
+            <if test="checkTime != null">check_time = #{checkTime},</if>
109
+            <if test="warranty != null">warranty = #{warranty},</if>
110
+            <if test="manageDept != null">manage_dept = #{manageDept},</if>
72 111
         </trim>
73 112
         where device_id = #{deviceId}
74 113
     </update>
75 114
 
76
-    <delete id="deleteCmcDeviceByDeviceId" parameterType="Long">
115
+    <delete id="deleteCmcDeviceByDeviceId" parameterType="Integer">
77 116
         delete from cmc_device where device_id = #{deviceId}
78 117
     </delete>
79 118
 

+ 11
- 3
oa-back/sql/sql.sql 查看文件

@@ -1489,13 +1489,21 @@ create table `cmc_car_approval`  (
1489 1489
 drop table if exists `cmc_device`;
1490 1490
 create table `cmc_device`  (
1491 1491
   `device_id`			int					not null auto_increment		comment '设备id',
1492
-  `code`				varchar(20)			default null				comment '设备编号',
1492
+  `code`				varchar(20)			default null				comment '出厂编号',
1493
+  `name`				varchar(20)			default null				comment '设备名称',
1493 1494
   `type`				varchar(10)			default null				comment '设备类别',
1494 1495
   `acquisition_time`	datetime			default null				comment '购置时间',
1495
-  `cost`				decimal(10,2)		default null				comment '总价',
1496
+  `cost`				decimal(10,2)		default null				comment '购买价格',
1496 1497
   `expect_life`			int					default null				comment '预计使用年限',
1497
-  `series`				varchar(20)			default null				comment '设备系列',
1498
+  `series`				varchar(20)			default null				comment '规格型号',
1499
+  `brand`				varchar(20)			default null				comment '设备品牌',
1498 1500
   `day_cost`			decimal(10,2)		default null				comment '单日成本',
1501
+  `place`				varchar(50)			default null				comment '存放地点',
1502
+  `remark`				varchar(255)		default null				comment '备注',
1503
+  `check_term`			int					default null				comment '校验周期(年)',
1504
+  `warranty`			int					default null				comment '保修期(月)',
1505
+  `check_time`			datetime			default null				comment '校验日期',
1506
+  `manage_dept`			bigint				default null				comment '管理部门',
1499 1507
   primary key (`device_id`)
1500 1508
 ) engine = innodb comment = 'cmc设备信息表';
1501 1509
 

Loading…
取消
儲存