| | |
| | | import com.moral.common.util.ExampleUtil;
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.entity.Organization;
|
| | | import com.moral.entity.exp.OrganizationExp;
|
| | | import com.moral.entity.OrganizationRelation;
|
| | | import com.moral.mapper.OrganizationMapper;
|
| | | import com.moral.mapper.OrganizationRelationMapper;
|
| | |
| | | List<Example.Criteria> criteriaList = example.getOredCriteria();
|
| | | if(criteriaList!=null&&criteriaList.size()>0){
|
| | | for(Example.Criteria cri : criteriaList){
|
| | | cri.andNotEqualTo("isDelete","1");
|
| | | cri.andNotEqualTo("isDelete",Constants.IS_DELETE_TRUE);
|
| | | }
|
| | | }else {
|
| | | example.or().andNotEqualTo("isDelete","1");
|
| | | example.or().andNotEqualTo("isDelete",Constants.IS_DELETE_TRUE);
|
| | | }
|
| | | PageHelper.startPage(pageBean.getPageIndex(),pageBean.getPageSize());
|
| | | List<OrganizationExp> organizationExpandList = organizationMapper.selectWithAreaNameByExample(example);
|
| | | return new PageBean(organizationExpandList);
|
| | | if(pageBean.getPageSize()>0){
|
| | | PageHelper.startPage(pageBean.getPageIndex(),pageBean.getPageSize());
|
| | | }
|
| | | if(example.getOrderByClause() == null || example.getOrderByClause().isEmpty()) {
|
| | | example.setOrderByClause("create_time desc");
|
| | | }
|
| | | List<Organization> organizationList = organizationMapper.selectWithAreaNameByExample(example);
|
| | | return new PageBean(organizationList);
|
| | | }
|
| | | public void addOrModify(Organization organization){
|
| | | try{
|
| | | if(organization.getId()==null){
|
| | | //新建数据,默认为未删除状态
|
| | | organization.setIsDelete("0");
|
| | | organization.setIsDelete(Constants.IS_DELETE_FALSE);
|
| | | organizationMapper.insertSelective(organization);
|
| | | }else{
|
| | | organizationMapper.updateByPrimaryKeySelective(organization);
|
| | |
| | | @Override
|
| | | public void deleteByIds(Integer... ids) {
|
| | | Organization organization = new Organization();
|
| | | organization.setIsDelete("1");
|
| | | organization.setIsDelete(Constants.IS_DELETE_TRUE);
|
| | | if(ids!=null&&ids.length>0){
|
| | | if(ids.length==1){
|
| | | organization.setId(ids[0]);
|
| | |
| | |
|
| | | @Override
|
| | | public List<Organization> getOrganizationsByName(String name) {
|
| | | ValidateUtil.notEmpty(name, "param.is.null");
|
| | | Example example = new Example(Organization.class);
|
| | | Criteria criteria = example.createCriteria();
|
| | | criteria.andLike("name", "%" + name + "%");
|
| | | criteria.andEqualTo("isDelete", Constants.IS_DELETE_FALSE);
|
| | |
|
| | | criteria.andEqualTo("isDelete", Constants.IS_DELETE_FALSE).andLike("name", "%" + name + "%");
|
| | | example.or().andEqualTo("isDelete", Constants.IS_DELETE_FALSE).andCondition("getPY(name) like ", "%" + name + "%");
|
| | |
|
| | | List<Organization> organizations = organizationMapper.selectByExample(example);
|
| | | return organizations;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Organization getOrganizationsById(int id) {
|
| | | Example example = new Example(ENTITY_CLASS);
|
| | | example.or().andEqualTo("id",id);
|
| | | List<Organization> organizationList = organizationMapper.selectWithAreaNameByExample(example);
|
| | | return organizationList.size()>0?organizationList.get(0):null;
|
| | | }
|
| | | }
|