insert into user(userName,password,comment)
values(#{userName},#{password},#{comment})
SELECT LAST_INSERT_ID()
INSERT INTO t_product(productName,productDesrcible,merchantId)values(#{productName},#{productDesrcible},#{merchantId});
//property:关联集合
//ofType:"集合中元素类型"
//select:通过这个关联sql查询对应数据集合
//column:关联对象表中的外键,对应当前对象主键的id
//property:关联对象所在类中的属性
//javaType:关联对象类型
//column:结果集中列名
//property:关联对象属性
text/plain;charset=UTF-8
helperDialect=mysql
···
crm-mapper
crm-common
crm-service
crm-web
basic-util
basic-core
basic-generator
crm-shiro
···
···
cn.itsource.crm
crm-shiro
1.0-SNAPSHOT
cn.itsource.crm
crm-service
1.0-SNAPSHOT
···
1.根据前台传入的分页参数做一个封装类
/**
* 分页数据封装类
* @author solargen
* @param
*/
public class PageList {
private Long total = 0L;
private List rows = new ArrayList<>();
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
public List getRows() {
return rows;
}
public void setRows(List rows) {
this.rows = rows;
}
public PageList() {
}
public PageList(Long total, List rows) {
this.total = total;
this.rows = rows;
}
}
public class BaseQuery {
//当前页
private int page = 1;
//每页显示条数s
private int rows = 5;
//查询传递的字段
private String keyword;
····
com.github.pagehelper
pagehelper
5.0.1
/**
* 为了使用分页插件,必须导入依赖,只是为了编译不报错
* @param query
* @return
*/
@Override
public PageList queryPage(BaseQuery query) {
Page objects = PageHelper.startPage(query.getPage(), query.getRows());
//拿到分页后的总数据
getMapper().selectByQuery(query);
return new PageList<>(objects.getTotal(), objects.getResult());
}
Velocity是一个基于java的模板引擎(template engine)。它允许任何人仅仅使用简单的模板语言(template language)来引用由java代码定义的对象。
package cn.itsource.basic;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.junit.Test;
import java.io.*;
import java.util.Properties;
public class CodeGenerator {
//代码生成路径
private static String mapperPath;
private static String servicePath;
private static String serviceImplPath;
private static String controllerPath;
private static String queryPath;
private static String jspPath;
private static String jsPath;
static{
//加载路径
Properties properties = new Properties();
try {
properties.load(new InputStreamReader(CodeGenerator.class.getClassLoader().getResourceAsStream("generator.properties"),"utf-8"));
mapperPath = properties.getProperty("gen.mapper.path");
servicePath = properties.getProperty("gen.service.path");
serviceImplPath = servicePath+"\\impl";
controllerPath = properties.getProperty("gen.controller.path");
queryPath = properties.getProperty("gen.query.path");
jspPath = properties.getProperty("gen.jsp.path")+"\\domain";
jsPath = properties.getProperty("gen.js.path");
} catch (IOException e) {
e.printStackTrace();
}
}
//代码生成的先后顺序
private static final String[] paths = {controllerPath,servicePath,
serviceImplPath,mapperPath,queryPath,jspPath,jsPath};
//模板先后顺序
private static final String[] templates = {"DomainController.java.vm",
"IDomainService.java.vm","DomainServiceImpl.java.vm",
"DomainMapper.java.vm","DomainQuery.java.vm","index.jsp.vm",
"domain.js.vm"};
//要生成的那些实体类的相关代码
private static final String[] domains = {"Menu"};
//是否覆盖
private static final boolean FLAG = true;
@Test
public void test() throws Exception{
//模板上下文
VelocityContext context = new VelocityContext();
//遍历所有的domain
for (String domain : domains) {
//拿到domain类名的大小写
String DomainName = domain;
String domainName = domain.substring(0,1).toLowerCase()+
domain.substring(1);
//上下文中设置替换内容
context.put("Domain",DomainName);
context.put("domain",domainName);
//遍历路径,拿到模板生成目标文件
for (int i=0;i
package cn.itsource.crm.service.impl;
import cn.itsource.basic.mapper.BaseMapper;
import cn.itsource.basic.service.impl.BaseServiceImpl;
import cn.itsource.crm.domain.${Domain};
import cn.itsource.crm.mapper.${Domain}Mapper;
import cn.itsource.crm.service.I${Domain}Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ${Domain}ServiceImpl extends BaseServiceImpl<${Domain}> implements I${Domain}Service {
@Autowired
private ${Domain}Mapper ${domain}Mapper;
@Override
public BaseMapper<${Domain}> getMapper() {
return this.${domain}Mapper;
}
}
//在url中填写appid与你项目中方法中的oauth的地址
授权
include('class_weixin_adv.php');
$weixin=new class_weixin_adv("appid", "secret");
$row=$weixin->get_user_info($res['openid']);
···
contextConfigLocation
classpath*:application-service.xml
classpath*:application-shiro.xml
···
shiroFilter
org.springframework.web.filter.DelegatingFilterProxy
targetFilterLifecycle
true
shiroFilter
/*
···
Hello, World
n-n-n-n
远程服务器
你们这个项目的业务是什么(你简单给我介绍一下你的项目):
你为什么要做这个项目?你们项目的主要业务是什么?有哪些模块?你负责的哪一个模块?
你在这个项目中有哪些(突出)收获(你遇到过什么影响最深刻的是什么?怎么解决的?)
你们这个项目用的什么版本控制工具?