update
This commit is contained in:
parent
ab7dc6fe77
commit
ebc1b8bdb0
23
server/codegen-mapper
Executable file
23
server/codegen-mapper
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get real path of softlink
|
||||
get_real_path() {
|
||||
local f="$1"
|
||||
while [ -h "$f" ]; do
|
||||
ls=`ls -ld "$f"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
f="$link"
|
||||
else
|
||||
f=`dirname "$f"`/"$link"
|
||||
fi
|
||||
done
|
||||
eval "$2"="'$f'"
|
||||
}
|
||||
|
||||
get_real_path "$0" prg_path
|
||||
echo "Script Path [$prg_path]"
|
||||
PROJECT_HOME=$(dirname $prg_path)
|
||||
echo "Project Home [$PROJECT_HOME]"
|
||||
cd "$PROJECT_HOME"
|
||||
mvn tomcat7:run -pl mapper -am -Ddev=true
|
23
server/codegen-model
Executable file
23
server/codegen-model
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get real path of softlink
|
||||
get_real_path() {
|
||||
local f="$1"
|
||||
while [ -h "$f" ]; do
|
||||
ls=`ls -ld "$f"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
f="$link"
|
||||
else
|
||||
f=`dirname "$f"`/"$link"
|
||||
fi
|
||||
done
|
||||
eval "$2"="'$f'"
|
||||
}
|
||||
|
||||
get_real_path "$0" prg_path
|
||||
echo "Script Path [$prg_path]"
|
||||
PROJECT_HOME=$(dirname $prg_path)
|
||||
echo "Project Home [$PROJECT_HOME]"
|
||||
cd "$PROJECT_HOME"
|
||||
mvn tomcat7:run -pl model -Ddev=true
|
@ -0,0 +1,47 @@
|
||||
package com.pudonghot.ambition.crm.service;
|
||||
|
||||
import com.pudonghot.ambition.crm.form.create.UserFormForCreate;
|
||||
import com.pudonghot.ambition.crm.form.update.UserFormForUpdate;
|
||||
import com.pudonghot.ambition.crm.model.User;
|
||||
import me.chyxion.tigon.model.ViewModel;
|
||||
import me.chyxion.tigon.service.BaseCrudByFormService;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @since 0.0.1
|
||||
* @author Shaun Chyxion <br>
|
||||
* chyxion@163.com <br>
|
||||
* May 4, 2016 1:18:42 PM
|
||||
*/
|
||||
public interface CustomerService
|
||||
extends BaseCrudByFormService<String, User, UserFormForCreate, UserFormForUpdate> {
|
||||
|
||||
/**
|
||||
* find user by login id
|
||||
* @param loginId
|
||||
* @return admin view model
|
||||
*/
|
||||
ViewModel<User> loginFind(@NotBlank String loginId);
|
||||
|
||||
/**
|
||||
* @param adminId
|
||||
* @param password
|
||||
* @return true if password is correct
|
||||
*/
|
||||
boolean validatePassword(
|
||||
@NotNull String adminId,
|
||||
@NotBlank String password);
|
||||
|
||||
/**
|
||||
* @param userId admin id
|
||||
* @param password password
|
||||
* @return admin view model
|
||||
*/
|
||||
@NotNull ViewModel<User> updatePassword(
|
||||
@NotBlank String userId,
|
||||
@NotBlank String password);
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.CustomerIssue;
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:22 PM
|
||||
*/
|
||||
public interface CustomerIssueMapper extends BaseMapper<String, CustomerIssue> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.Customer;
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:35:51 PM
|
||||
*/
|
||||
public interface CustomerMapper extends BaseMapper<String, Customer> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.CustomerPermission;
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:27 PM
|
||||
*/
|
||||
public interface CustomerPermissionMapper extends BaseMapper<String, CustomerPermission> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.CustomerProperty;
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:35 PM
|
||||
*/
|
||||
public interface CustomerPropertyMapper extends BaseMapper<String, CustomerProperty> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.CustomerYearToDateSale;
|
||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:40 PM
|
||||
*/
|
||||
public interface CustomerYearToDateSaleMapper extends BaseMapper<String, CustomerYearToDateSale> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:22 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.CustomerIssueMapper">
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:35:51 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.CustomerMapper">
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:27 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.CustomerPermissionMapper">
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:35 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.CustomerPropertyMapper">
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:40 PM
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE mapper PUBLIC
|
||||
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.pudonghot.ambition.crm.mapper.CustomerYearToDateSaleMapper">
|
||||
</mapper>
|
@ -0,0 +1,64 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.CustomerIssue;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:22 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class CustomerIssueMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private CustomerIssueMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
CustomerIssue m = new CustomerIssue();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setCustomerId("s");
|
||||
m.setIssue("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
CustomerIssue m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getCustomerId());
|
||||
Assert.assertEquals("s", m.getIssue());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setCustomerId("S");
|
||||
m.setIssue("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getCustomerId());
|
||||
Assert.assertEquals("S", m.getIssue());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.Customer;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:35:51 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class CustomerMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private CustomerMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
Customer m = new Customer();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setSalesperson("s");
|
||||
m.setName("s");
|
||||
m.setCountryCode("s");
|
||||
m.setState("s");
|
||||
m.setCity("s");
|
||||
m.setMs("s");
|
||||
m.setRegion("s");
|
||||
m.setLevel("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
Customer m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getSalesperson());
|
||||
Assert.assertEquals("s", m.getName());
|
||||
Assert.assertEquals("s", m.getCountryCode());
|
||||
Assert.assertEquals("s", m.getState());
|
||||
Assert.assertEquals("s", m.getCity());
|
||||
Assert.assertEquals("s", m.getMs());
|
||||
Assert.assertEquals("s", m.getRegion());
|
||||
Assert.assertEquals("s", m.getLevel());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setSalesperson("S");
|
||||
m.setName("S");
|
||||
m.setCountryCode("S");
|
||||
m.setState("S");
|
||||
m.setCity("S");
|
||||
m.setMs("S");
|
||||
m.setRegion("S");
|
||||
m.setLevel("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getSalesperson());
|
||||
Assert.assertEquals("S", m.getName());
|
||||
Assert.assertEquals("S", m.getCountryCode());
|
||||
Assert.assertEquals("S", m.getState());
|
||||
Assert.assertEquals("S", m.getCity());
|
||||
Assert.assertEquals("S", m.getMs());
|
||||
Assert.assertEquals("S", m.getRegion());
|
||||
Assert.assertEquals("S", m.getLevel());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.CustomerPermission;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:27 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class CustomerPermissionMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private CustomerPermissionMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
CustomerPermission m = new CustomerPermission();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setUserAccount("s");
|
||||
m.setCustomerId("s");
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
CustomerPermission m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getUserAccount());
|
||||
Assert.assertEquals("s", m.getCustomerId());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setUserAccount("S");
|
||||
m.setCustomerId("S");
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getUserAccount());
|
||||
Assert.assertEquals("S", m.getCustomerId());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.CustomerProperty;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:35 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class CustomerPropertyMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private CustomerPropertyMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
CustomerProperty m = new CustomerProperty();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setType("s");
|
||||
m.setName("s");
|
||||
m.setSort(1);
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
CustomerProperty m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getType());
|
||||
Assert.assertEquals("s", m.getName());
|
||||
Assert.assertEquals(1, m.getSort());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setType("S");
|
||||
m.setName("S");
|
||||
m.setSort(2);
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getType());
|
||||
Assert.assertEquals("S", m.getName());
|
||||
Assert.assertEquals(2, m.getSort());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.pudonghot.ambition.crm.mapper;
|
||||
|
||||
import com.pudonghot.ambition.crm.model.CustomerYearToDateSale;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:32:40 PM
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class CustomerYearToDateSaleMapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private CustomerYearToDateSaleMapper mapper;
|
||||
|
||||
@Test
|
||||
public void mapperTest() {
|
||||
// String id = String.valueOf(new Date().getTime());
|
||||
// init model
|
||||
CustomerYearToDateSale m = new CustomerYearToDateSale();
|
||||
String id = "id";
|
||||
m.setId(id);
|
||||
m.setDateCreated(new Date());
|
||||
m.setCustomerId("s");
|
||||
m.setYear("s");
|
||||
m.setYtdSale(1L);
|
||||
mapper.insert(m);
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
/*
|
||||
// Your Test Logics
|
||||
CustomerYearToDateSale m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertEquals("s", m.getCustomerId());
|
||||
Assert.assertEquals("s", m.getYear());
|
||||
Assert.assertEquals(1L, m.getYtdSale());
|
||||
// update
|
||||
m.setDateUpdated(new Date());
|
||||
m.setCustomerId("S");
|
||||
m.setYear("S");
|
||||
m.setYtdSale(2L);
|
||||
mapper.update(m);
|
||||
m1 = mapper.find(id);
|
||||
// asserts
|
||||
Assert.assertEquals(id, m1.getId());
|
||||
Assert.assertNotNull(m1.getDateUpdated());
|
||||
Assert.assertEquals("S", m.getCustomerId());
|
||||
Assert.assertEquals("S", m.getYear());
|
||||
Assert.assertEquals(2L, m.getYtdSale());
|
||||
// list
|
||||
Assert.assertTrue(mapper.list(null).size() > 0);
|
||||
// delete
|
||||
mapper.delete(id);
|
||||
m1 = mapper.find(id);
|
||||
Assert.assertNull(m1);
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.pudonghot.ambition.crm.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:25:39 PM
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_customer_issue")
|
||||
public class CustomerIssue extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String CUSTOMER_ID = "customer_id";
|
||||
public static final String ISSUE = "issue";
|
||||
|
||||
// Properties
|
||||
private String customerId;
|
||||
private String issue;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.pudonghot.ambition.crm.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:25:44 PM
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_customer_permission")
|
||||
public class CustomerPermission extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String USER_ACCOUNT = "user_account";
|
||||
public static final String CUSTOMER_ID = "customer_id";
|
||||
|
||||
// Properties
|
||||
private String userAccount;
|
||||
private String customerId;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.pudonghot.ambition.crm.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:25:48 PM
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_customer_property")
|
||||
public class CustomerProperty extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String TYPE = "type";
|
||||
public static final String NAME = "name";
|
||||
public static final String SORT = "sort";
|
||||
|
||||
// Properties
|
||||
private String type;
|
||||
private String name;
|
||||
private int sort;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.pudonghot.ambition.crm.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.chyxion.tigon.mybatis.Table;
|
||||
import me.chyxion.tigon.model.M3;
|
||||
|
||||
/**
|
||||
* @version 0.0.1
|
||||
* @author Auto Generated <br>
|
||||
* Tech Support <a href="mailto:chyxion@163.com">Shaun Chyxion</a><br>
|
||||
* Jun 19, 2017 10:25:51 PM
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Table("crm_customer_year_to_date_sale")
|
||||
public class CustomerYearToDateSale extends M3<String, String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Column Names
|
||||
public static final String CUSTOMER_ID = "customer_id";
|
||||
public static final String YEAR = "year";
|
||||
public static final String YTD_SALE = "ytd_sale";
|
||||
|
||||
// Properties
|
||||
private String customerId;
|
||||
private String year;
|
||||
private long ytdSale;
|
||||
|
||||
}
|
38
server/model/src/main/resources/log4j2.xml
Normal file
38
server/model/src/main/resources/log4j2.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN">
|
||||
<Properties>
|
||||
<Property name="log.level">DEBUG</Property>
|
||||
<Property name="log.dir">.logs</Property>
|
||||
<Property name="pattern">%-d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%t][%c{1}] %m%n</Property>
|
||||
</Properties>
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="${pattern}" />
|
||||
</Console>
|
||||
<RollingFile name="File"
|
||||
fileName="${log.dir}/${project.artifactId}.log"
|
||||
filePattern="${log.dir}/$${date:yyyy-MM}/${project.artifactId}-%d{yyyy-MM-dd}-%i.log">
|
||||
<PatternLayout pattern="${pattern}" />
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy />
|
||||
<SizeBasedTriggeringPolicy size="16 MB" />
|
||||
</Policies>
|
||||
<DefaultRolloverStrategy max="32" />
|
||||
</RollingFile>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="org.springframework" level="INFO" additivity="false">
|
||||
<AppenderRef ref="File" />
|
||||
</Logger>
|
||||
<Logger name="org.apache" level="WARN" additivity="false">
|
||||
<AppenderRef ref="File" />
|
||||
</Logger>
|
||||
<Logger name="org.hibernate.validator" level="WARN" additivity="false">
|
||||
<AppenderRef ref="File" />
|
||||
</Logger>
|
||||
<Root level="${log.level}" additivity="false">
|
||||
<AppenderRef ref="File" level="${log.level}" />
|
||||
<AppenderRef ref="Console" level="${log.level}" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
8
server/model/src/main/resources/spring/config.properties
Normal file
8
server/model/src/main/resources/spring/config.properties
Normal file
@ -0,0 +1,8 @@
|
||||
# Config Dev
|
||||
|
||||
# Database
|
||||
datasource.host=127.0.0.1
|
||||
datasource.port=43306
|
||||
datasource.database-name=ambition_crm
|
||||
datasource.username=root
|
||||
datasource.password=696@2^~)oZ@^#*Q
|
13
web/app/components/form-input-enabled.js
Normal file
13
web/app/components/form-input-enabled.js
Normal file
@ -0,0 +1,13 @@
|
||||
import Ember from 'ember';
|
||||
import BaseFormInput from './base-form-input';
|
||||
|
||||
export default BaseFormInput.extend({
|
||||
label: '状态',
|
||||
name: 'enabled',
|
||||
classNames: ['form-group'],
|
||||
didReceiveAttrs() {
|
||||
let me = this;
|
||||
me._super(...arguments);
|
||||
Ember.isNone(me.getVal()) && me.setVal(false);
|
||||
}
|
||||
});
|
19
web/app/templates/components/form-input-enabled.hbs
Normal file
19
web/app/templates/components/form-input-enabled.hbs
Normal file
@ -0,0 +1,19 @@
|
||||
<label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">{{label}}</label>
|
||||
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<div>
|
||||
<label class="line-height-1 green">
|
||||
<input name="gender" value="true" type="radio" class="ace" />
|
||||
{{radio-button value=true groupValue=(mut (get model name)) class="ace"}}
|
||||
<span class="lbl"> 启用</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="line-height-1 red">
|
||||
<!-- <input name="gender" value="false" type="radio" class="ace" /> -->
|
||||
{{radio-button value=false groupValue=(mut (get model name)) class="ace"}}
|
||||
<span class="lbl"> 禁用</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
24
web/tests/integration/components/form-input-enabled-test.js
Normal file
24
web/tests/integration/components/form-input-enabled-test.js
Normal file
@ -0,0 +1,24 @@
|
||||
import { moduleForComponent, test } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
|
||||
moduleForComponent('form-input-enabled', 'Integration | Component | form input enabled', {
|
||||
integration: true
|
||||
});
|
||||
|
||||
test('it renders', function(assert) {
|
||||
// Set any properties with this.set('myProperty', 'value');
|
||||
// Handle any actions with this.on('myAction', function(val) { ... });
|
||||
|
||||
this.render(hbs`{{form-input-enabled}}`);
|
||||
|
||||
assert.equal(this.$().text().trim(), '');
|
||||
|
||||
// Template block usage:
|
||||
this.render(hbs`
|
||||
{{#form-input-enabled}}
|
||||
template block text
|
||||
{{/form-input-enabled}}
|
||||
`);
|
||||
|
||||
assert.equal(this.$().text().trim(), 'template block text');
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user