| | |
| | | import com.moral.api.mapper.OrganizationMapper; |
| | | import com.moral.api.pojo.dto.organization.OrganizationDTO; |
| | | import com.moral.api.pojo.dto.organization.OrganizationQueryDTO; |
| | | import com.moral.api.pojo.dto.organization.OrganizationQueryNameDTO; |
| | | import com.moral.api.pojo.dto.organization.OrganizationQueryNamesDTO; |
| | | import com.moral.api.pojo.form.organization.*; |
| | | import com.moral.api.service.OrganizationService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.util.ConvertUtils; |
| | | import com.moral.util.DateUtils; |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | import java.util.function.Predicate; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | //form转entity |
| | | Organization organization = organizationUpdateForm.formConvertEntity(); |
| | | |
| | | //查询组织是否存在 |
| | | QueryWrapper<Organization> existWrapper = new QueryWrapper<>(); |
| | | Organization existOrganization = new Organization(); |
| | | existOrganization.setId(organization.getId()); |
| | | existOrganization.setIsDelete(Constants.NOT_DELETE); |
| | | existWrapper.setEntity(existOrganization); |
| | | existOrganization = organizationMapper.selectOne(existWrapper); |
| | | if (ObjectUtils.isEmpty(existOrganization)) { |
| | | //查找要更新的组织用于插入日志 |
| | | QueryWrapper<Organization> oldWrapper = new QueryWrapper<>(); |
| | | Organization oldOrganization = new Organization(); |
| | | oldOrganization.setId(organization.getId()); |
| | | oldOrganization.setIsDelete(Constants.NOT_DELETE); |
| | | oldWrapper.setEntity(oldOrganization); |
| | | oldOrganization = organizationMapper.selectOne(oldWrapper); |
| | | if (ObjectUtils.isEmpty(oldOrganization)) { |
| | | organizationDTO.setCode(ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getCode()); |
| | | organizationDTO.setMsg(ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getMsg()); |
| | | return organizationDTO; |
| | |
| | | organizationDTO.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | |
| | | //操作插入日志 |
| | | insertUpdateLog(organizationUpdateForm, organization, existOrganization); |
| | | insertUpdateLog(organizationUpdateForm, organization, oldOrganization); |
| | | |
| | | return organizationDTO; |
| | | } |
| | |
| | | organizationMapper.update(null, updateWrapper); |
| | | } |
| | | } |
| | | |
| | | //删除组织对应账号 |
| | | |
| | | //封装返回结果 |
| | | dto.setOrganization(existOrganization); |
| | |
| | | } |
| | | |
| | | /** |
| | | * @Description: 查询所有组织的名称和Id,不做分页 |
| | | * @Param: [organizationQueryNameForm] |
| | | * @Description: 查询所有组织的名称和Id |
| | | * @Param: [] |
| | | * @return: com.moral.api.pojo.dto.organization.OrganizationQueryNameDTO |
| | | * @Author: 陈凯裕 |
| | | * @Date: 2021/4/13 |
| | | */ |
| | | @Override |
| | | public OrganizationQueryNameDTO queryOrganizationNames(OrganizationQueryNameForm form) { |
| | | OrganizationQueryNameDTO dto = new OrganizationQueryNameDTO(); |
| | | //取参 |
| | | String name = form.getName(); |
| | | public OrganizationQueryNamesDTO queryNames(OrganizationQueryNamesForm from) { |
| | | OrganizationQueryNamesDTO dto = new OrganizationQueryNamesDTO(); |
| | | //构造查询条件 |
| | | NullFilterWrapper<Organization> queryWrapper = new NullFilterWrapper(); |
| | | queryWrapper.like("name", name); |
| | | QueryWrapper<Organization> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("is_delete", Constants.NOT_DELETE); |
| | | //查询 |
| | | List<Organization> organizations = organizationMapper.selectList(queryWrapper); |