commit
9cfe5e88d7
@ -0,0 +1,137 @@ |
|||||||
|
package com.bweb.controller; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.github.pagehelper.PageHelper; |
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import com.hai.common.exception.ErrorCode; |
||||||
|
import com.hai.common.exception.ErrorHelp; |
||||||
|
import com.hai.common.exception.SysCode; |
||||||
|
import com.hai.common.security.AESEncodeUtil; |
||||||
|
import com.hai.common.security.SessionObject; |
||||||
|
import com.hai.common.security.UserCenter; |
||||||
|
import com.hai.common.utils.MD5Util; |
||||||
|
import com.hai.common.utils.ResponseMsgUtil; |
||||||
|
import com.hai.entity.*; |
||||||
|
import com.hai.model.MenuTreeModel; |
||||||
|
import com.hai.model.ResponseData; |
||||||
|
import com.hai.model.UserInfoModel; |
||||||
|
import com.hai.service.HighMerchantService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Auther: 胡锐 |
||||||
|
* @Description: |
||||||
|
* @Date: 2021/3/8 21:55 |
||||||
|
*/ |
||||||
|
@Controller |
||||||
|
@RequestMapping(value = "/highMerchant") |
||||||
|
@Api(value = "商户接口") |
||||||
|
public class HighMerchantController { |
||||||
|
|
||||||
|
private static Logger log = LoggerFactory.getLogger(HighMerchantController.class); |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private UserCenter userCenter; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private HighMerchantService highMerchantService; |
||||||
|
|
||||||
|
@RequestMapping(value="/editMerchant",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "编辑商户") |
||||||
|
public ResponseData editMerchant(@RequestBody HighMerchant highMerchant, HttpServletRequest request) { |
||||||
|
try { |
||||||
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||||
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
||||||
|
if (highMerchant.getCompanyId() == null |
||||||
|
|| StringUtils.isBlank(highMerchant.getMerchantKey()) |
||||||
|
|| StringUtils.isBlank(highMerchant.getMerchantName()) |
||||||
|
|| StringUtils.isBlank(highMerchant.getTelephone()) |
||||||
|
|| StringUtils.isBlank(highMerchant.getAddress()) |
||||||
|
) { |
||||||
|
log.error("HighMerchantController -> editMerchant() error!","参数错误"); |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
|
||||||
|
if (highMerchant.getId() != null) { |
||||||
|
if (highMerchantService.getMerchantById(highMerchant.getId()) == null) { |
||||||
|
log.error("HighMerchantController -> editMerchant() error!","未找到商户"); |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); |
||||||
|
} |
||||||
|
highMerchant.setUpdateTime(new Date()); |
||||||
|
|
||||||
|
} else { |
||||||
|
highMerchant.setCreateTime(new Date()); |
||||||
|
highMerchant.setUpdateTime(new Date()); |
||||||
|
} |
||||||
|
highMerchant.setStatus(1); // 状态:0:不可用,1:可用
|
||||||
|
highMerchant.setOperatorId(userInfoModel.getSecUser().getId()); |
||||||
|
highMerchant.setOperatorName(userInfoModel.getSecUser().getUserName()); |
||||||
|
highMerchantService.editMerchant(highMerchant); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(highMerchant); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error("HighMerchantController -> editMerchant() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/getMerchantById",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "根据id查询商户") |
||||||
|
public ResponseData getMerchantById(@RequestParam(name = "id", required = true) Long id) { |
||||||
|
try { |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(highMerchantService.getMerchantById(id)); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error("HighMerchantController -> getMerchantById() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/getMerchantList",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询商户列表") |
||||||
|
public ResponseData getMerchantList(@RequestParam(name = "merchantKey", required = false) String merchantKey, |
||||||
|
@RequestParam(name = "merchantName", required = false) String merchantName, |
||||||
|
@RequestParam(name = "telephone", required = false) String telephone, |
||||||
|
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||||
|
@RequestParam(name = "pageSize", required = true) Integer pageSize, |
||||||
|
HttpServletRequest request) { |
||||||
|
try { |
||||||
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||||
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
||||||
|
if (userInfoModel.getBsCompany() == null) { |
||||||
|
log.error("HighMerchantController -> getMerchantList() error!","权限不足"); |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||||
|
} |
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
map.put("companyId", userInfoModel.getBsCompany().getId()); |
||||||
|
map.put("merchantKey", merchantKey); |
||||||
|
map.put("merchantName", merchantName); |
||||||
|
map.put("telephone", telephone); |
||||||
|
|
||||||
|
PageHelper.startPage(pageNum, pageSize); |
||||||
|
return ResponseMsgUtil.success(new PageInfo<>(highMerchantService.getMerchantList(map))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("HighMerchantController -> getMerchantList() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,196 @@ |
|||||||
|
package com.bweb.controller; |
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper; |
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import com.hai.common.exception.ErrorCode; |
||||||
|
import com.hai.common.exception.ErrorHelp; |
||||||
|
import com.hai.common.exception.SysCode; |
||||||
|
import com.hai.common.security.SessionObject; |
||||||
|
import com.hai.common.security.UserCenter; |
||||||
|
import com.hai.common.utils.ResponseMsgUtil; |
||||||
|
import com.hai.entity.HighMerchant; |
||||||
|
import com.hai.entity.HighMerchantStore; |
||||||
|
import com.hai.model.ResponseData; |
||||||
|
import com.hai.model.UserInfoModel; |
||||||
|
import com.hai.service.HighMerchantService; |
||||||
|
import com.hai.service.HighMerchantStoreService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Auther: 胡锐 |
||||||
|
* @Description: |
||||||
|
* @Date: 2021/3/9 20:58 |
||||||
|
*/ |
||||||
|
@Controller |
||||||
|
@RequestMapping(value = "/highMerchantStore") |
||||||
|
@Api(value = "商户门店接口") |
||||||
|
public class HighMerchantStoreController { |
||||||
|
|
||||||
|
private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private UserCenter userCenter; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private HighMerchantStoreService highMerchantStoreService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private HighMerchantService highMerchantService; |
||||||
|
|
||||||
|
@RequestMapping(value="/editHighMerchantStore",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "编辑商户门店") |
||||||
|
public ResponseData editMerchantStore(@RequestBody HighMerchantStore highMerchantStore, HttpServletRequest request) { |
||||||
|
try { |
||||||
|
//发布人员
|
||||||
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||||
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
||||||
|
if (highMerchantStore.getMerchantId() == null |
||||||
|
|| StringUtils.isNotBlank(highMerchantStore.getStoreKey()) |
||||||
|
|| StringUtils.isNotBlank(highMerchantStore.getStoreName()) |
||||||
|
|| StringUtils.isNotBlank(highMerchantStore.getTelephone()) |
||||||
|
|| StringUtils.isNotBlank(highMerchantStore.getAddress()) |
||||||
|
) { |
||||||
|
log.error("HighMerchantStoreController -> editMerchantStore() error!","参数错误"); |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
// 商户
|
||||||
|
HighMerchant merchant = highMerchantService.getMerchantById(highMerchantStore.getMerchantId()); |
||||||
|
if (merchant != null) { |
||||||
|
log.error("HighMerchantStoreController -> editMerchantStore() error!","未找到商户"); |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); |
||||||
|
} |
||||||
|
if (highMerchantStore.getId() != null) { |
||||||
|
highMerchantStore.setUpdateTime(new Date()); |
||||||
|
} else { |
||||||
|
highMerchantStore.setCreateTime(new Date()); |
||||||
|
highMerchantStore.setUpdateTime(new Date()); |
||||||
|
} |
||||||
|
|
||||||
|
highMerchantStore.setCompanyId(merchant.getCompanyId()); |
||||||
|
highMerchantStore.setStatus(1); // 状态:0:删除,1:正常
|
||||||
|
highMerchantStore.setOperatorId(userInfoModel.getSecUser().getId()); |
||||||
|
highMerchantStore.setOperatorName(userInfoModel.getSecUser().getUserName()); |
||||||
|
highMerchantStoreService.editMerchantStore(highMerchantStore); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(highMerchantStore); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error("HighMerchantStoreController -> editMerchantStore() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/deleteMerchantStore",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "删除商户门店") |
||||||
|
public ResponseData deleteMerchantStore(@RequestParam(name = "id", required = true) Long id) { |
||||||
|
try { |
||||||
|
// 商户门店
|
||||||
|
HighMerchantStore merchantStore = highMerchantStoreService.getMerchantStoreById(id); |
||||||
|
if(merchantStore == null) { |
||||||
|
log.error("HighMerchantStoreController -> deleteMerchantStore() error!","未找到商户门店"); |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_STORE_NOF_FOUND, ""); |
||||||
|
} |
||||||
|
merchantStore.setStatus(0); |
||||||
|
merchantStore.setUpdateTime(new Date()); |
||||||
|
highMerchantStoreService.editMerchantStore(merchantStore); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("HighMerchantStoreController -> deleteMerchantStore() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/getMerchantStoreById",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "根据id查询商户门店") |
||||||
|
public ResponseData getMerchantStoreById(@RequestParam(name = "id", required = true) Long id) { |
||||||
|
try { |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(highMerchantStoreService.getMerchantStoreById(id)); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("HighMerchantStoreController -> getMerchantStoreById() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/getStoreListByCompany",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "根据公司 查询商户门店列表") |
||||||
|
public ResponseData getStoreListByCompany(@RequestParam(name = "merchantId", required = false) Long merchantId, |
||||||
|
@RequestParam(name = "telephone", required = false) String telephone, |
||||||
|
@RequestParam(name = "storeName", required = false) String storeName, |
||||||
|
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||||
|
@RequestParam(name = "pageSize", required = true) Integer pageSize, |
||||||
|
HttpServletRequest request) { |
||||||
|
try { |
||||||
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||||
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
||||||
|
if (userInfoModel.getBsCompany() == null) { |
||||||
|
log.error("HighMerchantStoreController -> getStoreListByCompany() error!","权限不足"); |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
map.put("companyId", userInfoModel.getBsCompany().getId()); |
||||||
|
map.put("merchantId", merchantId); |
||||||
|
map.put("telephone", telephone); |
||||||
|
map.put("storeName", storeName); |
||||||
|
|
||||||
|
PageHelper.startPage(pageNum, pageSize); |
||||||
|
return ResponseMsgUtil.success(new PageInfo<>(highMerchantStoreService.getMerchantStoreList(map))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("HighMerchantStoreController -> getStoreListByCompany() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/getStoreListByMerchant",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "根据商户 查询门店列表") |
||||||
|
public ResponseData getStoreListByMerchant(@RequestParam(name = "telephone", required = false) String telephone, |
||||||
|
@RequestParam(name = "storeName", required = false) String storeName, |
||||||
|
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||||
|
@RequestParam(name = "pageSize", required = true) Integer pageSize, |
||||||
|
HttpServletRequest request) { |
||||||
|
try { |
||||||
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||||
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
||||||
|
if (userInfoModel.getMerchant() == null) { |
||||||
|
log.error("HighMerchantStoreController -> getStoreListByMerchant() error!","权限不足"); |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
map.put("merchantId", userInfoModel.getMerchant().getId()); |
||||||
|
map.put("telephone", telephone); |
||||||
|
map.put("storeName", storeName); |
||||||
|
|
||||||
|
PageHelper.startPage(pageNum, pageSize); |
||||||
|
return ResponseMsgUtil.success(new PageInfo<>(highMerchantStoreService.getMerchantStoreList(map))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("HighMerchantStoreController -> getStoreListByMerchant() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -1,7 +0,0 @@ |
|||||||
package com.hai.dao; |
|
||||||
|
|
||||||
/** |
|
||||||
* mapper扩展类 |
|
||||||
*/ |
|
||||||
public interface HighMemberPayPasswordMapperExt { |
|
||||||
} |
|
@ -0,0 +1,7 @@ |
|||||||
|
package com.hai.dao; |
||||||
|
|
||||||
|
/** |
||||||
|
* mapper扩展类 |
||||||
|
*/ |
||||||
|
public interface HighUserPayPasswordMapperExt { |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package com.hai.service; |
||||||
|
|
||||||
|
import com.hai.entity.HighMerchant; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 商户业务 |
||||||
|
*/ |
||||||
|
public interface HighMerchantService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑 |
||||||
|
*/ |
||||||
|
void editMerchant(HighMerchant highMerchant); |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据id查询 |
||||||
|
* @param id |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
HighMerchant getMerchantById(Long id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询列表 |
||||||
|
* @param map |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<HighMerchant> getMerchantList(Map<String,Object> map); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.hai.service; |
||||||
|
|
||||||
|
import com.hai.entity.HighMerchantStore; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author 胡锐 |
||||||
|
* @Description 门店服务 |
||||||
|
* @Date 2021/3/9 20:15 |
||||||
|
**/ |
||||||
|
public interface HighMerchantStoreService { |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author 胡锐 |
||||||
|
* @Description 编辑门店 |
||||||
|
* @Date 2021/3/9 20:26 |
||||||
|
**/ |
||||||
|
void editMerchantStore(HighMerchantStore highMerchantStore); |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author 胡锐 |
||||||
|
* @Description 根据id查询 |
||||||
|
* @Date 2021/3/9 20:26 |
||||||
|
**/ |
||||||
|
HighMerchantStore getMerchantStoreById(Long id); |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author 胡锐 |
||||||
|
* @Description 查询门店列表 |
||||||
|
* @Date 2021/3/9 20:26 |
||||||
|
**/ |
||||||
|
List<HighMerchantStore> getMerchantStoreList(Map<String, Object> map); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
package com.hai.service.impl; |
||||||
|
|
||||||
|
import com.hai.dao.HighMerchantMapper; |
||||||
|
import com.hai.entity.HighMerchant; |
||||||
|
import com.hai.entity.HighMerchantExample; |
||||||
|
import com.hai.service.HighMerchantService; |
||||||
|
import org.apache.commons.collections4.MapUtils; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Service("highMerchantService") |
||||||
|
public class HighMerchantServiceImpl implements HighMerchantService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private HighMerchantMapper highMerchantMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void editMerchant(HighMerchant highMerchant) { |
||||||
|
if (highMerchant.getId() == null) { |
||||||
|
highMerchantMapper.insert(highMerchant); |
||||||
|
} else { |
||||||
|
highMerchantMapper.updateByPrimaryKey(highMerchant); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public HighMerchant getMerchantById(Long id) { |
||||||
|
return highMerchantMapper.selectByPrimaryKey(id); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<HighMerchant> getMerchantList(Map<String, Object> map) { |
||||||
|
HighMerchantExample example = new HighMerchantExample(); |
||||||
|
HighMerchantExample.Criteria criteria = example.createCriteria(); |
||||||
|
|
||||||
|
if (MapUtils.getLong(map, "companyId") != null) { |
||||||
|
criteria.andCompanyIdEqualTo(MapUtils.getLongValue(map, "companyId")); |
||||||
|
} |
||||||
|
|
||||||
|
if (MapUtils.getLong(map, "merchantKey") != null) { |
||||||
|
criteria.andMerchantKeyEqualTo(MapUtils.getString(map, "merchantKey")); |
||||||
|
} |
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "merchantName"))) { |
||||||
|
criteria.andMerchantNameLike("%" + MapUtils.getString(map, "merchantName") + "%"); |
||||||
|
} |
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "telephone"))) { |
||||||
|
criteria.andTelephoneEqualTo(MapUtils.getString(map, "telephone")); |
||||||
|
} |
||||||
|
|
||||||
|
example.setOrderByClause("create_time desc"); |
||||||
|
return highMerchantMapper.selectByExample(example); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,64 @@ |
|||||||
|
package com.hai.service.impl; |
||||||
|
|
||||||
|
|
||||||
|
import com.hai.dao.HighMerchantStoreMapper; |
||||||
|
import com.hai.entity.HighMerchantStore; |
||||||
|
import com.hai.entity.HighMerchantStoreExample; |
||||||
|
import com.hai.service.HighMerchantStoreService; |
||||||
|
import org.apache.commons.collections4.MapUtils; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Service("highMerchantStoreService") |
||||||
|
public class HighMerchantStoreServiceImpl implements HighMerchantStoreService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private HighMerchantStoreMapper highMerchantStoreMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void editMerchantStore(HighMerchantStore highMerchantStore) { |
||||||
|
if (highMerchantStore.getId() != null) { |
||||||
|
highMerchantStoreMapper.updateByPrimaryKey(highMerchantStore); |
||||||
|
} else { |
||||||
|
highMerchantStoreMapper.insert(highMerchantStore); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public HighMerchantStore getMerchantStoreById(Long id) { |
||||||
|
return highMerchantStoreMapper.selectByPrimaryKey(id); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<HighMerchantStore> getMerchantStoreList(Map<String, Object> map) { |
||||||
|
HighMerchantStoreExample example = new HighMerchantStoreExample(); |
||||||
|
HighMerchantStoreExample.Criteria criteria = example.createCriteria(); |
||||||
|
|
||||||
|
if (MapUtils.getLong(map, "companyId") != null) { |
||||||
|
criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId")); |
||||||
|
} |
||||||
|
|
||||||
|
if (MapUtils.getLong(map, "merchantId") != null) { |
||||||
|
criteria.andMerchantIdEqualTo(MapUtils.getLong(map, "merchantId")); |
||||||
|
} |
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "storeKey"))) { |
||||||
|
criteria.andStoreKeyEqualTo(MapUtils.getString(map, "storeKey")); |
||||||
|
} |
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "storeName"))) { |
||||||
|
criteria.andStoreNameLike("%" + MapUtils.getString(map, "storeName") + "%"); |
||||||
|
} |
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "telephone"))) { |
||||||
|
criteria.andTelephoneEqualTo("%" + MapUtils.getString(map, "telephone") + "%"); |
||||||
|
} |
||||||
|
|
||||||
|
example.setOrderByClause("create_time desc"); |
||||||
|
return highMerchantStoreMapper.selectByExample(example); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue