王佳豪
2021-06-26 718f604deb342b0bee6c588bb44e22ced3371fb8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.slcf.dao;
 
import java.util.List;
import java.util.Map;
 
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
 
import com.slcf.pojo.GroupBean;
 
@Repository
public interface GroupDao {
 
    /**
     *根据部门名称或部门id验证部门名称是否唯一 
     * @param map
     * @return
     */
    public List<GroupBean> getGroupByCon(Map<String,Object>map);
    
    /**
     * 添加部门
     * @param group
     * @return
     */
    @Insert("insert into t_b_Group(f_GroupName,f_GroupNO) values(#{f_GroupName},#{f_GroupNO})")
    public int insertGroup(GroupBean group);
    
    
    //分页查询所以部门
//    @Select("select * from tb_dept ORDER BY dept_id desc LIMIT #{spage},#{epage}")
    @Select("select top (#{epage}) * from t_b_Group where f_GroupID not in "
            + "(select top (#{spage}) f_GroupID from t_b_Group order by f_GroupID desc) order by f_GroupID desc")
    public List<GroupBean> queryGroupList(@Param("spage")int spage,@Param("epage")int epage);
    
    //统计所有部门数量
    @Select("select count(*) from t_b_Group")
    public int getGroupCount();
    
    /**
     * 查询所有部门
     * @return
     */
    @Select("select * from t_b_Group order by f_GroupID desc")
    public List<GroupBean> getGroupList();
    
    /**
     * 根据部门id查询部门信息
     * @param id
     * @return
     */
    @Select("select * from t_b_Group where f_GroupID=#{id}")
    public GroupBean getGroupById(int id);
    
    //更新
    @Update("update t_b_Group set f_GroupName=#{f_GroupName},f_GroupNO=#{f_GroupNO} where f_GroupID=#{f_GroupID}")
    public int upGroup(GroupBean group);
    
    //根据部门id删除部门表的信息
    @Delete("delete from t_b_Group where f_GroupID=#{id}")
    public int delGroupById(int id);
    
//    /**
//     * 添加部门操作记录表的信息
//     * @param did  部门id
//     * @param dname 操作人名字
//     * @param dtype 操作类型
//     * @return
//     */
//    @Insert("insert into tb_dept_opt(d_id,dopt_name,dopt_type,dopt_time) values(#{did},#{dname},#{dtype},getdate())")
//    public int insertGroupOpt(@Param("did")int did,@Param("dname")String dname,@Param("dtype")String dtype);
    
//    //根据部门id删除部门操作记录表信息
//    @Delete("delete from tb_dept_opt where d_id=#{id}")
//    public int delGroupOpt(int id);
    
//    /**
//     * 根据部门id查询部门操作表
//     * @param id
//     * @return
//     */
//    @Select("select * from tb_dept_opt where d_id=#{id}")
//    public List<DeptOpt> getOptList(int id);
}