张延森 4 anos atrás
pai
commit
ef6c01b2f3

+ 1
- 1
pom.xml Ver arquivo

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.huiju</groupId>
12 12
 	<artifactId>xiangsong</artifactId>
13
-	<version>1.0.10</version>
13
+	<version>1.0.11</version>
14 14
 	<name>xiangsong</name>
15 15
 	<description>香颂</description>
16 16
 

+ 149
- 0
src/main/java/com/huiju/estateagents/property/controller/TpRepairTypeController.java Ver arquivo

@@ -0,0 +1,149 @@
1
+package com.huiju.estateagents.property.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.huiju.estateagents.base.BaseController;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiOperation;
11
+import io.swagger.annotations.ApiParam;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.PathVariable;
16
+import org.springframework.web.bind.annotation.RequestBody;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RequestMethod;
19
+import org.springframework.web.bind.annotation.RequestParam;
20
+import com.huiju.estateagents.property.service.ITpRepairTypeService;
21
+import com.huiju.estateagents.property.entity.TpRepairType;
22
+import org.springframework.web.bind.annotation.RestController;
23
+
24
+import javax.servlet.http.HttpServletRequest;
25
+import java.time.LocalDateTime;
26
+
27
+/**
28
+ * <p>
29
+    * 工单报修分类表  前端控制器
30
+    * </p>
31
+ *
32
+ * @author yansen
33
+ * @since 2020-12-17
34
+ */
35
+
36
+@Api(tags = "工单报修分类表 ")
37
+@RestController
38
+@RequestMapping("/api")
39
+public class TpRepairTypeController extends BaseController {
40
+
41
+    private final Logger logger = LoggerFactory.getLogger(TpRepairTypeController.class);
42
+
43
+    @Autowired
44
+    public ITpRepairTypeService iTpRepairTypeService;
45
+
46
+
47
+    /**
48
+     * 分页查询列表
49
+     * @param pageNum
50
+     * @param pageSize
51
+     * @return
52
+     */
53
+    @RequestMapping(value="/{client}/tpRepairType",method= RequestMethod.GET)
54
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
55
+    public ResponseBean tpRepairTypeList(@ApiParam(value = "客户端", allowableValues = "wx,admin") @PathVariable String client,
56
+                                         @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
57
+                                         @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
58
+                                         HttpServletRequest request) throws Exception{
59
+
60
+        Integer orgId = getOrgId(request);
61
+
62
+        IPage<TpRepairType> pg = new Page<>(pageNum, pageSize);
63
+        QueryWrapper<TpRepairType> queryWrapper = new QueryWrapper<>();
64
+        queryWrapper.eq("org_id", orgId);
65
+        queryWrapper.eq("wx".equals(client),"status", CommConstant.STATUS_NORMAL);
66
+        queryWrapper.gt("admin".equals(client),"status", CommConstant.STATUS_DELETE);
67
+        queryWrapper.orderByDesc("sort_num");
68
+        queryWrapper.orderByDesc("create_time");
69
+
70
+        IPage<TpRepairType> result = iTpRepairTypeService.page(pg, queryWrapper);
71
+        return ResponseBean.success(result);
72
+    }
73
+
74
+    /**
75
+     * 保存对象
76
+     * @param tpRepairType 实体对象
77
+     * @return
78
+     */
79
+    @RequestMapping(value="/admin/tpRepairType",method= RequestMethod.POST)
80
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
81
+    public ResponseBean tpRepairTypeAdd(@ApiParam("保存内容") @RequestBody TpRepairType tpRepairType,
82
+                                        HttpServletRequest request) throws Exception{
83
+        Integer orgId = getOrgId(request);
84
+
85
+        tpRepairType.setOrgId(orgId);
86
+        if (null == tpRepairType.getStatus()) {
87
+            tpRepairType.setStatus(CommConstant.STATUS_NORMAL);
88
+        }
89
+        tpRepairType.setCreatedTime(LocalDateTime.now());
90
+
91
+        if (iTpRepairTypeService.save(tpRepairType)){
92
+            return ResponseBean.success(tpRepairType);
93
+        }else {
94
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
95
+        }
96
+    }
97
+
98
+    /**
99
+     * 根据id删除对象
100
+     * @param id  实体ID
101
+     */
102
+    @RequestMapping(value="/admin/tpRepairType/{id}", method= RequestMethod.DELETE)
103
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
104
+    public ResponseBean tpRepairTypeDelete(@ApiParam("对象ID") @PathVariable Integer id,
105
+                                           HttpServletRequest request) throws Exception{
106
+        TpRepairType tpRepairType = iTpRepairTypeService.getById(id);
107
+        return tpRepairTypeUpdate(tpRepairType.getTypeId(), tpRepairType, request);
108
+    }
109
+
110
+    /**
111
+     * 修改对象
112
+     * @param id  实体ID
113
+     * @param tpRepairType 实体对象
114
+     * @return
115
+     */
116
+    @RequestMapping(value="/admin/tpRepairType/{id}",method= RequestMethod.PUT)
117
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
118
+    public ResponseBean tpRepairTypeUpdate(@ApiParam("对象ID") @PathVariable Integer id,
119
+                                           @ApiParam("更新内容") @RequestBody TpRepairType tpRepairType,
120
+                                           HttpServletRequest request) throws Exception{
121
+        if (null == tpRepairType || tpRepairType.getStatus().equals(CommConstant.STATUS_DELETE) || !tpRepairType.getTypeId().equals(id) || !tpRepairType.getOrgId().equals(getOrgId(request))) {
122
+            return ResponseBean.error("当前数据不存在", ResponseBean.ERROR_UNAVAILABLE);
123
+        }
124
+
125
+        tpRepairType.setUpdatedTime(LocalDateTime.now());
126
+
127
+        if (iTpRepairTypeService.updateById(tpRepairType)){
128
+            return ResponseBean.success(iTpRepairTypeService.getById(id));
129
+        }else {
130
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
131
+        }
132
+    }
133
+
134
+    /**
135
+     * 根据id查询对象
136
+     * @param id  实体ID
137
+     */
138
+    @RequestMapping(value="/admin/tpRepairType/{id}",method= RequestMethod.GET)
139
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
140
+    public ResponseBean tpRepairTypeGet(@ApiParam("对象ID") @PathVariable Integer id,
141
+                                        HttpServletRequest request) throws Exception{
142
+        TpRepairType tpRepairType = iTpRepairTypeService.getById(id);
143
+        if (null == tpRepairType || tpRepairType.getStatus().equals(CommConstant.STATUS_DELETE) || !tpRepairType.getOrgId().equals(getOrgId(request))) {
144
+            return ResponseBean.error("当前数据不存在", ResponseBean.ERROR_UNAVAILABLE);
145
+        }
146
+
147
+        return ResponseBean.success(tpRepairType);
148
+    }
149
+}

