|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.huiju.estateagents.base.BaseController;
|
7
|
7
|
import com.huiju.estateagents.base.ResponseBean;
|
|
8
|
+import com.huiju.estateagents.common.StringUtils;
|
8
|
9
|
import com.huiju.estateagents.sample.entity.TaH5Sample;
|
9
|
10
|
import com.huiju.estateagents.sample.service.ITaH5SampleService;
|
10
|
11
|
import org.slf4j.Logger;
|
|
@@ -18,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
18
|
19
|
import org.springframework.web.bind.annotation.ResponseBody;
|
19
|
20
|
import org.springframework.web.bind.annotation.RestController;
|
20
|
21
|
|
|
22
|
+import java.util.List;
|
|
23
|
+
|
21
|
24
|
/**
|
22
|
25
|
* <p>
|
23
|
26
|
* 样例表 前端控制器
|
|
@@ -148,4 +151,57 @@ public class TaH5SampleController extends BaseController {
|
148
|
151
|
}
|
149
|
152
|
return responseBean;
|
150
|
153
|
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+ /**
|
|
157
|
+ * 分页查询列表
|
|
158
|
+ * @param pageNum
|
|
159
|
+ * @param pageSize
|
|
160
|
+ * @return
|
|
161
|
+ */
|
|
162
|
+ @RequestMapping(value="/channel/h5Sample/list",method= RequestMethod.GET)
|
|
163
|
+ public ResponseBean geth5SampleList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
|
164
|
+ @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
165
|
+ String sampleName){
|
|
166
|
+ ResponseBean responseBean = new ResponseBean();
|
|
167
|
+ try {
|
|
168
|
+ //使用分页插件
|
|
169
|
+ IPage<TaH5Sample> pg = new Page<>(pageNum, pageSize);
|
|
170
|
+ QueryWrapper<TaH5Sample> queryWrapper = new QueryWrapper<>();
|
|
171
|
+ queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name",sampleName);
|
|
172
|
+ queryWrapper.orderByDesc("order_no","create_date");
|
|
173
|
+
|
|
174
|
+ IPage<TaH5Sample> result = iTaH5SampleService.page(pg, queryWrapper);
|
|
175
|
+ responseBean.addSuccess(result);
|
|
176
|
+ }catch (Exception e){
|
|
177
|
+ e.printStackTrace();
|
|
178
|
+ logger.error("taH5SampleList -=- {}",e.toString());
|
|
179
|
+ responseBean.addError(e.getMessage());
|
|
180
|
+ }
|
|
181
|
+ return responseBean;
|
|
182
|
+ }
|
|
183
|
+
|
|
184
|
+ /**
|
|
185
|
+ * 保存对象
|
|
186
|
+ * @param taH5Sample 实体对象
|
|
187
|
+ * @return
|
|
188
|
+ */
|
|
189
|
+ @RequestMapping(value="/channel/h5Sample/add",method= RequestMethod.POST)
|
|
190
|
+ public ResponseBean AddTaH5Sample(@RequestBody TaH5Sample taH5Sample){
|
|
191
|
+ ResponseBean responseBean = new ResponseBean();
|
|
192
|
+ try {
|
|
193
|
+ List<String> tags = taH5Sample.getTags();
|
|
194
|
+// taH5Sample.setTag()
|
|
195
|
+ if (iTaH5SampleService.save(taH5Sample)){
|
|
196
|
+ responseBean.addSuccess(taH5Sample);
|
|
197
|
+ }else {
|
|
198
|
+ responseBean.addError("fail");
|
|
199
|
+ }
|
|
200
|
+ }catch (Exception e){
|
|
201
|
+ e.printStackTrace();
|
|
202
|
+ logger.error("taH5SampleAdd -=- {}",e.toString());
|
|
203
|
+ responseBean.addError(e.getMessage());
|
|
204
|
+ }
|
|
205
|
+ return responseBean;
|
|
206
|
+ }
|
151
|
207
|
}
|