Search in sources :

Example 21 with EntityWrapper

use of com.baomidou.mybatisplus.mapper.EntityWrapper in project haha by hahafreeasair666.

the class PhoneServiceImpl method checkPhoneNum.

@Override
public Boolean checkPhoneNum(String mobile) {
    Wrapper<Phone> wrapper = new EntityWrapper<>();
    wrapper.eq("phone_num", mobile);
    Integer count = this.selectCount(wrapper);
    if (count != 0) {
        return false;
    } else {
        Phone phone = new Phone(mobile);
        this.insert(phone);
        return true;
    }
}
Also used : Phone(com.ch999.haha.admin.entity.Phone) EntityWrapper(com.baomidou.mybatisplus.mapper.EntityWrapper)

Example 22 with EntityWrapper

use of com.baomidou.mybatisplus.mapper.EntityWrapper in project haha by hahafreeasair666.

the class UserInfoServiceImpl method getUserCenterInfo.

@Override
public OtherCenterVO getUserCenterInfo(Integer userId, Integer loginUserId) {
    OtherCenterVO userCenterVO = new OtherCenterVO();
    UserCenterInfoCountVO userInfoCount = getUserInfoCount(userId);
    userCenterVO.setUserId(userId);
    userCenterVO.setFollows(userInfoCount.getFollow());
    userCenterVO.setFans(userInfoCount.getFans());
    UserInfoBO one = userInfoBORepository.findOne(userId);
    if (one == null) {
        return null;
    }
    userCenterVO.setAvatar(one.getUserInfo().getPicPath());
    userCenterVO.setDescription(one.getUserInfo().getAutograph());
    userCenterVO.setMyCredit(one.getCreditInfo().get("creditNum") != null ? (int) one.getCreditInfo().get("creditNum") : 0);
    userCenterVO.setUserName(one.getUserInfo().getUsername());
    // 组装是否已关注信息
    if (loginUserId != null) {
        Wrapper<UserFans> wrapper = new EntityWrapper<>();
        wrapper.eq("userid1", loginUserId);
        wrapper.eq("userid2", userId);
        if (userFansService.selectCount(wrapper) == 0 && !userId.equals(loginUserId)) {
            userCenterVO.setIsCanFollow(true);
        } else {
            userCenterVO.setIsCanFollow(false);
        }
    } else {
        userCenterVO.setIsCanFollow(true);
    }
    return userCenterVO;
}
Also used : UserCenterInfoCountVO(com.ch999.haha.admin.vo.mappervo.UserCenterInfoCountVO) EntityWrapper(com.baomidou.mybatisplus.mapper.EntityWrapper) UserFans(com.ch999.haha.admin.entity.UserFans) OtherCenterVO(com.ch999.haha.admin.vo.OtherCenterVO) UserInfoBO(com.ch999.haha.admin.document.redis.UserInfoBO)

Example 23 with EntityWrapper

use of com.baomidou.mybatisplus.mapper.EntityWrapper in project haha by hahafreeasair666.

the class ApiTests method test1.

@Test
public void test1() {
    Wrapper<News> newsWrapper = new EntityWrapper<>();
    newsWrapper.eq("parentid", 15).lt("createtime", new Date());
    List<News> news = newsService.selectList(newsWrapper);
    System.out.println();
}
Also used : News(com.ch999.haha.admin.entity.News) EntityWrapper(com.baomidou.mybatisplus.mapper.EntityWrapper) Date(java.util.Date) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

EntityWrapper (com.baomidou.mybatisplus.mapper.EntityWrapper)23 News (com.ch999.haha.admin.entity.News)5 Date (java.util.Date)5 Adoption (com.ch999.haha.admin.entity.Adoption)4 AdoptionRequest (com.ch999.haha.admin.entity.AdoptionRequest)4 JSONObject (com.alibaba.fastjson.JSONObject)3 BussinessException (com.ikoori.vip.common.exception.BussinessException)3 Dict (com.ikoori.vip.common.persistence.model.Dict)3 Transactional (org.springframework.transaction.annotation.Transactional)3 JSONArray (com.alibaba.fastjson.JSONArray)2 UserFans (com.ch999.haha.admin.entity.UserFans)2 Permission (com.ikoori.vip.common.annotion.Permission)2 Member (com.ikoori.vip.common.persistence.model.Member)2 Menu (com.ikoori.vip.common.persistence.model.Menu)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 CommentZanBO (com.ch999.haha.admin.document.redis.CommentZanBO)1 UserInfoBO (com.ch999.haha.admin.document.redis.UserInfoBO)1 AdoptionFeedBack (com.ch999.haha.admin.entity.AdoptionFeedBack)1 Phone (com.ch999.haha.admin.entity.Phone)1 UserInfo (com.ch999.haha.admin.entity.UserInfo)1