| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | return webParam; |
| | | } |
| | | |
| | | @Override |
| | | public WebParam findOneNew() { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | QueryWrapper<WebParam> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(WebParam::getCompanyId,user.getCompanyId()); |
| | | wrapper.last(" limit 1 "); |
| | | WebParam webParam = webParamMapper.selectOne(wrapper); |
| | | return webParam; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void renew(UpdateWebParamDTO updateWebParamDTO) { |
| | |
| | | webParamMapper.updateById(webParam); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void renewUpdate(UpdateWebParamDTO updateWebParamDTO){ |
| | | if(StringUtils.isBlank(updateWebParamDTO.getNewParam())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | QueryWrapper<WebParam> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(WebParam::getCompanyId,user.getCompanyId()); |
| | | wrapper.last(" limit 1 "); |
| | | WebParam webParam = webParamMapper.selectOne(wrapper); |
| | | if(Objects.isNull(webParam)){ |
| | | webParam = new WebParam(); |
| | | BeanUtils.copyProperties(updateWebParamDTO,webParam); |
| | | webParam.setCreateTime(new Date()); |
| | | webParam.setDeleted(Constants.ZERO); |
| | | webParam.setCompanyId(user.getCompanyId()); |
| | | webParam.setCreateUser(user.getId()); |
| | | webParamMapper.insert(webParam); |
| | | }else{ |
| | | BeanUtils.copyProperties(updateWebParamDTO,webParam); |
| | | webParam.setUpdateUser(user.getId()); |
| | | webParam.setUpdateTime(new Date()); |
| | | webParamMapper.updateById(webParam); |
| | | } |
| | | } |
| | | |
| | | } |