| | |
| | | import com.moral.common.bean.Constants;
|
| | | import com.moral.common.bean.PageBean;
|
| | | import com.moral.common.exception.BusinessException;
|
| | | 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>();
|
| | |
| | | public PageBean<Account> getAccountListByPage(Map<String, Object> parameters) {
|
| | | Example example = new Example(Account.class);
|
| | | Criteria criteria = example.createCriteria();
|
| | | if (parameters.containsKey("name")) {
|
| | | criteria.andLike("name", "%" + (String) parameters.get("name") + "%");
|
| | | if (parameters.containsKey("accountName")) {
|
| | | criteria.andLike("accountName", "%" + (String) parameters.get("accountName") + "%");
|
| | | }
|
| | | if (parameters.containsKey("mobile")) {
|
| | | criteria.andLike("mobile", "%" + (String) parameters.get("mobile") + "%");
|
| | | }
|
| | | if (parameters.containsKey("isDelete")) {
|
| | | criteria.andEqualTo("isDelete", parameters.get("isDelete"));
|
| | | }
|
| | | if (parameters.containsKey("sorter")) {
|
| | | example.setOrderByClause((String) parameters.get("sorter"));
|
| | | }
|
| | | PageHelper.startPage(Integer.valueOf((String) parameters.get("pageIndex")), Integer.valueOf((String) parameters.get("pageSize")));
|
| | | List<Account> accounts = accountMapper.selectByExample(example);
|
| | | for (Account account : accounts) {
|
| | | if (!ObjectUtils.isEmpty(account.getOrganizationId())) {
|
| | | Organization organization = organizationMapper.selectByPrimaryKey(account.getOrganizationId());
|
| | | account.setOrganization(organization);
|
| | | }
|
| | | }
|
| | | return new PageBean<Account>(accounts);
|
| | | }
|
| | |
|
| | |
| | | if (ObjectUtils.isEmpty(account.getId())) {
|
| | | account.setIsDelete(Constants.IS_DELETE_FALSE);
|
| | | account.setCreateTime(new Date());
|
| | | account.setPassword(Crypto.md5(ResourceUtil.getValue("password")));
|
| | | return accountMapper.insertSelective(account);
|
| | | }else {
|
| | | } else {
|
| | | return accountMapper.updateByPrimaryKeySelective(account);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public Integer deleteAccountsByLogic(List<Integer> ids) {
|
| | | Account account = new Account();
|
| | | account.setIsDelete(Constants.IS_DELETE_TRUE);
|
| | | Example example = new Example(Account.class);
|
| | | example.or().andIn("id", ids);
|
| | | return accountMapper.updateByExampleSelective(account, example);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Integer getAccountCountByAccountName(String accountName) {
|
| | | Account account = new Account();
|
| | | account.setAccountName(accountName);
|
| | | return accountMapper.selectCount(account);
|
| | | }
|
| | |
|
| | | }
|