项目源码
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.Department;
|
||||
|
||||
public interface DepartmentDao extends BaseDao<Department, Long>{
|
||||
|
||||
public Page<Department> getPage(int pageNumber, int pageSize,Long enterpriseId,Long pId,String name,String state);
|
||||
|
||||
//取得直接下级
|
||||
public List<Department> listTop(Long enterpriseId,Long pId);
|
||||
public List<Department> listdsub(Long enterpriseId,Long pId);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
|
||||
public interface EAccountDao extends BaseDao<EAccount, Long> {
|
||||
|
||||
public void setState(List<Long> ids, String state);
|
||||
|
||||
public Page<EAccount> getPage(int pageNumber, int pageSize,Long enterpriseId,Long departmentId,String name,String telephone, Long roleId,String state);
|
||||
|
||||
public Page<EAccount> getPage4m(int pageNumber, int pageSize,Long enterpriseId,String name,String telephone, Long roleId,String state);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.EContract;
|
||||
|
||||
public interface EContractDao extends BaseDao<EContract, Long> {
|
||||
|
||||
public void setState(List<Long> ids, String state);
|
||||
|
||||
public Page<EContract> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
|
||||
public interface ECustomerDao extends BaseDao<ECustomer, Long> {
|
||||
|
||||
public List<ECustomer> getAll(String state);
|
||||
|
||||
public void setState(List<Long> ids, String state);
|
||||
|
||||
public Page<ECustomer> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state);
|
||||
|
||||
public Page<ECustomer> getPage4NoVisit(int pageNumber, int pageSize, String startDate, String endDate);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.ECustomerVisit;
|
||||
|
||||
public interface ECustomerVisitDao extends BaseDao<ECustomerVisit, Long> {
|
||||
|
||||
public void setState(List<Long> ids, String state);
|
||||
|
||||
public Page<ECustomerVisit> getPage(int pageNumber, int pageSize, Long customerId, String startDate, String endDate,
|
||||
String state);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.kelp.crm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.BaseDao;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
|
||||
public interface EnterpriseDao extends BaseDao<Enterprise, Long>{
|
||||
|
||||
public Page<Enterprise> getPage(int pageNumber, int pageSize,Long pId,String name,String state);
|
||||
|
||||
public List<Enterprise> listAll(String state);
|
||||
|
||||
//取得直接下级
|
||||
public List<Enterprise> listTop(Long pId);
|
||||
public List<Enterprise> listdsub(Long pId);
|
||||
public List<Enterprise> listdsub(Long pId,String type);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.crm.dao.DepartmentDao;
|
||||
import com.kelp.crm.entity.Department;
|
||||
|
||||
@Repository
|
||||
public class DepartmentDaoImpl extends BaseDaoImpl<Department, Long> implements DepartmentDao{
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean delete(List<Long> ids) {
|
||||
for(Long id : ids){
|
||||
delete(id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Long id) {
|
||||
String sqld = "update Department set state = '10' where id = :id ";
|
||||
String sqlq = "select o from Department o where pId = :pId order by orderNumber";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Department> departmentList = em.createQuery(sqlq).setParameter("pId", id).getResultList();
|
||||
if(0 < departmentList.size()){
|
||||
for(Department department : departmentList){
|
||||
delete(department.getId());
|
||||
}
|
||||
}
|
||||
em.createQuery(sqld).setParameter("id", id).executeUpdate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Department> getPage(int pageNumber, int pageSize, Long enterpriseId, Long pId, String name, String state) {
|
||||
if(name == null || name.length() == 0 || name.length() > 50){
|
||||
name = "";
|
||||
}
|
||||
|
||||
if(state == null || state.length() != 2){
|
||||
state = "00";
|
||||
}
|
||||
|
||||
String sql = " from Department o where enterpriseId=?1 and name like ?2 and pId = ?3 and state = ?4 order by orderNumber";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
params.add(enterpriseId);
|
||||
params.add("%" + name + "%");
|
||||
params.add(pId);
|
||||
params.add(state);
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Department> listTop(Long enterpriseId, Long pId) {
|
||||
String sql = "select new com.kelp.crm.entity.Department(o.id,o.name,o.pId,o.idPath) from Department o where id = :pId and enterpriseId = :enterpriseId and state = '00' order by orderNumber";
|
||||
return em.createQuery(sql).setParameter("enterpriseId", enterpriseId).setParameter("pId", pId).getResultList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Department> listdsub(Long enterpriseId,Long pId) {
|
||||
|
||||
String sql = "select new com.kelp.crm.entity.Department(o.id,o.name,o.pId,o.idPath) from Department o where id != pId and enterpriseId = :enterpriseId and pId = :pId and state = '00' order by orderNumber";
|
||||
return em.createQuery(sql).setParameter("enterpriseId", enterpriseId).setParameter("pId", pId).getResultList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.crm.dao.EAccountDao;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
|
||||
@Repository
|
||||
public class EAccountDaoImpl extends BaseDaoImpl<EAccount, Long> implements EAccountDao {
|
||||
|
||||
@Override
|
||||
public Page<EAccount> getPage(int pageNumber, int pageSize, Long enterpriseId, Long departmentId, String name, String telephone, Long roleId,
|
||||
String state) {
|
||||
String sql = " from EAccount o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
sql += " and enterpriseId = ?" + index++;
|
||||
params.add(enterpriseId);
|
||||
|
||||
sql += " and departmentId = ?" + index++;
|
||||
params.add(departmentId);
|
||||
|
||||
if(!StringUtils.isEmpty(name) && name.length() < 50){
|
||||
sql += " and name like ?" + index++;
|
||||
params.add("%" + name + "%");
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(telephone) && telephone.length() <= 32){
|
||||
sql += " and telephone = ?" + index++;
|
||||
params.add(telephone);
|
||||
}
|
||||
|
||||
if(roleId != null ){
|
||||
sql += " and roleId = ?" + index++;
|
||||
params.add(roleId);
|
||||
}
|
||||
|
||||
if(state != null && state.length() == 2){
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void setState(List<Long> ids ,String state) {
|
||||
String sql = "update EAccount set state = :state where id in (:ids)";
|
||||
em.createQuery(sql).setParameter("state", state).setParameter("ids", ids).executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EAccount> getPage4m(int pageNumber, int pageSize, Long enterpriseId, String name, String telephone,
|
||||
Long roleId, String state) {
|
||||
String sql = " from EAccount o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
sql += " and enterpriseId = ?" + index++;
|
||||
params.add(enterpriseId);
|
||||
|
||||
if(!StringUtils.isEmpty(name) && name.length() < 50){
|
||||
sql += " and name like ?" + index++;
|
||||
params.add("%" + name + "%");
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(telephone) && telephone.length() <= 32){
|
||||
sql += " and telephone = ?" + index++;
|
||||
params.add(telephone);
|
||||
}
|
||||
|
||||
if(roleId != null ){
|
||||
sql += " and roleId = ?" + index++;
|
||||
params.add(roleId);
|
||||
}
|
||||
|
||||
if(state != null && state.length() == 2){
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
import com.kelp.common.utils.DateUtils;
|
||||
import com.kelp.crm.dao.EContractDao;
|
||||
import com.kelp.crm.entity.EContract;
|
||||
|
||||
@Repository
|
||||
public class EContractDaoImpl extends BaseDaoImpl<EContract, Long> implements EContractDao {
|
||||
|
||||
@Override
|
||||
public Page<EContract> getPage(int pageNumber, int pageSize, String startDate, String endDate,
|
||||
String name, String state) {
|
||||
String sql = " from EContract o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
if (startDate != null && DateUtils.string2date(startDate + " 00:00:00") != null) {
|
||||
sql = sql + " and signTime >= ?" + index++;
|
||||
params.add(DateUtils.string2date(startDate + " 00:00:00").getTime());
|
||||
}
|
||||
|
||||
if (endDate != null && DateUtils.string2date(endDate + " 23:59:59") != null) {
|
||||
sql = sql + " and signTime <= ?" + index++;
|
||||
params.add(DateUtils.string2date(endDate + " 23:59:59").getTime());
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(name) && name.length() <= 50) {
|
||||
sql += " and customerName = ?" + index++;
|
||||
params.add(AESUtil.encrypt(name, KeyConstant.REALNAME));
|
||||
}
|
||||
|
||||
if (state != null && state.length() == 2) {
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
sql += " order by createTime desc";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void setState(List<Long> ids, String state) {
|
||||
String sql = "update EContract set state = :state where id in (:ids)";
|
||||
em.createQuery(sql).setParameter("state", state).setParameter("ids", ids).executeUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.common.utils.DateUtils;
|
||||
import com.kelp.crm.dao.ECustomerDao;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
|
||||
@Repository
|
||||
public class ECustomerDaoImpl extends BaseDaoImpl<ECustomer, Long> implements ECustomerDao {
|
||||
|
||||
@Override
|
||||
public Page<ECustomer> getPage(int pageNumber, int pageSize, String startDate, String endDate, String name,
|
||||
String state) {
|
||||
String sql = " from ECustomer o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
if (startDate != null && DateUtils.string2date(startDate + " 00:00:00") != null) {
|
||||
sql = sql + " and createTime >= ?" + index++;
|
||||
params.add(DateUtils.string2date(startDate + " 00:00:00").getTime());
|
||||
}
|
||||
|
||||
if (endDate != null && DateUtils.string2date(endDate + " 23:59:59") != null) {
|
||||
sql = sql + " and createTime <= ?" + index++;
|
||||
params.add(DateUtils.string2date(endDate + " 23:59:59").getTime());
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(name) && name.length() <= 50) {
|
||||
sql += " and name = ?" + index++;
|
||||
params.add(name);
|
||||
}
|
||||
|
||||
if (state != null && state.length() == 2) {
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
sql += " order by createTime desc";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ECustomer> getPage4NoVisit(int pageNumber, int pageSize, String startDate, String endDate) {
|
||||
String sql = " from ECustomer o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
if (startDate == null || DateUtils.string2date(startDate + " 00:00:00") == null) {
|
||||
startDate = DateUtils.date2Day(new Date());
|
||||
}
|
||||
|
||||
if (endDate == null || DateUtils.string2date(endDate + " 23:59:59") == null) {
|
||||
endDate = DateUtils.date2Day(new Date());
|
||||
}
|
||||
|
||||
sql += " and id not in (select distinct customerId from ECustomerVisit where createTime >= ?" + (index++)
|
||||
+ " and createTime <= ?" + (index++) + " and state != '10')";
|
||||
|
||||
params.add(DateUtils.string2date(startDate + " 00:00:00").getTime());
|
||||
params.add(DateUtils.string2date(endDate + " 23:59:59").getTime());
|
||||
|
||||
sql += " order by createTime desc";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void setState(List<Long> ids, String state) {
|
||||
String sql = "update ECustomer set state = :state where id in (:ids)";
|
||||
em.createQuery(sql).setParameter("state", state).setParameter("ids", ids).executeUpdate();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<ECustomer> getAll(String state) {
|
||||
if (state == null || state.length() != 2) {
|
||||
return getAll();
|
||||
}
|
||||
String sql = "select o from ECustomer o where state = :state ";
|
||||
return em.createQuery(sql).setParameter("state", state).getResultList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.common.utils.DateUtils;
|
||||
import com.kelp.crm.dao.ECustomerVisitDao;
|
||||
import com.kelp.crm.entity.ECustomerVisit;
|
||||
|
||||
@Repository
|
||||
public class ECustomerVisitDaoImpl extends BaseDaoImpl<ECustomerVisit, Long> implements ECustomerVisitDao {
|
||||
|
||||
@Override
|
||||
public Page<ECustomerVisit> getPage(int pageNumber, int pageSize, Long customerId, String startDate,
|
||||
String endDate, String state) {
|
||||
|
||||
String sql = " from ECustomerVisit o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
if (customerId != null) {
|
||||
sql += " and customerId = ?" + index++;
|
||||
params.add(customerId);
|
||||
}
|
||||
|
||||
if (startDate != null && DateUtils.string2date(startDate + " 00:00:00") != null) {
|
||||
sql = sql + " and visitTime >= ?" + index++;
|
||||
params.add(DateUtils.string2date(startDate + " 00:00:00").getTime());
|
||||
}
|
||||
|
||||
if (endDate != null && DateUtils.string2date(endDate + " 23:59:59") != null) {
|
||||
sql = sql + " and visitTime <= ?" + index++;
|
||||
params.add(DateUtils.string2date(endDate + " 23:59:59").getTime());
|
||||
}
|
||||
|
||||
if (state != null && state.length() == 2) {
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
sql += " order by visitTime desc ";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void setState(List<Long> ids, String state) {
|
||||
String sql = "update ECustomerVisit set state = :state where id in (:ids)";
|
||||
em.createQuery(sql).setParameter("state", state).setParameter("ids", ids).executeUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.kelp.crm.dao.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.base.dao.impl.BaseDaoImpl;
|
||||
import com.kelp.crm.dao.EnterpriseDao;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
|
||||
@Repository
|
||||
public class EnterpriseDaoImpl extends BaseDaoImpl<Enterprise, Long> implements EnterpriseDao{
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean delete(List<Long> ids) {
|
||||
for(Long id : ids){
|
||||
delete(id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Long id) {
|
||||
String sqld = "update Enterprise set state = '10' where id = :id ";
|
||||
String sqlq = "select o from Enterprise o where pId = :pId order by name";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Enterprise> enterpriseList = em.createQuery(sqlq).setParameter("pId", id).getResultList();
|
||||
if(0 < enterpriseList.size()){
|
||||
for(Enterprise enterprise : enterpriseList){
|
||||
delete(enterprise.getId());
|
||||
}
|
||||
}
|
||||
em.createQuery(sqld).setParameter("id", id).executeUpdate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Enterprise> getPage(int pageNumber, int pageSize, Long pId, String name, String state) {
|
||||
|
||||
String sql = " from Enterprise o where 1 = 1 ";
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
int index = 1;
|
||||
|
||||
sql += " and pId = ?" + index++;
|
||||
params.add(pId);
|
||||
|
||||
if(!StringUtils.isEmpty(name) && name.length() < 50){
|
||||
sql += " and name like ?" + index++;
|
||||
params.add("%" + name + "%");
|
||||
}
|
||||
|
||||
if(state != null && state.length() == 2){
|
||||
sql += " and state = ?" + index;
|
||||
params.add(state);
|
||||
}
|
||||
|
||||
sql += " order by name";
|
||||
|
||||
return getBeanPage(pageNumber, pageSize, sql, params);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Enterprise> listTop(Long pId) {
|
||||
String sql = "select new com.kelp.crm.entity.Enterprise(o.id,o.name,o.pId,o.type) from Enterprise o where id = :pId and state = '00' order by name";
|
||||
return em.createQuery(sql).setParameter("pId", pId).getResultList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Enterprise> listdsub(Long pId) {
|
||||
|
||||
String sql = "select new com.kelp.crm.entity.Enterprise(o.id,o.name,o.pId,o.type) from Enterprise o where id != pId and pId = :pId and state = '00' order by name";
|
||||
return em.createQuery(sql).setParameter("pId", pId).getResultList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Enterprise> listdsub(Long pId,String type) {
|
||||
|
||||
String sql = "select new com.kelp.crm.entity.Enterprise(o.id,o.name,o.pId,o.type) from Enterprise o where id != pId and pId = :pId and type = :type and state = '00' order by name";
|
||||
return em.createQuery(sql).setParameter("pId", pId).setParameter("type", type).getResultList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Enterprise> listAll(String state) {
|
||||
if(state == null || state.length() != 2) {
|
||||
return getAll();
|
||||
}
|
||||
String sql = "select o from Enterprise o where state = :state ";
|
||||
return em.createQuery(sql).setParameter("state", state).getResultList();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user