Commit ee54424b by 吴迪

【修改】机构id兼容

parent 26aa5b5d
...@@ -6,8 +6,10 @@ import java.util.Map; ...@@ -6,8 +6,10 @@ import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.app.annotation.Login; import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.DocEntity; import io.office.modules.manage.entity.DocEntity;
import io.office.modules.manage.service.CodeagentService;
import io.office.modules.manage.vo.request.ShortCodeVo; import io.office.modules.manage.vo.request.ShortCodeVo;
import io.office.modules.manage.vo.response.BranchEntityVo; import io.office.modules.manage.vo.response.BranchEntityVo;
import org.apache.commons.lang.ArrayUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -36,6 +38,8 @@ import javax.servlet.http.HttpServletRequest; ...@@ -36,6 +38,8 @@ import javax.servlet.http.HttpServletRequest;
public class BranchController { public class BranchController {
@Autowired @Autowired
private BranchService branchService; private BranchService branchService;
@Autowired
private CodeagentService codeagentService;
/** /**
* 列表 * 列表
...@@ -88,9 +92,13 @@ public class BranchController { ...@@ -88,9 +92,13 @@ public class BranchController {
@RequestMapping("/delete") @RequestMapping("/delete")
// @RequiresPermissions("manage:branch:delete") // @RequiresPermissions("manage:branch:delete")
public R delete(@RequestBody String[] branchCodes){ public R delete(@RequestBody String[] branchCodes){
if(ArrayUtils.isNotEmpty(branchCodes)) {
for (String branchCode : branchCodes) {
branchCode=branchCode.trim();
}
}
branchService.removeByIds(Arrays.asList(branchCodes)); branchService.removeByIds(Arrays.asList(branchCodes));
codeagentService.removeByIds(Arrays.asList(branchCodes));
return R.ok(); return R.ok();
} }
......
...@@ -3,6 +3,9 @@ package io.office.modules.manage.controller; ...@@ -3,6 +3,9 @@ package io.office.modules.manage.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -48,8 +51,9 @@ public class CodeagentController { ...@@ -48,8 +51,9 @@ public class CodeagentController {
*/ */
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
// @RequiresPermissions("manage:codeagent:info") // @RequiresPermissions("manage:codeagent:info")
public R info(@PathVariable("id") Integer id){ public R info(@PathVariable("id") String id){
CodeagentEntity codeagent = codeagentService.getById(id);
CodeagentEntity codeagent = codeagentService.getById(id.trim());
return R.ok().put("codeagent", codeagent); return R.ok().put("codeagent", codeagent);
} }
...@@ -73,11 +77,11 @@ public class CodeagentController { ...@@ -73,11 +77,11 @@ public class CodeagentController {
public R update(@RequestBody CodeagentEntity codeagent){ public R update(@RequestBody CodeagentEntity codeagent){
CodeagentEntity codeagentServiceById = codeagentService.getById(codeagent.getId()); CodeagentEntity codeagentServiceById = codeagentService.getById(codeagent.getId());
if(codeagentServiceById!=null) { QueryWrapper<CodeagentEntity> updateWrapper = new QueryWrapper<>();
codeagentService.updateById(codeagent); updateWrapper.eq("id",codeagent.getId());
} else{ codeagent.setId(codeagent.getId());
codeagentService.save(codeagent); codeagentService.saveOrUpdate(codeagent,updateWrapper);
}
return R.ok(); return R.ok();
} }
......
package io.office.modules.manage.entity; package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -22,7 +23,7 @@ public class CodeagentEntity implements Serializable { ...@@ -22,7 +23,7 @@ public class CodeagentEntity implements Serializable {
/** /**
* $column.comments * $column.comments
*/ */
@TableId @TableId(type=IdType.INPUT)
private Integer id; private Integer id;
/** /**
* $column.comments * $column.comments
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
c.personname c.personname
FROM FROM
center_outer.dbo.branch a center_outer.dbo.branch a
LEFT JOIN codeagent b ON a.branch_code = b.Id LEFT JOIN codeagent b ON ltrim(rtrim(a.branch_code)) = ltrim(rtrim(b.id))
LEFT JOIN center_outer.dbo.person c ON a.branch_contact = c.personid LEFT JOIN center_outer.dbo.person c ON a.branch_contact = c.personid
WHERE WHERE
branch_code = #{branchCode} ltrim(rtrim(branch_code)) = ltrim(rtrim(#{branchCode}))
</select> </select>
<select id="getListPage" resultType="io.office.modules.manage.vo.response.BranchEntityVo"> <select id="getListPage" resultType="io.office.modules.manage.vo.response.BranchEntityVo">
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
b.website b.website
FROM FROM
center_outer.dbo.branch a center_outer.dbo.branch a
LEFT JOIN codeagent b ON a.branch_code = b.id LEFT JOIN codeagent b ON ltrim(rtrim(a.branch_code)) = ltrim(rtrim(b.id))
WHERE WHERE
branch_code &lt;&gt; '0000' ltrim(rtrim(a.branch_code)) &lt;&gt; '0000'
<if test="params.branchName!=null and params.branchName!=''"> <if test="params.branchName!=null and params.branchName!=''">
and a.branch_name like concat('%',#{params.branchName},'%') and a.branch_name like concat('%',#{params.branchName},'%')
</if> </if>
......
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