|
@@ -0,0 +1,128 @@
|
|
|
+package com.txz.cif.web.mng;
|
|
|
+import com.txz.cif.core.Result;
|
|
|
+import com.txz.cif.core.ResultGenerator;
|
|
|
+import com.txz.cif.model.MidChannelMethod;
|
|
|
+import com.txz.cif.service.MidChannelMethodService;
|
|
|
+
|
|
|
+import com.txz.cif.core.ResultCode;
|
|
|
+
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import com.txz.core.ServiceException;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+import tk.mybatis.mapper.entity.Condition;
|
|
|
+import tk.mybatis.mapper.entity.Example.Criteria;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+
|
|
|
+/**
|
|
|
+* Created by CodeGenerator on 2025/08/04.
|
|
|
+*/
|
|
|
+@Api(tags = "[后台]midChannelMethod管理")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/mid/channel/method")
|
|
|
+public class MidChannelMethodController {
|
|
|
+
|
|
|
+ private static Logger log = LoggerFactory.getLogger(MidChannelMethodController.class);
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MidChannelMethodService midChannelMethodService;
|
|
|
+
|
|
|
+ @PostMapping("/add")
|
|
|
+ @ApiOperation(value = "midChannelMethod新增",httpMethod = "POST")
|
|
|
+ public Result add(@RequestBody MidChannelMethod midChannelMethod) {
|
|
|
+ if(midChannelMethod == null){
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.OBJECT_IS_NULL);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ // midChannelMethod.setCreateTime(new Date());
|
|
|
+ // midChannelMethod.setCreateUserId(userId);
|
|
|
+ midChannelMethodService.save(midChannelMethod);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("新增对象操作异常e:{}",e);
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultGenerator.genSuccessResult(midChannelMethod);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/delete")
|
|
|
+ @ApiOperation(value = "midChannelMethod删除",httpMethod = "GET")
|
|
|
+ public Result delete(@RequestParam Integer id) {
|
|
|
+ if(id == null){
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.ID_IS_NULL);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ midChannelMethodService.deleteById(id);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("删除对象操作异常e:{}",e);
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return ResultGenerator.genSuccessResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperation(value = "midChannelMethod更新",httpMethod = "POST")
|
|
|
+ public Result update(@RequestBody MidChannelMethod midChannelMethod) {
|
|
|
+ if(midChannelMethod == null){
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.OBJECT_IS_NULL);
|
|
|
+ }
|
|
|
+ if(midChannelMethod.getId() == null){
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.ID_IS_NULL);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ // midChannelMethod.setUpdateTime(new Date());
|
|
|
+ // midChannelMethod.setUpdateUserId(userId);
|
|
|
+ midChannelMethodService.update(midChannelMethod);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("更新对象操作异常e:{}",e);
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return ResultGenerator.genSuccessResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @ApiOperation(value = "midChannelMethod获取详情",httpMethod = "GET")
|
|
|
+ public Result<MidChannelMethod> detail(@RequestParam Integer id) {
|
|
|
+ if(id == null){
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.ID_IS_NULL);
|
|
|
+ }
|
|
|
+
|
|
|
+ MidChannelMethod midChannelMethod = null;
|
|
|
+ try {
|
|
|
+ midChannelMethod = midChannelMethodService.findById(id);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询对象操作异常e:{}",e);
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultGenerator.genSuccessResult(midChannelMethod);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/list")
|
|
|
+ @ApiOperation(value = "midChannelMethod获取列表",httpMethod = "POST")
|
|
|
+ public Result<List<MidChannelMethod>> list(@RequestBody MidChannelMethod midChannelMethod, @RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
|
|
|
+
|
|
|
+ PageHelper.startPage(page, size);
|
|
|
+
|
|
|
+ Condition condition = new Condition(midChannelMethod.getClass());
|
|
|
+ Criteria criteria = condition.createCriteria();
|
|
|
+// criteria.andEqualTo("name", city.getName());
|
|
|
+ PageInfo pageInfo = null;
|
|
|
+ try {
|
|
|
+ List<MidChannelMethod> list = midChannelMethodService.findByCondition(condition);
|
|
|
+ pageInfo = new PageInfo(list);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询对象操作异常e:{}",e);
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return ResultGenerator.genSuccessResult(pageInfo);
|
|
|
+ }
|
|
|
+}
|