不同sql方案测试

master
hansha 1 year ago
parent 0afeb30541
commit d52406e9d6

@ -55,6 +55,28 @@ public class DaCatalog extends BaseEntity
/** 当前目录及子目录识别数量 */
private Long sbCount;
/** 顺序排序 */
private String xuhao;
/** 拼音排序 */
private String spell;
public String getXuhao() {
return xuhao;
}
public void setXuhao(String xuhao) {
this.xuhao = xuhao;
}
public String getSpell() {
return spell;
}
public void setSpell(String spell) {
this.spell = spell;
}
public Long getSbCount() {
return sbCount;
}

@ -39,6 +39,31 @@ public class DaCatalogController extends BaseController
}
/**
*
* @param daCatalog
* @return
*/
//@PreAuthorize("@ss.hasPermi('dangan:catalog:list')")
@GetMapping("/count")
public AjaxResult count(DaCatalog daCatalog)
{
List<DaCatalog> catalogs = daCatalogService.selectDaCatalogListAndcount(daCatalog, getLoginUser());
return success(catalogs);
}
/**
* order_num
*/
@GetMapping("/number/{id}")
public AjaxResult getNumber(@PathVariable("id") Long id)
{
AjaxResult result = new AjaxResult();
Integer num = daCatalogService.selectNumByPid(id);
num = num!=null?++num:0;
return result.success("操作成功").put("orderNum",num);
}
/**
*
*/
@GetMapping("/treeselect")

@ -65,4 +65,6 @@ public interface DaBirthDjMapper
Long selectCountByMuIds(List<Long> ids);
List<DaBirthDj> searchDaBirthDjList1(DaBirthDj daBirthDj);
List<Long> selectCountByMuIds2(List<List<Long>> list);
}

@ -68,4 +68,6 @@ public interface DaCatalogMapper
List<Long> selectCatalogIdsByUserId(Long userId);
List<Long> selectContainIdsById(String id);
Integer selectNumByPid(Long id);
}

@ -65,4 +65,6 @@ public interface DaCzrkdjMapper
Long selectCountByMuIds(List<Long> muIds);
List<DaCzrkdj> searchDaCzrkdjList1(DaCzrkdj daCzrkdj);
List<Long> selectCountByMuIds2(List<List<Long>> list);
}

@ -65,4 +65,6 @@ public interface DaQyzMapper
Long selectCountByMuIds(List<Long> ids);
List<DaQyz> searchDaQyzList1(DaQyz daQyz);
List<Long> selectCountByMuIds2(List<List<Long>> list);
}

@ -65,4 +65,6 @@ public interface DaYtzmMapper
Long selectCountByMuIds(List<Long> ids);
List<DaYtzm> searchYtzmList1(DaYtzm daYtzm);
List<Long> selectCountByMuIds2(List<List<Long>> list);
}

@ -65,4 +65,6 @@ public interface DaZfnyhkcgMapper
Long selectCountByMuIds(List<Long> ids);
List<DaZfnyhkcg> searchDaZfnyhkcgList1(DaZfnyhkcg daZfnyhkcg);
List<Long> selectCountByMuIds2(List<List<Long>> list);
}

@ -65,4 +65,6 @@ public interface DaZqzMapper
Long selectCountByMuIds(List<Long> ids);
List<DaZqz> searchDaZqzList1(DaZqz daZqz);
List<Long> selectCountByMuIds2(List<List<Long>> list);
}

@ -84,4 +84,8 @@ public interface IDaCatalogService
List<DaCatalog> selectAllDaCatalogList(DaCatalog daCatalog);
public List<DaCatalog> selectDaCatalogListAndcount(DaCatalog daCatalog, LoginUser user);
Integer selectNumByPid(Long id);
}

