|
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ylx.common.constant.MassageConstants;
|
|
|
import com.ylx.common.core.domain.R;
|
|
|
-import com.ylx.common.utils.uuid.IdUtils;
|
|
|
+import com.ylx.common.exception.ServiceException;
|
|
|
import com.ylx.massage.domain.TLbt;
|
|
|
import com.ylx.massage.service.TLbtService;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -56,13 +56,13 @@ public class TLbtController {
|
|
|
@ApiOperation("添加或者更新轮播图")
|
|
|
public R addOrUpdate(@RequestBody TLbt lbt) {
|
|
|
try {
|
|
|
- if (StringUtils.isBlank(lbt.getcId())) {
|
|
|
- lbt.setcId(IdUtils.fastSimpleUUID());
|
|
|
- }
|
|
|
- return R.ok(lbtService.saveOrUpdate(lbt));
|
|
|
+ return R.ok(lbtService.addOrUpdate(lbt));
|
|
|
+ } catch (ServiceException s) {
|
|
|
+ log.error(s.toString());
|
|
|
+ return R.fail(s.getMessage());
|
|
|
} catch (Exception e) {
|
|
|
- log.error("addOrUpdate出现异常", e);
|
|
|
- return R.fail();
|
|
|
+ log.error(e.toString());
|
|
|
+ return R.fail("系统异常");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -86,10 +86,15 @@ public class TLbtController {
|
|
|
@RequestMapping(value = "/del", method = RequestMethod.POST)
|
|
|
@ApiOperation("删除轮播图")
|
|
|
public R del(@RequestBody TLbt tLbt) {
|
|
|
- TLbt tSpflNew = new TLbt();
|
|
|
- tSpflNew.setcId(tLbt.getcId());
|
|
|
- tSpflNew.setnDel(MassageConstants.INTEGER_ONE);
|
|
|
- return R.ok(lbtService.updateById(tSpflNew));
|
|
|
+ try {
|
|
|
+ return R.ok(lbtService.del(tLbt));
|
|
|
+ } catch (ServiceException s) {
|
|
|
+ log.error(s.toString());
|
|
|
+ return R.fail(s.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.toString());
|
|
|
+ return R.fail("系统异常");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@ApiOperation("根据id查询轮播图")
|