You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.4 KiB

package com.zh.project0512.mapper;
import com.zh.project0512.model.QywxDepartmentGroupLink;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zh
* @since 2022-06-24
*/
public interface QywxDepartmentGroupLinkMapper extends BaseMapper<QywxDepartmentGroupLink> {
@Insert("<script> " +
"insert into qywxDepartmentGroupLink (groupId,departmentId,creatAt) values\n"+
" <foreach collection= 'departmentIdList' item= 'item' separator=','>\n" +
"(#{groupId},#{item},#{creatAt})\n"+
"</foreach> \n"+
"</script>")
void groupAddDepartment(Integer groupId, List<Integer> departmentIdList, LocalDateTime creatAt);
List<Map> departmentList(Integer groupId);
@Select("SELECT t1.departmentId\n" +
"from qywxDepartmentGroupLink as t1\n" +
"LEFT JOIN qywxDepartmentGroup as t2 on t1.groupId = t2.id\n" +
"INNER JOIN qywxDepartment as t3 on t3.departmentId = t1.departmentId \n" +
"where t2.id in \n" +
"<foreach collection='groupIdList' index='index' item='item' open='(' separator=',' close=')'>" +
"#{item}" +
"</foreach>" +
"GROUP BY departmentId")
List<Integer> departmentIdList(List<Integer> groupIdList);
}