Package com.eatle.persistent.pojo.merchant.UserMerchantCriteria

Examples of com.eatle.persistent.pojo.merchant.UserMerchantCriteria.Criteria


  public int add(UserMerchant userMerchant)
  {
    int result = Constants.Base.FAIL;

    UserMerchantCriteria umc = new UserMerchantCriteria();
    Criteria criteria = umc.createCriteria();
    criteria.andUserIdEqualTo(userMerchant.getUserId());
    criteria.andMerchantIdEqualTo(userMerchant.getMerchantId());
    List<UserMerchant> userMerchants = userMerchantMapper.selectByCriteria(umc);

    if (userMerchants.size() < 1)
    {
      if(userMerchantMapper.insert(userMerchant) > 0)
View Full Code Here


  public int update(UserMerchant userMerchant, UserMerchant oldUserMerchant)
  {
    int result = Constants.Base.FAIL;
   
    UserMerchantCriteria umc = new UserMerchantCriteria();
    Criteria criteria = umc.createCriteria();
    criteria.andUserIdEqualTo(userMerchant.getUserId());
    criteria.andMerchantIdEqualTo(userMerchant.getMerchantId());
    List<UserMerchant> userMerchants = userMerchantMapper.selectByCriteria(umc);
    if (userMerchants.size() < 1)
    {
      if(userMerchantMapper.updateByPrimaryKeySelective(userMerchant) > 0)
      {
View Full Code Here

  @Override
  public Pagination findPagination(Map<String, Object> queryMap,
      int currentPage, int pageSize)
  {
    UserMerchantCriteria userMerchantCriteria = new UserMerchantCriteria();
    Criteria criteria = userMerchantCriteria.createCriteria();
    // 设置搜索条件参数
    if (queryMap != null)
    {
      if(queryMap.containsKey("merchantId"))
      {
        criteria.andMerchantIdEqualTo(Long.parseLong((String) queryMap.get("merchantId")));
      }
      else
      {
        // 如果未传入商家ID则停止查询,否则会查询到所有的餐厅(安全漏洞)
        return new Pagination(pageSize, currentPage, 0, new ArrayList<UserMerchant>());
      }
      if (queryMap.containsKey("userName"))
      {
        User user = new User();
        user.setUserName((String) queryMap.get("userName"));
        user = userService.find(user);
        if(user != null)
        {
          criteria.andUserIdEqualTo(user.getId());
        }
      }
    }
    // 设置分页参数
    userMerchantCriteria.setPageSize(pageSize);
View Full Code Here

TOP

Related Classes of com.eatle.persistent.pojo.merchant.UserMerchantCriteria.Criteria

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.