@ -15,9 +15,7 @@ import com.da.dangan.service.IDaCatalogService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -27,8 +25,7 @@ import java.util.stream.Collectors;
* @date 2024-05-08
*/
@Service
public class DaCatalogServiceImpl implements IDaCatalogService
{
public class DaCatalogServiceImpl implements IDaCatalogService {
@Resource
private DaCatalogMapper daCatalogMapper;
@Resource
@ -45,6 +42,7 @@ public class DaCatalogServiceImpl implements IDaCatalogService
private DaZfnyhkcgMapper daZfnyhkcgMapper;
@Resource
private DaZqzMapper daZqzMapper;
/**
*
*
@ -52,8 +50,7 @@ public class DaCatalogServiceImpl implements IDaCatalogService
* @return
*/
@Override
public DaCatalog selectDaCatalogById(Long id)
{
public DaCatalog selectDaCatalogById(Long id) {
return daCatalogMapper.selectDaCatalogById(id);
}
@ -75,22 +72,18 @@ public class DaCatalogServiceImpl implements IDaCatalogService
* @return
*/
@Override
public List<DaCatalog> buildCatalogTree(List<DaCatalog> catalogs)
{
public List<DaCatalog> buildCatalogTree(List<DaCatalog> catalogs) {
List<DaCatalog> returnList = new ArrayList<>();
List<Long> tempList = catalogs.stream().map(DaCatalog::getId).collect(Collectors.toList());
for (Iterator<DaCatalog> iterator = catalogs.iterator(); iterator.hasNext();)
{
for (Iterator<DaCatalog> iterator = catalogs.iterator(); iterator.hasNext(); ) {
DaCatalog catalog = iterator.next();
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(catalog.getPid()))
{
if (!tempList.contains(catalog.getPid())) {
recursionFn(catalogs, catalog);
returnList.add(catalog);
}
}
if (returnList.isEmpty())
{
if (returnList.isEmpty()) {
returnList = catalogs;
}
return returnList;
@ -98,6 +91,7 @@ public class DaCatalogServiceImpl implements IDaCatalogService
/**
*
*
* @param daCatalog
* @return
*/
@ -113,16 +107,30 @@ public class DaCatalogServiceImpl implements IDaCatalogService
* @return
*/
@Override
public List<DaCatalog> selectDaCatalogList(DaCatalog daCatalog, LoginUser loginUser)
{
public List<DaCatalog> selectDaCatalogList(DaCatalog daCatalog, LoginUser loginUser) {
List<DaCatalog> catalogList;
// 超管及角色为管理员显示所有目录信息
if (SysUser.isAdmin(loginUser.getUserId())||
loginUser.getUser().getRoles().stream().anyMatch(sysRole -> sysRole.getRoleKey().equals("sysAdmin")))
{
if (SysUser.isAdmin(loginUser.getUserId()) ||
loginUser.getUser().getRoles().stream().anyMatch(sysRole -> sysRole.getRoleKey().equals("sysAdmin"))) {
catalogList = daCatalogMapper.selectDaCatalogList(daCatalog);
} else
{ //根据用户权限显示目录信息
} else { //根据用户权限显示目录信息
daCatalog.getParams().put("userId", loginUser.getUserId());
catalogList = daCatalogMapper.selectDaCatalogListByUserId(daCatalog);
}
return catalogList;
}
/**
*
*/
@Override
public List<DaCatalog> selectDaCatalogListAndcount(DaCatalog daCatalog, LoginUser loginUser) {
List<DaCatalog> catalogList;
// 超管及角色为管理员显示所有目录信息
if (SysUser.isAdmin(loginUser.getUserId()) ||
loginUser.getUser().getRoles().stream().anyMatch(sysRole -> sysRole.getRoleKey().equals("sysAdmin"))) {
catalogList = daCatalogMapper.selectDaCatalogList(daCatalog);
} else { //根据用户权限显示目录信息
daCatalog.getParams().put("userId", loginUser.getUserId());
catalogList = daCatalogMapper.selectDaCatalogListByUserId(daCatalog);
}
@ -173,9 +181,79 @@ public class DaCatalogServiceImpl implements IDaCatalogService
}
}
//第二种方式
/*Map<String, List<DaCatalog>> mapCollect = catalogList.stream().collect(Collectors.groupingBy(DaCatalog::getYwType));
//将map集合转为set集合遍历
Set<Map.Entry<String, List<DaCatalog>>> entries = mapCollect.entrySet();
for (Map.Entry<String, List<DaCatalog>> m : entries) {
List<Long> counts = new ArrayList<>();//存储结果
List<List<Long>> idsList = new ArrayList<>();//存储参数
for (int i = 0; i < m.getValue().size(); i++) {
List<Long> ids = new ArrayList<>();
//查询子目录的所有id集合
ids=daCatalogMapper.selectContainIdsById(m.getValue().get(i).getId().toString());
ids.add(m.getValue().get(i).getId());
idsList.add(ids);
}
switch (m.getKey()) {
case "option1": //常住人口登记表1
//break;
case "option2": //常住卡
// break;
case "option3": //常住人口登记表2
//break;
case "option9": //常住人口登记表3
counts = daCzrkdjMapper.selectCountByMuIds2(idsList);
for (int i = 0, j = 0; i < m.getValue().size(); i++, j++) {
m.getValue().get(i).setSbCount(counts.get(j));
}
break;
case "option4":
//出生医学证明
counts = daBirthDjMapper.selectCountByMuIds2(idsList);
for (int i = 0, j = 0; i < m.getValue().size(); i++, j++) {
m.getValue().get(i).setSbCount(counts.get(j));
}
break;
case "option5":
//迁移证
counts = daQyzMapper.selectCountByMuIds2(idsList);
for (int i = 0, j = 0; i < m.getValue().size(); i++, j++) {
m.getValue().get(i).setSbCount(counts.get(j));
}
break;
case "option6":
//一胎证明
counts = daYtzmMapper.selectCountByMuIds2(idsList);
for (int i = 0, j = 0; i < m.getValue().size(); i++, j++) {
m.getValue().get(i).setSbCount(counts.get(j));
}
break;
case "option7":
//转非农业人口批复存根
counts = daZfnyhkcgMapper.selectCountByMuIds2(idsList);
for (int i = 0, j = 0; i < m.getValue().size(); i++, j++) {
m.getValue().get(i).setSbCount(counts.get(j));
}
break;
case "option8":
//准迁证
counts = daZqzMapper.selectCountByMuIds2(idsList);
for (int i = 0, j = 0; i < m.getValue().size(); i++, j++) {
m.getValue().get(i).setSbCount(counts.get(j));
}
break;
}
}*/
return catalogList;
}
@Override
public Integer selectNumByPid(Long id) {
return daCatalogMapper.selectNumByPid(id);
}
/**
*
*
@ -183,16 +261,14 @@ public class DaCatalogServiceImpl implements IDaCatalogService
* @return
*/
@Override
public int insertDaCatalog(DaCatalog daCatalog)
{
public int insertDaCatalog(DaCatalog daCatalog) {
daCatalog.setCreateTime(DateUtils.getNowDate());
if(daCatalog.getPid()==0){ //代表添加的是主目录
if (daCatalog.getPid() == 0) { //代表添加的是主目录
daCatalog.setAncestors(daCatalog.getPid().toString());
}else{
} else {
DaCatalog info = daCatalogMapper.selectDaCatalogById(daCatalog.getPid());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
{
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
throw new ServiceException("此目录停用,不允许新增");
}
daCatalog.setAncestors(info.getAncestors() + "," + daCatalog.getPid());
@ -208,8 +284,7 @@ public class DaCatalogServiceImpl implements IDaCatalogService
* @return
*/
@Override
public int updateDaCatalog(DaCatalog daCatalog)
{
public int updateDaCatalog(DaCatalog daCatalog) {
daCatalog.setUpdateTime(DateUtils.getNowDate());
return daCatalogMapper.updateDaCatalog(daCatalog);
}
@ -221,24 +296,23 @@ public class DaCatalogServiceImpl implements IDaCatalogService
* @return
*/
@Override
public AjaxResult deleteDaCatalogById(Long id)
{
public AjaxResult deleteDaCatalogById(Long id) {
DaCatalog catalog = new DaCatalog();
catalog.setPid(id);
//有子级目录的不能删除
List<DaCatalog> daCatalogs = daCatalogMapper.selectDaCatalogList(catalog);
if(daCatalogs!=null&&daCatalogs.size()>0){
if (daCatalogs != null && daCatalogs.size() > 0) {
return AjaxResult.error("有子级目录,不能删除");
}
//目录下已有上传图片的 不能删除
DaPicturesRecard picturesRecard = new DaPicturesRecard();
picturesRecard.setMuId(id);
List<DaPicturesRecard> daPicturesRecards = daPicturesRecardMapper.selectDaPicturesRecardList(picturesRecard);
if(daPicturesRecards!=null&&daPicturesRecards.size()>0){
if (daPicturesRecards != null && daPicturesRecards.size() > 0) {
return AjaxResult.error("目录下有已上传的图片,不能删除");
}
int i= daCatalogMapper.deleteDaCatalogById(id);
if(i>0){
int i = daCatalogMapper.deleteDaCatalogById(id);
if (i > 0) {
return AjaxResult.success();
}
return AjaxResult.error();
@ -251,8 +325,7 @@ public class DaCatalogServiceImpl implements IDaCatalogService
* @return
*/
@Override
public int deleteDaCatalogByIds(Long[] ids)
{
public int deleteDaCatalogByIds(Long[] ids) {
return daCatalogMapper.deleteDaCatalogByIds(ids);
}
@ -260,8 +333,7 @@ public class DaCatalogServiceImpl implements IDaCatalogService
public boolean checkDaCatalogNameUnique(DaCatalog daCatalog) {
Long daCatalogId = StringUtils.isNull(daCatalog.getId()) ? -1L : daCatalog.getId();
DaCatalog info = daCatalogMapper.checkDaCatalogNameUnique(daCatalog.getMuName(), daCatalog.getPid());
if (StringUtils.isNotNull(info) && info.getId().longValue() != daCatalogId.longValue())
{
if (StringUtils.isNotNull(info) && info.getId().longValue() != daCatalogId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@ -273,15 +345,12 @@ public class DaCatalogServiceImpl implements IDaCatalogService
* @param list
* @param t
*/
private void recursionFn(List<DaCatalog> list, DaCatalog t)
{
private void recursionFn(List<DaCatalog> list, DaCatalog t) {
// 得到子节点列表
List<DaCatalog> childList = getChildList(list, t);
t.setChildren(childList);
for (DaCatalog tChild : childList)
{
if (hasChild(list, tChild))
{
for (DaCatalog tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
@ -290,15 +359,12 @@ public class DaCatalogServiceImpl implements IDaCatalogService
/**
*
*/
private List<DaCatalog> getChildList(List<DaCatalog> list, DaCatalog t)
{
private List<DaCatalog> getChildList(List<DaCatalog> list, DaCatalog t) {
List<DaCatalog> tlist = new ArrayList<DaCatalog>();
Iterator<DaCatalog> it = list.iterator();
while (it.hasNext())
{
while (it.hasNext()) {
DaCatalog n = (DaCatalog) it.next();
if (n.getPid().longValue() == t.getId().longValue())
{
if (n.getPid().longValue() == t.getId().longValue()) {
tlist.add(n);
}
}
@ -308,8 +374,7 @@ public class DaCatalogServiceImpl implements IDaCatalogService
/**
*
*/
private boolean hasChild(List<DaCatalog> list, DaCatalog t)
{
private boolean hasChild(List<DaCatalog> list, DaCatalog t) {
return getChildList(list, t).size() > 0;
}

@ -176,6 +176,20 @@
#{muId}
</foreach>
</select>
<!--查询该目录集合下有多少条数据-->
<select id="selectCountByMuIds2" parameterType="java.util.List" resultType="Long">
<foreach collection="list" item="item" separator="union all">
select count(1) from da_birth_dj where mu_id in
<if test="item!=null and item.size()>0">
<foreach item="muId" collection="item" index="index" open="(" separator="," close=")">
#{muId}
</foreach>
</if>
<if test="item==null">
(null)
</if>
</foreach>
</select>
<insert id="insertDaBirthDj" parameterType="DaBirthDj" useGeneratedKeys="true" keyProperty="id">
insert into da_birth_dj

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.da.dangan.mapper.DaCatalogMapper">
<resultMap type="DaCatalog" id="DaCatalogResult">
<result property="id" column="id" />
<result property="muName" column="mu_name" />
<result property="pid" column="pid" />
<result property="ancestors" column="ancestors" />
<result property="orderNum" column="order_num" />
<result property="ywType" column="yw_type" />
<result property="picPath" column="pic_path" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="id" column="id"/>
<result property="muName" column="mu_name"/>
<result property="pid" column="pid"/>
<result property="ancestors" column="ancestors"/>
<result property="orderNum" column="order_num"/>
<result property="ywType" column="yw_type"/>
<result property="picPath" column="pic_path"/>
<result property="status" column="status"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectDaCatalogVo">
@ -27,40 +27,87 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDaCatalogList" parameterType="DaCatalog" resultMap="DaCatalogResult">
<include refid="selectDaCatalogVo"/>
<where>
<if test="muName != null and muName != ''"> and mu_name like concat('%', #{muName}, '%')</if>
<if test="pid != null "> and pid = #{pid}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="ywType != null and ywType != ''"> and yw_type = #{ywType}</if>
<if test="picPath != null and picPath != ''"> and pic_path = #{picPath}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="muName != null and muName != ''">and mu_name like concat('%', #{muName}, '%')</if>
<if test="pid != null ">and pid = #{pid}</if>
<if test="ancestors != null and ancestors != ''">and ancestors = #{ancestors}</if>
<if test="orderNum != null ">and order_num = #{orderNum}</if>
<if test="ywType != null and ywType != ''">and yw_type = #{ywType}</if>
<if test="picPath != null and picPath != ''">and pic_path = #{picPath}</if>
<if test="status != null and status != ''">and status = #{status}</if>
</where>
order by pid, order_num
</select>
<select id="selectDaCatalogById" parameterType="Long" resultMap="DaCatalogResult">
<include refid="selectDaCatalogVo"/>
where id = #{id}
</select>
<select id="checkDaCatalogNameUnique" resultMap="DaCatalogResult">
<include refid="selectDaCatalogVo"/>
where mu_name=#{muName} and pid = #{pid} limit 1
<choose>
<when test="spell == null and xuhao == null">
order by pid asc, order_num desc
</when>
<when test="xuhao != null and xuhao =='1'.toString()">
order by pid asc, order_num desc
</when>
<when test="xuhao != null and xuhao =='0'.toString()">
order by pid asc, order_num asc
</when>
<when test="spell != null and spell =='1'.toString()">
order by pid asc,CONVERT(mu_name USING gbk) desc
</when>
<when test="spell != null and spell =='0'.toString()">
order by pid asc,CONVERT(mu_name USING gbk) asc
</when>
<!-- <otherwise>
order by pid asc, order_num desc
</otherwise>-->
</choose>
<!--order by pid, order_num-->
</select>
<select id="selectDaCatalogListByUserId" parameterType="DaCatalog" resultMap="DaCatalogResult">
select distinct c.*
from da_catalog c
left join da_user_catalog uc on c.id = uc.mu_id
where uc.user_id = #{params.userId}
<where>uc.user_id = #{params.userId}
<if test="muName != null and muName != ''">
AND c.mu_name like concat('%', #{muName}, '%')
</if>
<if test="status != null and status != ''">
AND c.status = #{status}
</if>
order by c.pid, c.order_num
</where>
<choose>
<when test="spell == null and xuhao == null">
order by pid asc, order_num desc
</when>
<when test="xuhao != null and xuhao =='1'.toString()">
order by pid asc, order_num desc
</when>
<when test="xuhao != null and xuhao =='0'.toString()">
order by pid asc, order_num asc
</when>
<when test="spell != null and spell =='1'.toString()">
order by pid asc,CONVERT(mu_name USING gbk) desc
</when>
<when test="spell != null and spell =='0'.toString()">
order by pid asc,CONVERT(mu_name USING gbk) asc
</when>
<!-- <otherwise>
order by pid asc, order_num desc
</otherwise>-->
</choose>
<!--order by pid, order_num-->
</select>
<!--根据pid查询第一子级的最大order_num-->
<select id="selectNumByPid" parameterType="Long" resultType="Integer">
select Max(order_num) from da_catalog where pid = #{id}
</select>
<select id="selectDaCatalogById" parameterType="Long" resultMap="DaCatalogResult">
<include refid="selectDaCatalogVo"/>
where id = #{id}
</select>
<select id="checkDaCatalogNameUnique" resultMap="DaCatalogResult">
<include refid="selectDaCatalogVo"/>
where mu_name=#{muName} and pid = #{pid} limit 1
</select>
<!--查用户所包含权限的id的集合-->
<select id="selectCatalogIdsByUserId" resultType="Long">
select c.id
@ -69,9 +116,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where uc.user_id = #{userId}
order by c.pid, c.order_num
</select>
<!--查用所有子目录ids-->
<select id="selectContainIdsById" resultType="Long">
select id from da_catalog where ancestors like concat('%', #{id}, '%')
select id from da_catalog where
(
ancestors like concat('%,', #{id}, ',%')
or ancestors like concat('%,', #{id})
)
</select>
<insert id="insertDaCatalog" parameterType="DaCatalog" useGeneratedKeys="true" keyProperty="id">

@ -229,6 +229,21 @@
</foreach>
</select>
<!--查询该目录集合下包含有多少条数据集合-->
<select id="selectCountByMuIds2" parameterType="java.util.List" resultType="Long">
<foreach collection="list" item="item" separator="union all">
select count(1) from da_czrkdj where mu_id in
<if test="item!=null and item.size()>0">
<foreach item="muId" collection="item" index="index" open="(" separator="," close=")">
#{muId}
</foreach>
</if>
<if test="item==null">
(null)
</if>
</foreach>
</select>
<insert id="insertDaCzrkdj" parameterType="DaCzrkdj" useGeneratedKeys="true" keyProperty="id">
insert into da_czrkdj
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -188,6 +188,20 @@
#{muId}
</foreach>
</select>
<!--查询该目录集合下有多少条数据-->
<select id="selectCountByMuIds2" parameterType="java.util.List" resultType="Long">
<foreach collection="list" item="item" separator="union all">
select count(1) from da_qyz where mu_id in
<if test="item!=null and item.size()>0">
<foreach item="muId" collection="item" index="index" open="(" separator="," close=")">
#{muId}
</foreach>
</if>
<if test="item==null">
(null)
</if>
</foreach>
</select>
<insert id="insertDaQyz" parameterType="DaQyz" useGeneratedKeys="true" keyProperty="id">
insert into da_qyz

@ -157,7 +157,20 @@
#{muId}
</foreach>
</select>
<!--查询该目录集合下有多少条数据-->
<select id="selectCountByMuIds2" parameterType="java.util.List" resultType="Long">
<foreach collection="list" item="item" separator="union all">
select count(1) from da_ytzm where mu_id in
<if test="item!=null and item.size()>0">
<foreach item="muId" collection="item" index="index" open="(" separator="," close=")">
#{muId}
</foreach>
</if>
<if test="item==null">
(null)
</if>
</foreach>
</select>
<insert id="insertDaYtzm" parameterType="DaYtzm" useGeneratedKeys="true" keyProperty="id">
insert into da_ytzm
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -197,6 +197,20 @@
#{muId}
</foreach>
</select>
<!--查询该目录集合下有多少条数据-->
<select id="selectCountByMuIds2" parameterType="java.util.List" resultType="Long">
<foreach collection="list" item="item" separator="union all">
select count(1) from da_zfnyhkcg where mu_id in
<if test="item!=null and item.size()>0">
<foreach item="muId" collection="item" index="index" open="(" separator="," close=")">
#{muId}
</foreach>
</if>
<if test="item==null">
(null)
</if>
</foreach>
</select>
<insert id="insertDaZfnyhkcg" parameterType="DaZfnyhkcg" useGeneratedKeys="true" keyProperty="id">
insert into da_zfnyhkcg
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -220,7 +220,20 @@
#{muId}
</foreach>
</select>
<!--查询该目录集合下有多少条数据-->
<select id="selectCountByMuIds2" parameterType="java.util.List" resultType="Long">
<foreach collection="list" item="item" separator="union all">
select count(1) from da_zqz where mu_id in
<if test="item!=null and item.size()>0">
<foreach item="muId" collection="item" index="index" open="(" separator="," close=")">
#{muId}
</foreach>
</if>
<if test="item==null">
(null)
</if>
</foreach>
</select>
<insert id="insertDaZqz" parameterType="DaZqz" useGeneratedKeys="true" keyProperty="id">
insert into da_zqz
<trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save