123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- package com.kmall.admin.controller;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- import com.kmall.admin.utils.ShiroUtils;
- import com.kmall.common.utils.PageUtils;
- import com.kmall.common.utils.Query;
- import com.kmall.common.utils.R;
- import org.apache.shiro.authz.annotation.RequiresPermissions;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.*;
- import com.kmall.admin.entity.StoreSmsConfigEntity;
- import com.kmall.admin.service.StoreSmsConfigService;
- /**
- * 门店短信配置表Controller
- *
- * @author emato
- * @email admin@qhdswl.com
- * @date 2021-03-11 10:10:10
- */
- @RestController
- @RequestMapping("storesmsconfig")
- public class StoreSmsConfigController {
- @Autowired
- private StoreSmsConfigService storeSmsConfigService;
- /**
- * 查看列表
- */
- @RequestMapping("/list")
- @ResponseBody
- public R list(@RequestParam Map<String, Object> params) {
- //查询列表数据
- Query query = new Query(params);
- List<StoreSmsConfigEntity> storeSmsConfigList = storeSmsConfigService.queryList(query);
- int total = storeSmsConfigService.queryTotal(query);
- PageUtils pageUtil = new PageUtils(storeSmsConfigList, total, query.getLimit(), query.getPage());
- return R.ok().put("page", pageUtil);
- }
- /**
- * 查看信息
- */
- @RequestMapping("/info/{id}")
- @ResponseBody
- public R info(@PathVariable("id") Integer id) {
- StoreSmsConfigEntity storeSmsConfig = storeSmsConfigService.queryObject(id);
- return R.ok().put("storeSmsConfig", storeSmsConfig);
- }
- /**
- * 保存
- */
- @RequestMapping("/save")
- @ResponseBody
- public R save(@RequestBody StoreSmsConfigEntity storeSmsConfig) {
- StoreSmsConfigEntity entity = storeSmsConfigService.queryObjectByMerchSnAndStoreId(storeSmsConfig.getMerchSn(),storeSmsConfig.getStoreId());
- if (entity!=null){
- return R.error("该门店已有配置,请在原基础上修改");
- }
- if ("2".equals(storeSmsConfig.getIsEnable())){
- storeSmsConfig.setSendEndTime(null);
- storeSmsConfig.setSendStartTime(null);
- }
- storeSmsConfig.setCreaterSn(ShiroUtils.getUserId().toString());
- storeSmsConfig.setCreateTime(new Date());
- storeSmsConfig.setModerSn(ShiroUtils.getUserId().toString());
- storeSmsConfig.setModTime(new Date());
- storeSmsConfigService.save(storeSmsConfig);
- return R.ok();
- }
- /**
- * 修改
- */
- @RequestMapping("/update")
- @ResponseBody
- public R update(@RequestBody StoreSmsConfigEntity storeSmsConfig) {
- storeSmsConfig.setModerSn(ShiroUtils.getUserId().toString());
- storeSmsConfig.setModTime(new Date());
- if ("2".equals(storeSmsConfig.getIsEnable())){
- storeSmsConfig.setSendEndTime(null);
- storeSmsConfig.setSendStartTime(null);
- }
- storeSmsConfigService.update(storeSmsConfig);
- return R.ok();
- }
- /**
- * 删除
- */
- @RequestMapping("/delete")
- @ResponseBody
- public R delete(@RequestBody Integer[]ids) {
- storeSmsConfigService.deleteBatch(ids);
- return R.ok();
- }
- /**
- * 查看所有列表
- */
- @RequestMapping("/queryAll")
- @ResponseBody
- public R queryAll(@RequestParam Map<String, Object> params) {
- List<StoreSmsConfigEntity> list = storeSmsConfigService.queryList(params);
- return R.ok().put("list", list);
- }
- }
|