作者 朱兆平

CRM列表接口

  1 +package com.tianbo.warehouse.controller;
  2 +
  3 +import com.github.pagehelper.PageInfo;
  4 +import com.tianbo.warehouse.annotation.LogAnnotation;
  5 +import com.tianbo.warehouse.controller.response.ResultJson;
  6 +import com.tianbo.warehouse.model.ROLE;
  7 +import com.tianbo.warehouse.model.RolePermission;
  8 +import com.tianbo.warehouse.service.RoleService;
  9 +import io.swagger.annotations.Api;
  10 +import io.swagger.annotations.ApiOperation;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import javax.servlet.http.HttpServletRequest;
  15 +import javax.servlet.http.HttpServletResponse;
  16 +import javax.validation.Valid;
  17 +
  18 +@RestController()
  19 +@RequestMapping("/crm")
  20 +@Api(tags = {"客户资源管理"})
  21 +public class CRMController {
  22 +
  23 + @Autowired
  24 + RoleService roleService;
  25 +
  26 +
  27 + @ApiOperation(value = "查询客户资源列表", notes = "查询客户资源列表")
  28 + @GetMapping("/list")
  29 + public ResultJson<PageInfo<ROLE>> list(@RequestParam(value = "pageNum",required = false,defaultValue = "1")
  30 + int pageNum,
  31 + @RequestParam(value = "pageSize",required = false,defaultValue = "10")
  32 + int pageSize,
  33 + @RequestBody ROLE role){
  34 +
  35 + PageInfo<ROLE> rolePageInfo = roleService.orgSelectWithRootNoTree(role,pageNum, pageSize);
  36 + return new ResultJson<PageInfo<ROLE>>("200","success",rolePageInfo);
  37 +
  38 + }
  39 +
  40 +
  41 +}
@@ -40,6 +40,9 @@ public interface ROLEMapper { @@ -40,6 +40,9 @@ public interface ROLEMapper {
40 List<ROLE> findAllWithOutTree(@Param("roleName") String roleName, 40 List<ROLE> findAllWithOutTree(@Param("roleName") String roleName,
41 @Param("type") String type); 41 @Param("type") String type);
42 42
  43 +
  44 + List<ROLE> orgSelectWithRootNoTree(ROLE record);
  45 +
43 int updateByPrimaryKeySelective(ROLE record); 46 int updateByPrimaryKeySelective(ROLE record);
44 47
45 int updateByPrimaryKey(ROLE record); 48 int updateByPrimaryKey(ROLE record);
@@ -7,6 +7,8 @@ import com.tianbo.warehouse.model.RolePermission; @@ -7,6 +7,8 @@ import com.tianbo.warehouse.model.RolePermission;
7 public interface RoleService { 7 public interface RoleService {
8 PageInfo<ROLE> findAll(int pageNum, int pageSize, String roleName, String type); 8 PageInfo<ROLE> findAll(int pageNum, int pageSize, String roleName, String type);
9 9
  10 + public PageInfo<ROLE> orgSelectWithRootNoTree(ROLE role,int pageNum, int pageSize);
  11 +
10 int insertSelective(ROLE record); 12 int insertSelective(ROLE record);
11 13
12 int setRolePermissoin(RolePermission record); 14 int setRolePermissoin(RolePermission record);
@@ -86,6 +86,24 @@ public class RoleServiceImp implements RoleService{ @@ -86,6 +86,24 @@ public class RoleServiceImp implements RoleService{
86 return result; 86 return result;
87 } 87 }
88 88
  89 + /**
  90 + * 客户信息管理
  91 + * @param role
  92 + * @param pageNum
  93 + * @param pageSize
  94 + * @return
  95 + */
  96 + @Override
  97 + public PageInfo<ROLE> orgSelectWithRootNoTree(ROLE role, int pageNum, int pageSize){
  98 + Page<ROLE> page = PageHelper.startPage(pageNum,pageSize);
  99 +
  100 + List<ROLE> list = roleMapper.orgSelectWithRootNoTree(role);
  101 +
  102 + PageInfo<ROLE> result = new PageInfo<ROLE>(list);
  103 +
  104 + return result;
  105 + }
  106 +
89 @Override 107 @Override
90 public int insertSelective(ROLE record){ 108 public int insertSelective(ROLE record){
91 return roleMapper.insertSelective(record); 109 return roleMapper.insertSelective(record);
@@ -151,4 +169,6 @@ public class RoleServiceImp implements RoleService{ @@ -151,4 +169,6 @@ public class RoleServiceImp implements RoleService{
151 } 169 }
152 170
153 171
  172 +
  173 +
154 } 174 }
@@ -324,4 +324,25 @@ WHERE @@ -324,4 +324,25 @@ WHERE
324 </where> 324 </where>
325 order by parentId,rsort 325 order by parentId,rsort
326 </select> 326 </select>
  327 + <select id="orgSelectWithRootNoTree" parameterType="com.tianbo.warehouse.model.ROLE" resultMap="BaseResultMap">
  328 + SELECT
  329 + <include refid="Base_Column_List" />
  330 + FROM role
  331 + <where>
  332 + parentId = 0
  333 + <if test="roleName != '' and roleName !=null">
  334 + and role_name = #{roleName, jdbcType=VARCHAR}
  335 + </if>
  336 + <if test="type != '' and type !=null">
  337 + and type like '%' #{type} '%'
  338 + </if>
  339 + <if test="orgtype != '' and orgtype !=null">
  340 + and org_type = #{orgtype, jdbcType=VARCHAR}
  341 + </if>
  342 + <if test="departmentid != '' and departmentid !=null">
  343 + and departmentId = #{departmentid, jdbcType=VARCHAR}
  344 + </if>
  345 + </where>
  346 + order by parentId,rsort
  347 + </select>
327 </mapper> 348 </mapper>