package com.sinata.modular.member.controller;
|
|
import com.sinata.core.base.controller.BaseController;
|
import com.sinata.core.util.ToolUtil;
|
import org.springframework.stereotype.Controller;
|
import com.baomidou.mybatisplus.plugins.Page;
|
import com.sinata.core.common.constant.factory.PageFactory;
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.sinata.core.common.annotion.BussinessLog;
|
import com.sinata.core.common.annotion.Permission;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import com.sinata.core.log.LogObjectHolder;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import com.sinata.modular.member.model.MemUserRelation;
|
import com.sinata.modular.member.service.IMemUserRelationService;
|
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 会员邀请关系控制器
|
*
|
* @author goku
|
*/
|
@Controller
|
@RequestMapping("/memUserRelation")
|
public class MemUserRelationController extends BaseController {
|
|
private String PREFIX = "/member/memUserRelation/";
|
|
@Autowired
|
private IMemUserRelationService memUserRelationService;
|
|
/**
|
* 跳转到会员邀请关系首页
|
*/
|
@RequestMapping("")
|
public String index() {
|
return PREFIX + "memUserRelation.html";
|
}
|
|
/**
|
* 跳转到添加会员邀请关系
|
*/
|
@RequestMapping("/memUserRelation_add")
|
public String memUserRelationAdd() {
|
return PREFIX + "memUserRelation_add.html";
|
}
|
|
/**
|
* 跳转到修改会员邀请关系
|
*/
|
@RequestMapping("/memUserRelation_update/{memUserRelationId}")
|
public String memUserRelationUpdate(@PathVariable Integer memUserRelationId, Model model) {
|
MemUserRelation memUserRelation = memUserRelationService.selectById(memUserRelationId);
|
model.addAttribute("item", memUserRelation);
|
LogObjectHolder.me().set(memUserRelation);
|
return PREFIX + "memUserRelation_edit.html";
|
}
|
|
/**
|
* 获取会员邀请关系列表
|
*/
|
@ResponseBody
|
@RequestMapping(value = "/list")
|
public Object list(String beginTime, String endTime, String condition) {
|
Page<Map<String, Object>> page = new PageFactory().defaultPage();
|
Wrapper wrapper = new EntityWrapper<MemUserRelation>().orderBy("id", false);
|
|
// 时间搜索
|
if (ToolUtil.isNotEmpty(beginTime)) {
|
wrapper.ge("create_time", beginTime + " 00:00:00");
|
}
|
if (ToolUtil.isNotEmpty(endTime)) {
|
wrapper.le("create_time", endTime + " 23:59:59");
|
}
|
|
// 查询数据列表
|
List<Map<String, Object>> list = memUserRelationService.selectMapsPage(page, wrapper).getRecords();
|
|
page.setRecords(list);
|
return super.packForBT(page);
|
}
|
|
/**
|
* 新增会员邀请关系
|
*/
|
@Permission
|
@ResponseBody
|
@BussinessLog(value = "新增会员邀请关系")
|
@RequestMapping(value = "/add")
|
public Object add(MemUserRelation memUserRelation) {
|
memUserRelationService.insert(memUserRelation);
|
return SUCCESS_TIP;
|
}
|
|
/**
|
* 删除/批量删除
|
*/
|
@Permission
|
@ResponseBody
|
@BussinessLog(value = "删除/批量删除会员邀请关系")
|
@RequestMapping(value = "/delete")
|
public Object delete(@RequestParam String ids) {
|
// 逻辑删除
|
memUserRelationService.updateForSet("is_delete = 1", new EntityWrapper<MemUserRelation>().in("id", ids.split(",")));
|
return SUCCESS_TIP;
|
}
|
|
/**
|
* 修改会员邀请关系
|
*/
|
@Permission
|
@ResponseBody
|
@BussinessLog(value = "修改会员邀请关系")
|
@RequestMapping(value = "/update")
|
public Object update(MemUserRelation memUserRelation) {
|
memUserRelationService.updateById(memUserRelation);
|
return SUCCESS_TIP;
|
}
|
|
/**
|
* 修改会员邀请关系状态
|
*/
|
@Permission
|
@ResponseBody
|
@BussinessLog(value = "修改会员邀请关系状态")
|
@RequestMapping(value = "/updateState")
|
public Object updateState(Integer memUserRelationId, Integer state) {
|
memUserRelationService.updateForSet("state = " + state, new EntityWrapper<MemUserRelation>().eq("id", memUserRelationId));
|
return SUCCESS_TIP;
|
}
|
|
/**
|
* 跳转会员邀请关系详情
|
*/
|
@RequestMapping(value = "/detail/{memUserRelationId}")
|
public Object detail(@PathVariable("memUserRelationId") Integer memUserRelationId, Model model) {
|
MemUserRelation memUserRelation = memUserRelationService.selectById(memUserRelationId);
|
model.addAttribute("item", memUserRelation);
|
return PREFIX + "memUserRelation_detail.html";
|
}
|
}
|