温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Saas模式的crm项目模块是什么

发布时间:2021-10-19 10:44:08 来源:亿速云 阅读:106 作者:柒染 栏目:大数据

Saas模式的crm项目模块是什么,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

最近做Saas模式的crm项目员工模块功能总结: 项目采用maven管理,分为多模块开发的模式,这样方便项目的拆分和开发,避免所有的功能都 揉合在一起,这也是公司里比较常见的开发模式。

  1. 基础组件的创建

maven多模块项目结构搭建

Saas模式的crm项目模块是什么
使用代码生成器生成相应的mapper ,domain以及用Velocity生成相应的 js、jsp controller query service serviceimpl 文件

2.高级查询分页
分页查询,参照以前项目发现,分页数据需要一个请求得到总共多少条数据,和当前分页的第几页和当前页的数据。应该封装一个分页的service方法queryPageDataByQuery;再mapper层查询发送两条sql完成。并且把查询结果封装成一个分页对象返回。创建PageList封装分页对象。很多数据都有查询要求,封装一个BaseQuery对象,作为查询条件的base类。

PageList对象

public class PageList<T> {

    private long total = 0;
    private List<T> rows = new ArrayList<T>();

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }
}

public PageList<T> getByQuery(BaseQuery query) {
    //创建封装数据的PageList对象
    PageList<T> pageList = new PageList<T>();
    //设置分页条件
    Page page = PageHelper.startPage(query.getPage(),query.getRows());
    //查询当前页的数据
    List<T> rows = getMapper().selectByQuery(query);
    //获取总条目数
    long total = page.getTotal();
    //将数据封装到PageList对象中返回
    pageList.setRows(rows);
    pageList.setTotal(total);
    return pageList;
}

在对应的xml里面

<select id="selectByQuery" parameterType="EmployeeQuery" resultMap="BaseResultMap" >
  select e.*,d.name as dname
  from t_employee e
  left join t_department d on e.department_id = d.id
  <include refid="whereSql"/>
</select>

3.以及crud

@Controller@RequestMapping("/employee")public class EmployeeController {@Autowired    private IEmployeeService employeeService;    @RequestMapping("/index")public String index() {return "employee/employee";    }@RequestMapping("/getByid")@ResponseBody    public Employee getById(Long id){return employeeService.selectByPrimaryKey(id);    }@RequestMapping("/list")@ResponseBody//json    public PageResult<Employee> list(EmployeeQuery employeeQuery) {return employeeService.selectForList(employeeQuery);    }@RequestMapping("/page")@ResponseBody    public PageResult page(@RequestBody String  qu){
        EmployeeQuery query = JSONObject.parseObject(qu, EmployeeQuery.class);        return employeeService.selectForList(query);    }@RequestMapping("remove")@ResponseBody    public AjaxResult remove(Long id){
        System.out.println(id);        try {employeeService.deleteByPrimaryKey(id);            return AjaxResult.success();        }catch (Exception e){
            e.printStackTrace();            return AjaxResult.error("错了");        }
    }@RequestMapping(value = "/saveUpdate",method = RequestMethod.POST)@ResponseBody    public AjaxResult saveUpdate(@RequestBody String  product){
        Employee produ = JSONObject.parseObject(product, Employee.class);       /* System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");        System.out.println(produ.getAge());*/        try {if(produ.getId()==null){
                Date date = new Date();                produ.setAddtime(date);                employeeService.insert(produ);            }else {
                System.out.println("djeksdwdweferferferge");                System.out.println(produ.getInitiationtime());                System.out.println(produ.getAddtime());                employeeService.updateByPrimaryKey(produ);            }return AjaxResult.success();        }catch (Exception e){
            e.printStackTrace();            return AjaxResult.error("错的");        }
    }

mapper
 

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" ><mapper namespace="cn.itsource.mapper.EmployeeMapper" >  <resultMap id="BaseResultMap" type="cn.itsource.domain.Employee" >    <id column="id" property="id" jdbcType="BIGINT" />    <result column="username" property="username" jdbcType="VARCHAR" />    <result column="password" property="password" jdbcType="VARCHAR" />    <result column="age" property="age" jdbcType="INTEGER" />    <result column="post_id" property="postId" jdbcType="VARCHAR" />    <result column="iphone" property="iphone" jdbcType="INTEGER" />    <result column="pay" property="pay" jdbcType="INTEGER" />    <result column="shop_id" property="shopId" jdbcType="VARCHAR" />    <result column="Initiationtime" property="initiationtime" jdbcType="DATE" />    <result column="addtime" property="addtime" jdbcType="DATE" />  </resultMap>  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >    delete from employee
    where id = #{id,jdbcType=BIGINT}  </delete>  <insert id="insert" parameterType="cn.itsource.domain.Employee" useGeneratedKeys="true" keyProperty="id" >    insert into employee (username, password, age, 
      post_id, iphone, pay, 
      shop_id, Initiationtime, addtime
      )
    values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER}, 
      #{postId,jdbcType=VARCHAR}, #{iphone,jdbcType=INTEGER}, #{pay,jdbcType=INTEGER}, 
      #{shopId,jdbcType=VARCHAR}, #{initiationtime,jdbcType=DATE}, #{addtime,jdbcType=DATE}
      )  </insert>  <update id="updateByPrimaryKey" parameterType="cn.itsource.domain.Employee" >    update employee
    set username = #{username,jdbcType=VARCHAR},
      password = #{password,jdbcType=VARCHAR},
      age = #{age,jdbcType=INTEGER},
      post_id = #{postId,jdbcType=VARCHAR},
      iphone = #{iphone,jdbcType=INTEGER},
      pay = #{pay,jdbcType=INTEGER},
      shop_id = #{shopId,jdbcType=VARCHAR},
      Initiationtime = #{initiationtime,jdbcType=DATE},
      addtime = #{addtime,jdbcType=DATE}
    where id = #{id,jdbcType=BIGINT}  </update>  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >    select id, username, password, age, post_id, iphone, pay, shop_id, Initiationtime, addtime
    from employee
    where id = #{id,jdbcType=BIGINT}  </select>  <select id="selectForList" resultMap="BaseResultMap" >    select id, username, password, age, post_id, iphone, pay, shop_id, Initiationtime, addtime
    from employee  </select>  <select id="findEmployeeByUsername" resultMap="BaseResultMap" parameterType="cn.itsource.domain.Employee">    select id, username, password, age, post_id, iphone, pay, shop, Initiationtime, addtime
    from employee
    where username=#{username}  </select></mapper>

心得总结
    项目中的收获
    开始自主的思考代码 提高了自己对代码的理解
    项目中遇到的问题
    因为项目是使用了elementui 在因为之前不熟悉花费了大量时间  之中遇到使用el-date-picker日期组件在编辑中一直回显不了日期  百度了很久 发现是缺少了value-format="yyyy-MM-dd" 来改变 v-model上值的格式 加了以后回显就成功了

关于Saas模式的crm项目模块是什么问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注亿速云行业资讯频道了解更多相关知识。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI