| | |
| | |
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
| | | import com.moral.common.util.Crypto;
|
| | | import com.moral.common.util.ResourceUtil;
|
| | | import com.moral.entity.Account;
|
| | | import com.moral.entity.Organization;
|
| | | import com.moral.mapper.AccountMapper;
|
| | | import com.moral.mapper.OrganizationMapper;
|
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.OrganizationService;
|
| | |
|
| | |
| | | @Resource
|
| | | private OrganizationService organizationService;
|
| | |
|
| | | @Resource
|
| | | private OrganizationMapper organizationMapper;
|
| | | |
| | | @Override
|
| | | public Map<String, Object> screenLogin(Map<String, Object> parameters) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | |
| | | }
|
| | | PageHelper.startPage(Integer.valueOf((String) parameters.get("pageIndex")), Integer.valueOf((String) parameters.get("pageSize")));
|
| | | List<Account> accounts = accountMapper.selectByExample(example);
|
| | | Set<Integer> organizationIds = new HashSet<Integer>();
|
| | | for (Account account : accounts) {
|
| | | if (!ObjectUtils.isEmpty(account.getOrganizationId())) {
|
| | | organizationIds.add(account.getOrganizationId());
|
| | | }
|
| | | }
|
| | | if(!ObjectUtils.isEmpty(organizationIds)){
|
| | | example = new Example(Organization.class);
|
| | | example.or().andIn("id", organizationIds);
|
| | | List<Organization> organizations = organizationMapper.selectByExample(example);
|
| | | for (Account account : accounts) {
|
| | | for (Organization organization : organizations) {
|
| | | if (account.getOrganizationId() == organization.getId()) {
|
| | | account.setOrganization(organization);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return new PageBean<Account>(accounts);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public Integer deleteAccountByLogic(Account account) {
|
| | | account.setIsDelete(Constants.IS_DELETE_TRUE);
|
| | | if (account.getId() > 0) {
|
| | | throw new BusinessException("hahahahahah..................");
|
| | | }
|
| | | return accountMapper.updateByPrimaryKeySelective(account);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public Integer deleteAccountsByLogic(List<Integer> ids) {
|
| | | Account account = new Account();
|
| | | account.setIsDelete(Constants.IS_DELETE_TRUE);
|
| | |
| | | return accountMapper.updateByExampleSelective(account, example);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Integer getAccountCountByAccountName(String accountName) {
|
| | | Account account = new Account();
|
| | | account.setAccountName(accountName);
|
| | | return accountMapper.selectCount(account);
|
| | | }
|
| | |
|
| | | }
|