use of com.baomidou.mybatisplus.mapper.EntityWrapper in project vip by guangdada.
the class PointServiceImpl method checkPoint.
/**
* 判断关注微信的积分规则时候已经存在
* @Title: checkPoint
* @param merchantId
* @param pointId
* @return
* @date: 2017年9月22日 下午1:54:56
* @author: chengxg
*/
public boolean checkPoint(Long merchantId, Long pointId) {
Wrapper<Point> w = new EntityWrapper<Point>();
w.eq("merchant_id", merchantId);
w.eq("status", 1);
w.eq("rule_type", PointType.SUBSCRIBE_WX.getCode());
if (pointId != null) {
w.ne("id", pointId);
}
int count = pointMapper.selectCount(w);
return count == 0 ? true : false;
}
use of com.baomidou.mybatisplus.mapper.EntityWrapper in project vip by guangdada.
the class StoreServiceImpl method saveStore.
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void saveStore(Store store, String pics) {
if (store.getId() != null) {
Wrapper<StorePhoto> wrapper = new EntityWrapper<StorePhoto>();
wrapper.eq("store_id", store.getId());
storePhotoMapper.delete(wrapper);
storeMapper.updateById(store);
} else {
store.setStoreNo(RandomUtil.generateStoreNum());
storeMapper.insert(store);
}
if (StringUtils.isNotBlank(pics)) {
JSONArray picA = JSONArray.parseArray(pics);
if (picA != null) {
for (int i = 0; i < picA.size(); i++) {
JSONObject pic = picA.getJSONObject(i);
Long id = pic.getLong("id");
StorePhoto storePhoto = new StorePhoto();
storePhoto.setStoreId(store.getId());
storePhoto.setPicId(id);
storePhotoMapper.insert(storePhoto);
}
}
}
}
use of com.baomidou.mybatisplus.mapper.EntityWrapper in project vip by guangdada.
the class ShareApiImpl method saveShareLog.
/**
* 保存邀请记录
*
* @Title: saveShareLog
* @param shareUnionid
* 邀请人unionid
* @param receiveUnionid
* 受邀人unionid
* @param receiveIp
* 受邀人ip
* @throws Exception
* @date: 2017年10月9日 上午9:28:15
* @author: chengxg
*/
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
@Override
public void saveShareLog(String shareUnionid, String receiveUnionid, String receiveIp) throws Exception {
log.info("进入saveShareLog>>shareUnionid=" + shareUnionid);
log.info("进入saveShareLog>>receiveUnionid=" + receiveUnionid);
log.info("进入saveShareLog>>receiveIp=" + receiveIp);
// 邀请人不存在, 不处理
Member shareMem = memberDao.getMemberByUnionid(shareUnionid);
if (shareMem == null) {
log.info("邀请人不存在");
return;
}
// 受邀人不是会员 或者已激活不处理
Member receiveMem = memberDao.getMemberByUnionid(receiveUnionid);
if (receiveMem == null || receiveMem.isIsActive()) {
log.info("受邀人不存在");
return;
}
Wrapper<ShareLog> w = new EntityWrapper<ShareLog>();
w.eq("share_unionid", shareUnionid);
w.eq("receive_unionid", receiveUnionid);
int count = shareLogMapper.selectCount(w);
if (count > 0) {
log.info("已有邀请记录");
return;
}
ShareLog shareLog = new ShareLog();
shareLog.setShareUnionid(shareUnionid);
shareLog.setReceiveUnionid(receiveUnionid);
shareLog.setReceiveIp(receiveIp);
shareLog.setReceiveStatus(false);
shareLogMapper.insert(shareLog);
log.info("结束saveShareLog");
}
use of com.baomidou.mybatisplus.mapper.EntityWrapper in project vip by guangdada.
the class ConstantFactory method getDictsByName.
/**
* 根据字典名称和字典中的值获取对应的名称
*/
@Override
public String getDictsByName(String name, Integer val) {
Dict temp = new Dict();
temp.setName(name);
Dict dict = dictMapper.selectOne(temp);
if (dict == null) {
return "";
} else {
Wrapper<Dict> wrapper = new EntityWrapper<>();
wrapper = wrapper.eq("pid", dict.getId());
List<Dict> dicts = dictMapper.selectList(wrapper);
for (Dict item : dicts) {
if (item.getNum() != null && item.getNum().equals(val)) {
return item.getName();
}
}
return "";
}
}
use of com.baomidou.mybatisplus.mapper.EntityWrapper in project vip by guangdada.
the class MenuController method edit.
/**
* 修该菜单
*/
@Permission(Const.ADMIN_NAME)
@RequestMapping(value = "/edit")
@BussinessLog(value = "修改菜单", key = "name", dict = Dict.MenuDict)
@ResponseBody
public Tip edit(@Valid Menu menu, BindingResult result) {
if (result.hasErrors()) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
}
// 设置父级菜单编号
menuSetPcode(menu);
this.menuMapper.updateById(menu);
if (!menu.getCode().equals("0") && menu.getIsmenu().intValue() == 1) {
Wrapper<Menu> wrapper = new EntityWrapper<>();
wrapper.eq("pcode", menu.getCode());
List<Menu> submenus = menuMapper.selectList(wrapper);
Map<String, Boolean> map = new HashMap<String, Boolean>();
map.put(menu.getUrl() + "/add", false);
map.put(menu.getUrl() + "/update", false);
map.put(menu.getUrl() + "/delete", false);
map.put(menu.getUrl() + "/detail", false);
map.put(menu.getUrl() + "/list", false);
map.put(menu.getUrl() + "/" + menu.getCode() + "_add", false);
map.put(menu.getUrl() + "/" + menu.getCode() + "_update", false);
for (Menu m : submenus) {
if (map.get(m.getUrl()) != null) {
map.put(m.getUrl(), true);
}
}
for (String key : map.keySet()) {
if (!map.get(key)) {
Menu subMenu = new Menu();
if (key.equals(menu.getUrl() + "/add")) {
subMenu.setName(menu.getName() + "添加");
subMenu.setCode(menu.getCode() + "_add");
} else if (key.equals(menu.getUrl() + "/update")) {
subMenu.setName(menu.getName() + "修改");
subMenu.setCode(menu.getCode() + "_update");
} else if (key.equals(menu.getUrl() + "/delete")) {
subMenu.setName(menu.getName() + "删除");
subMenu.setCode(menu.getCode() + "_delete");
} else if (key.equals(menu.getUrl() + "/detail")) {
subMenu.setName(menu.getName() + "详情");
subMenu.setCode(menu.getCode() + "_detail");
} else if (key.equals(menu.getUrl() + "/list")) {
subMenu.setName(menu.getName() + "查询");
subMenu.setCode(menu.getCode() + "_list");
} else if (key.equals(menu.getUrl() + "/" + menu.getCode() + "_add")) {
subMenu.setName(menu.getName() + "跳转添加");
subMenu.setCode("to_" + menu.getCode() + "_add");
} else if (key.equals(menu.getUrl() + "/" + menu.getCode() + "_update")) {
subMenu.setName(menu.getName() + "跳转修改");
subMenu.setCode("to_" + menu.getCode() + "_update");
}
subMenu.setIsmenu(0);
subMenu.setPcode(menu.getId().toString());
subMenu.setNum(1);
subMenu.setUrl(key);
subMenu.setStatus(1);
// 判断是否存在该编号
String existedMenuName = ConstantFactory.me().getMenuNameByCode(subMenu.getCode());
if (ToolUtil.isNotEmpty(existedMenuName)) {
throw new BussinessException(BizExceptionEnum.EXISTED_THE_MENU);
}
// 设置父级菜单编号
menuSetPcode(subMenu);
subMenu.setStatus(MenuStatus.ENABLE.getCode());
this.menuMapper.insert(subMenu);
}
}
}
return SUCCESS_TIP;
}
Aggregations