Commit ee54424b by 吴迪

【修改】机构id兼容

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