+ 72
- 0
src/main/java/com/huiju/estateagents/property/entity/TpRepairType.java Ver arquivo

@@ -0,0 +1,72 @@
1
+package com.huiju.estateagents.property.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.time.LocalDateTime;
6
+import com.baomidou.mybatisplus.annotation.TableField;
7
+import java.io.Serializable;
8
+import io.swagger.annotations.ApiModel;
9
+import io.swagger.annotations.ApiModelProperty;
10
+import lombok.Data;
11
+import lombok.EqualsAndHashCode;
12
+import lombok.experimental.Accessors;
13
+
14
+/**
15
+ * <p>
16
+ * 工单报修分类表 
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2020-12-17
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@ApiModel(value="TpRepairType对象", description="工单报修分类表 ")
26
+public class TpRepairType implements Serializable {
27
+
28
+    private static final long serialVersionUID = 1L;
29
+
30
+    @ApiModelProperty(value = "id")
31
+    @TableId(value = "type_id", type = IdType.AUTO)
32
+    private Integer typeId;
33
+
34
+    @ApiModelProperty(value = "父id")
35
+    private Integer pid;
36
+
37
+    @ApiModelProperty(value = "公司id")
38
+    private Integer orgId;
39
+
40
+    @ApiModelProperty(value = "报修类型名称")
41
+    private String typeName;
42
+
43
+    @ApiModelProperty(value = "排序")
44
+    private Integer sortNum;
45
+
46
+    @ApiModelProperty(value = "图标")
47
+    private String icon;
48
+
49
+    @ApiModelProperty(value = "快捷问题")
50
+    private String tags;
51
+
52
+    @ApiModelProperty(value = "状态")
53
+    private Integer status;
54
+
55
+    @ApiModelProperty(value = "创建人")
56
+    @TableField("CREATED_BY")
57
+    private String createdBy;
58
+
59
+    @ApiModelProperty(value = "创建时间")
60
+    @TableField("CREATED_TIME")
61
+    private LocalDateTime createdTime;
62
+
63
+    @ApiModelProperty(value = "更新人")
64
+    @TableField("UPDATED_BY")
65
+    private String updatedBy;
66
+
67
+    @ApiModelProperty(value = "更新时间")
68
+    @TableField("UPDATED_TIME")
69
+    private LocalDateTime updatedTime;
70
+
71
+
72
+}

+ 18
- 0
src/main/java/com/huiju/estateagents/property/mapper/TpRepairTypeMapper.java Ver arquivo

@@ -0,0 +1,18 @@
1
+package com.huiju.estateagents.property.mapper;
2
+
3
+import com.huiju.estateagents.property.entity.TpRepairType;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 工单报修分类表  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2020-12-17
14
+ */
15
+@Mapper
16
+public interface TpRepairTypeMapper extends BaseMapper<TpRepairType> {
17
+
18
+}

+ 16
- 0
src/main/java/com/huiju/estateagents/property/service/ITpRepairTypeService.java Ver arquivo

@@ -0,0 +1,16 @@
1
+package com.huiju.estateagents.property.service;
2
+
3
+import com.huiju.estateagents.property.entity.TpRepairType;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 工单报修分类表  服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2020-12-17
13
+ */
14
+public interface ITpRepairTypeService extends IService<TpRepairType> {
15
+
16
+}

+ 20
- 0
src/main/java/com/huiju/estateagents/property/service/impl/TpRepairTypeServiceImpl.java Ver arquivo

@@ -0,0 +1,20 @@
1
+package com.huiju.estateagents.property.service.impl;
2
+
3
+import com.huiju.estateagents.property.entity.TpRepairType;
4
+import com.huiju.estateagents.property.mapper.TpRepairTypeMapper;
5
+import com.huiju.estateagents.property.service.ITpRepairTypeService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 工单报修分类表  服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2020-12-17
16
+ */
17
+@Service
18
+public class TpRepairTypeServiceImpl extends ServiceImpl<TpRepairTypeMapper, TpRepairType> implements ITpRepairTypeService {
19
+
20
+}

+ 5
- 0
src/main/resources/mapper/property/TpRepairTypeMapper.xml Ver arquivo

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.huiju.estateagents.property.mapper.TpRepairTypeMapper">
4
+
5
+</mapper>