Search in sources :

Example 1 with Dept

use of com.ikoori.vip.common.persistence.model.Dept in project vip by guangdada.

the class DeptTest method addDeptTest.

@Test
public void addDeptTest() {
    Dept dept = new Dept();
    dept.setFullname("测试fullname");
    dept.setNum(5);
    dept.setPid(1);
    dept.setSimplename("测试");
    dept.setTips("测试tips");
    dept.setVersion(1);
    Integer insert = deptMapper.insert(dept);
    assertEquals(insert, new Integer(1));
}
Also used : Dept(com.ikoori.vip.common.persistence.model.Dept) Test(org.junit.Test)

Example 2 with Dept

use of com.ikoori.vip.common.persistence.model.Dept in project vip by guangdada.

the class DeptTest method deleteTest.

@Test
public void deleteTest() {
    Dept dept = this.deptMapper.selectById(24);
    Integer integer = deptMapper.deleteById(dept);
    assertTrue(integer > 0);
}
Also used : Dept(com.ikoori.vip.common.persistence.model.Dept) Test(org.junit.Test)

Example 3 with Dept

use of com.ikoori.vip.common.persistence.model.Dept in project vip by guangdada.

the class DeptServiceImpl method deleteDept.

@Override
public void deleteDept(Integer deptId) {
    Dept dept = deptMapper.selectById(deptId);
    Wrapper<Dept> wrapper = new EntityWrapper<>();
    wrapper = wrapper.like("pids", "%[" + dept.getId() + "]%");
    List<Dept> subDepts = deptMapper.selectList(wrapper);
    for (Dept temp : subDepts) {
        temp.deleteById();
    }
    dept.deleteById();
}
Also used : Dept(com.ikoori.vip.common.persistence.model.Dept) EntityWrapper(com.baomidou.mybatisplus.mapper.EntityWrapper)

Example 4 with Dept

use of com.ikoori.vip.common.persistence.model.Dept in project vip by guangdada.

the class DeptController method deptUpdate.

/**
 * 跳转到修改部门
 */
@Permission
@RequestMapping("/dept_update/{deptId}")
public String deptUpdate(@PathVariable Integer deptId, Model model) {
    Dept dept = deptMapper.selectById(deptId);
    model.addAttribute(dept);
    model.addAttribute("pName", ConstantFactory.me().getDeptName(dept.getPid()));
    LogObjectHolder.me().set(dept);
    return PREFIX + "dept_edit.html";
}
Also used : Dept(com.ikoori.vip.common.persistence.model.Dept) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with Dept

use of com.ikoori.vip.common.persistence.model.Dept in project vip by guangdada.

the class DeptController method deptSetPids.

private void deptSetPids(Dept dept) {
    if (ToolUtil.isEmpty(dept.getPid()) || dept.getPid().equals("0")) {
        dept.setPid(0);
        dept.setPids("[0],");
    } else {
        int pid = dept.getPid();
        Dept temp = deptMapper.selectById(pid);
        String pids = temp.getPids();
        dept.setPid(pid);
        dept.setPids(pids + "[" + pid + "],");
    }
}
Also used : Dept(com.ikoori.vip.common.persistence.model.Dept)

Aggregations

Dept (com.ikoori.vip.common.persistence.model.Dept)6 Test (org.junit.Test)3 EntityWrapper (com.baomidou.mybatisplus.mapper.EntityWrapper)1 Permission (com.ikoori.vip.common.annotion.Permission)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1