10 changed files with 242 additions and 20 deletions
@ -0,0 +1,55 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.opendata.entity.BaseGridInfoEntity; |
||||
|
import com.epmet.opendata.entity.ExDeptEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 网格基础信息表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-15 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ExDeptDao extends BaseDao<ExDeptEntity> { |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 网格基础信息批量更新部分字段 |
||||
|
**/ |
||||
|
int updateBatch(@Param("list") List<ExDeptEntity> entityList); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 网格基础信息批量更新部分字段 |
||||
|
**/ |
||||
|
int insertBatch(@Param("list") List<ExDeptEntity> entityList); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 网格基础信息批量更新部分字段 |
||||
|
**/ |
||||
|
int updateBatchGrid(@Param("list") List<ExDeptEntity> entityList); |
||||
|
|
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 部门(网格)中间表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-15 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("ex_dept") |
||||
|
public class ExDeptEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* (区县平台)部门id |
||||
|
*/ |
||||
|
private String deptIdQx; |
||||
|
|
||||
|
/** |
||||
|
* (区县平台)部门/网格名称 |
||||
|
*/ |
||||
|
private String deptNameQx; |
||||
|
|
||||
|
/** |
||||
|
* 部门/网格编码 |
||||
|
*/ |
||||
|
private String gridCode; |
||||
|
|
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
<?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"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.opendata.dao.ExDeptDao"> |
||||
|
|
||||
|
<update id="updateBatch"> |
||||
|
UPDATE ex_dept |
||||
|
<trim prefix="set" suffixOverrides=","> |
||||
|
|
||||
|
<trim prefix="dept_id_qx =(case" suffix="end),"> |
||||
|
<foreach collection="list" item="item"> |
||||
|
<if test='null != item.deptIdQx'> |
||||
|
when grid_code = #{item.gridCode} then #{item.deptIdQx} |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
|
||||
|
<trim prefix="dept_name_qx =(case" suffix="end),"> |
||||
|
<foreach collection="list" item="item"> |
||||
|
<if test='null != item.deptNameQx'> |
||||
|
when grid_code = #{item.gridCode} then #{item.deptNameQx} |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
|
||||
|
</trim> |
||||
|
WHERE |
||||
|
1=1 |
||||
|
<foreach collection="list" item="item" open="AND( " separator=" OR " index="index" close=")"> |
||||
|
grid_code = #{item.gridCode} |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
<insert id="insertBatch"> |
||||
|
INSERT INTO ex_dept |
||||
|
( |
||||
|
dept_id_qx, |
||||
|
dept_name_qx |
||||
|
) |
||||
|
VALUES |
||||
|
<foreach collection="list" item="i" separator=","> |
||||
|
( |
||||
|
#{i.deptIdQx}, |
||||
|
#{i.deptNameQx} |
||||
|
) |
||||
|
</foreach> |
||||
|
ON DUPLICATE KEY |
||||
|
UPDATE |
||||
|
dept_id_qx = values(dept_id_qx), |
||||
|
dept_name_qx = values(dept_name_qx) |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateBatchGrid"> |
||||
|
UPDATE ex_dept |
||||
|
<trim prefix="set" suffixOverrides=","> |
||||
|
|
||||
|
<trim prefix="dept_id_qx =(case" suffix="end),"> |
||||
|
<foreach collection="list" item="item"> |
||||
|
<if test='null != item.deptIdQx'> |
||||
|
when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptIdQx} |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
|
||||
|
<trim prefix="dept_name_qx =(case" suffix="end),"> |
||||
|
<foreach collection="list" item="item"> |
||||
|
<if test='null != item.deptNameQx'> |
||||
|
when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptNameQx} |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
|
||||
|
</trim> |
||||
|
WHERE |
||||
|
1=1 |
||||
|
<foreach collection="list" item="item" open="AND( " separator=" OR " index="index" close=")"> |
||||
|
dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue