Commit 8d7454c0 by guojuxing

批量分组接口修复:sql语法错误

parent c52d0619
......@@ -17,11 +17,16 @@ public class TabSysCollaborator {
private String collaboratorName;
/**
* 商户
* 主体商户
*/
private Integer enterpriseId;
/**
* 协作商户
*/
private Integer collaborationEnterpriseId;
/**
* 手机号码
*/
private String phone;
......@@ -85,6 +90,14 @@ public class TabSysCollaborator {
this.enterpriseId = enterpriseId;
}
public Integer getCollaborationEnterpriseId() {
return collaborationEnterpriseId;
}
public void setCollaborationEnterpriseId(Integer collaborationEnterpriseId) {
this.collaborationEnterpriseId = collaborationEnterpriseId;
}
public String getPhone() {
return phone;
}
......
......@@ -141,6 +141,7 @@
user_id, enterprise_id, status,
type, create_time, update_time
)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.accountGroupRelId},
......
......@@ -5,6 +5,7 @@
<id column="collaborator_id" jdbcType="INTEGER" property="collaboratorId" />
<result column="collaborator_name" jdbcType="VARCHAR" property="collaboratorName" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="collaboration_enterprise_id" jdbcType="INTEGER" property="collaborationEnterpriseId" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="app_id" jdbcType="VARCHAR" property="appId" />
<result column="app_name" jdbcType="VARCHAR" property="appName" />
......@@ -15,7 +16,8 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
collaborator_id, collaborator_name, enterprise_id, phone, app_id, app_name, creator, sub_app_ids, status, create_time, update_time
collaborator_id, collaborator_name, enterprise_id, collaboration_enterprise_id, phone,
app_id, app_name, creator, sub_app_ids, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -29,13 +31,13 @@
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabSysCollaborator">
insert into tab_sys_collaborator (collaborator_id, collaborator_name,
enterprise_id, phone, app_id,
app_name,
enterprise_id, collaboration_enterprise_id,
phone, app_id, app_name,
creator, sub_app_ids, status,
create_time, update_time)
values (#{collaboratorId,jdbcType=INTEGER}, #{collaboratorName,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=INTEGER}, #{phone,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR},
#{appName,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=INTEGER}, #{collaborationEnterpriseId,jdbcType=INTEGER},
#{phone,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR}, #{appName,jdbcType=VARCHAR},
#{creator,jdbcType=VARCHAR}, #{subAppIds,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
......@@ -51,6 +53,9 @@
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="collaborationEnterpriseId != null">
collaboration_enterprise_id,
</if>
<if test="phone != null">
phone,
</if>
......@@ -86,6 +91,9 @@
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="collaborationEnterpriseId != null">
#{collaborationEnterpriseId,jdbcType=INTEGER},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
......@@ -121,6 +129,9 @@
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="collaborationEnterpriseId != null">
collaboration_enterprise_id = #{collaborationEnterpriseId,jdbcType=INTEGER},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
......@@ -152,6 +163,7 @@
update tab_sys_collaborator
set collaborator_name = #{collaboratorName,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
collaboration_enterprise_id = #{collaborationEnterpriseId,jdbcType=INTEGER},
phone = #{phone,jdbcType=VARCHAR},
app_id = #{appId,jdbcType=VARCHAR},
app_name = #{appName,jdbcType=VARCHAR},
......@@ -168,7 +180,8 @@
a.collaborator_id collaboratorId,
a.collaborator_name collaboratorName,
a.enterprise_id enterpriseId,
b.enterprise_name enterpriseName,
a.collaboration_enterprise_id collaborationEnterpriseId,
b.enterprise_name collaborationEnterpriseName,
a.phone phone,
a.appId appId,
a.app_name appName,
......@@ -177,8 +190,8 @@
a.create_time createTime
from tab_sys_collaborator a
left join tab_enterprise b on a.enterprise_id = b.enterprise_id
where 1=1
left join tab_enterprise b on a.collaboration_enterprise_id = b.enterprise_id
where enterprise_id = #{enterpriseId}
<if test="search != null and search != '' ">
and (a.collaborator_name like concat('%', search, '%') or a.phone like concat('%', search, '%') or b.enterprise_name like concat('%', search, '%') )
</if>
......@@ -191,24 +204,24 @@
</select>
<select id="listByCollaboratorIdList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
SELECT <include refid="Base_Column_List" />
from tab_sys_collaborator
where 1=1
<if test="list != null and list.size() > 0">
<if test="list != null and list.size() &gt; 0">
and collaborator_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
<foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="listNotInCollaboratorIdList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
SELECT <include refid="Base_Column_List" />
from tab_sys_collaborator
where enterprise_id = #{enterpriseId}
<if test="list != null and list.size() > 0">
<if test="list != null and list.size() &gt; 0">
and collaborator_id not in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
<foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</if>
......
package com.gic.auth.web.controller;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.auth.qo.CollaboratorListQO;
import com.gic.auth.service.CollaboratorApiService;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
@RestController
@RequestMapping("/collaborator")
public class CollaboratorController {
private static final Logger LOGGER = LogManager.getLogger(CollaboratorController.class);
@Autowired
private CollaboratorApiService collaboratorApiService;
@RequestMapping("/list")
public RestResponse list(CollaboratorListQO params) {
return ResultControllerUtils.commonResult(collaboratorApiService.page(params));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment