作者 朱兆平

CRM列表接口

package com.tianbo.warehouse.controller;
import com.github.pagehelper.PageInfo;
import com.tianbo.warehouse.annotation.LogAnnotation;
import com.tianbo.warehouse.controller.response.ResultJson;
import com.tianbo.warehouse.model.ROLE;
import com.tianbo.warehouse.model.RolePermission;
import com.tianbo.warehouse.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@RestController()
@RequestMapping("/crm")
@Api(tags = {"客户资源管理"})
public class CRMController {
@Autowired
RoleService roleService;
@ApiOperation(value = "查询客户资源列表", notes = "查询客户资源列表")
@GetMapping("/list")
public ResultJson<PageInfo<ROLE>> list(@RequestParam(value = "pageNum",required = false,defaultValue = "1")
int pageNum,
@RequestParam(value = "pageSize",required = false,defaultValue = "10")
int pageSize,
@RequestBody ROLE role){
PageInfo<ROLE> rolePageInfo = roleService.orgSelectWithRootNoTree(role,pageNum, pageSize);
return new ResultJson<PageInfo<ROLE>>("200","success",rolePageInfo);
}
}
... ...
... ... @@ -40,6 +40,9 @@ public interface ROLEMapper {
List<ROLE> findAllWithOutTree(@Param("roleName") String roleName,
@Param("type") String type);
List<ROLE> orgSelectWithRootNoTree(ROLE record);
int updateByPrimaryKeySelective(ROLE record);
int updateByPrimaryKey(ROLE record);
... ...
... ... @@ -7,6 +7,8 @@ import com.tianbo.warehouse.model.RolePermission;
public interface RoleService {
PageInfo<ROLE> findAll(int pageNum, int pageSize, String roleName, String type);
public PageInfo<ROLE> orgSelectWithRootNoTree(ROLE role,int pageNum, int pageSize);
int insertSelective(ROLE record);
int setRolePermissoin(RolePermission record);
... ...
... ... @@ -86,6 +86,24 @@ public class RoleServiceImp implements RoleService{
return result;
}
/**
* 客户信息管理
* @param role
* @param pageNum
* @param pageSize
* @return
*/
@Override
public PageInfo<ROLE> orgSelectWithRootNoTree(ROLE role, int pageNum, int pageSize){
Page<ROLE> page = PageHelper.startPage(pageNum,pageSize);
List<ROLE> list = roleMapper.orgSelectWithRootNoTree(role);
PageInfo<ROLE> result = new PageInfo<ROLE>(list);
return result;
}
@Override
public int insertSelective(ROLE record){
return roleMapper.insertSelective(record);
... ... @@ -151,4 +169,6 @@ public class RoleServiceImp implements RoleService{
}
}
... ...
... ... @@ -324,4 +324,25 @@ WHERE
</where>
order by parentId,rsort
</select>
<select id="orgSelectWithRootNoTree" parameterType="com.tianbo.warehouse.model.ROLE" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM role
<where>
parentId = 0
<if test="roleName != '' and roleName !=null">
and role_name = #{roleName, jdbcType=VARCHAR}
</if>
<if test="type != '' and type !=null">
and type like '%' #{type} '%'
</if>
<if test="orgtype != '' and orgtype !=null">
and org_type = #{orgtype, jdbcType=VARCHAR}
</if>
<if test="departmentid != '' and departmentid !=null">
and departmentId = #{departmentid, jdbcType=VARCHAR}
</if>
</where>
order by parentId,rsort
</select>
</mapper>
... ...