精华内容
下载资源
问答
  • crm代码 华东理工大学计算机电子商务实验 数据库进我的下载页面找
  • CRM代码片段

    2017-01-24 11:22:35
    1.代码结构 JAR包: 2.pojo sysRole.java package com.pojo; import java.util.HashSet; import java.util.Set; /** * SysRole entity. @author MyEclipse Persistence Tools */ ...

    1.代码结构

    JAR包:





    2.pojo   

    sysRole.java

    package com.pojo;
    
    import java.util.HashSet;
    import java.util.Set;
    
    
    /**
     * SysRole entity. @author MyEclipse Persistence Tools
     */
    
    public class SysRole  implements java.io.Serializable {
    
    
        // Fields    
    
         private Integer roleId;
         private String roleName;
         private String roleDesc;
         private Byte roleFlag;
         private Set sysRights = new HashSet(0);
         private Set sysUsers = new HashSet(0);
    
    
        // Constructors
    
        /** default constructor */
        public SysRole() {
        }
    
    	/** minimal constructor */
        public SysRole(Integer roleId, String roleName, Byte roleFlag) {
            this.roleId = roleId;
            this.roleName = roleName;
            this.roleFlag = roleFlag;
        }
        
        /** full constructor */
        public SysRole(Integer roleId, String roleName, String roleDesc, Byte roleFlag, Set sysRights, Set sysUsers) {
            this.roleId = roleId;
            this.roleName = roleName;
            this.roleDesc = roleDesc;
            this.roleFlag = roleFlag;
            this.sysRights = sysRights;
            this.sysUsers = sysUsers;
        }
    
       
        // Property accessors
    
        public Integer getRoleId() {
            return this.roleId;
        }
        
        public void setRoleId(Integer roleId) {
            this.roleId = roleId;
        }
    
        public String getRoleName() {
            return this.roleName;
        }
        
        public void setRoleName(String roleName) {
            this.roleName = roleName;
        }
    
        public String getRoleDesc() {
            return this.roleDesc;
        }
        
        public void setRoleDesc(String roleDesc) {
            this.roleDesc = roleDesc;
        }
    
        public Byte getRoleFlag() {
            return this.roleFlag;
        }
        
        public void setRoleFlag(Byte roleFlag) {
            this.roleFlag = roleFlag;
        }
    
        public Set getSysRights() {
            return this.sysRights;
        }
        
        public void setSysRights(Set sysRights) {
            this.sysRights = sysRights;
        }
    
        public Set getSysUsers() {
            return this.sysUsers;
        }
        
        public void setSysUsers(Set sysUsers) {
            this.sysUsers = sysUsers;
        }
    
    
    }


    3.Dao层

    package com.dao;
    
    import java.io.Serializable;
    import java.util.List;
    
    import org.hibernate.criterion.DetachedCriteria;
    
    import com.bean.Page;
    /**
     * 
     * @author laukei
     *
     * @param <T>
     */
    public interface ICommonDao<T> {
    	/**
    	 * 分页查询
    	 * @param hql
    	 * @param page
    	 * @return
    	 */
    	public List<T> findByPage(DetachedCriteria dc,Page<T> page);
    	/**
    	 * 计算总记录数
    	 * @param hql
    	 * @return
    	 */
    	public int getCount(DetachedCriteria dc);
    	/**
    	 * 查询所有
    	 * @return
    	 */
    	public List<T> list(DetachedCriteria dc);
    	/**
    	 * 获取某个对象
    	 */
    	public T get(DetachedCriteria dc);
    	/**
    	 * 获取所有对象
    	 * @param hql
    	 * @return
    	 */
    	public List<T> list(String hql);
    	/**
    	 * 通过ID查询对象
    	 * @param clazz
    	 * @param id
    	 * @return
    	 */
    	public T getById(Class<T> clazz,Serializable id);
    	/**
    	 * 修改对象
    	 * @param o
    	 */
    	public void update(T o);
    	/**
    	 * 增加对象
    	 * @param o
    	 * @return
    	 */
    	public Serializable save(T o);	
    }
    

    4.Dao层实现类

    package com.dao.impl;
    
    import java.io.Serializable;
    import java.sql.SQLException;
    import java.util.List;
    
    import org.hibernate.Criteria;
    import org.hibernate.HibernateException;
    import org.hibernate.Session;
    import org.hibernate.criterion.DetachedCriteria;
    import org.springframework.orm.hibernate3.HibernateCallback;
    import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
    
    import com.bean.Page;
    import com.dao.ICommonDao;
    /**
     * 
     * @author laukei
     *
     * @param <T>
     */
    public class CommonDaoImpl<T> extends HibernateDaoSupport implements ICommonDao<T> {
    	/*
    	 * (non-Javadoc)
    	 * @see com.dao.ICommonDao#findByPage(org.hibernate.criterion.DetachedCriteria, com.bean.Page)
    	 */
    	public List<T> findByPage(final DetachedCriteria dc, final Page<T> page) {
    		@SuppressWarnings("unchecked")
    		List<T> all=this.getHibernateTemplate().executeFind(new HibernateCallback<List<T>>() {
    			public List<T> doInHibernate(Session session)
    					throws HibernateException, SQLException {
    				//内部类中的方法要访问外部类的局部变量需要在外部类的局部变量之前加入final,方可访问
    				Criteria criteria=dc.getExecutableCriteria(session);
    				criteria.setFirstResult((page.getCurrentPage()-1)*page.getLineSize());
    				criteria.setMaxResults(page.getLineSize());
    				return criteria.list() ;
    			}
    		});
    		return all;
    	}
    
    	public int getCount(final DetachedCriteria dc) {
    		int count=this.getHibernateTemplate().execute(new HibernateCallback<Integer>() {
    
    			public Integer doInHibernate(Session session)
    					throws HibernateException, SQLException {
    				Criteria criteria=dc.getExecutableCriteria(session);
    				Integer temp=(Integer) criteria.uniqueResult();
    				return temp;
    			}
    		});
    		return count;
    	}
    
    	public List<T> list(String hql) {
    		@SuppressWarnings("unchecked")
    		List<T> all=this.getHibernateTemplate().find(hql);
    		return all;
    	}
    
    	public T get(final DetachedCriteria dc) {
    		
    		T o= this.getHibernateTemplate().execute(new HibernateCallback<T>() {
    
    			public T doInHibernate(Session session) throws HibernateException,
    					SQLException {
    				Criteria criteria=dc.getExecutableCriteria(session);
    				@SuppressWarnings("unchecked")
    				T temp=(T) criteria.uniqueResult();
    				return temp;
    			}
    		});
    		return o;
    	}
    
    	public T getById(Class<T> clazz, Serializable id) {
    		
    		return this.getHibernateTemplate().get(clazz, id);
    	}
    
    	public List<T> list(final DetachedCriteria dc) {
    		@SuppressWarnings("unchecked")
    		List<T> all= this.getHibernateTemplate().executeFind(new HibernateCallback<List<T>>() {
    
    			public List<T> doInHibernate(Session session) throws HibernateException,
    					SQLException {
    				Criteria criteria=dc.getExecutableCriteria(session);
    				List<T> temp=criteria.list();
    				return temp;
    			}
    		});
    		return all;
    	}
    
    	public void update(T o) {
    		this.getHibernateTemplate().update(o);
    	}
    
    	public Serializable save(T o) {
    		
    		return this.getHibernateTemplate().save(o);
    		
    	}
    
    }
    
    
    


    5.service层

    接口:
    package com.service;
    
    import com.bean.Page;
    import com.pojo.SysRole;
    
    public interface IRoleService {
    	/*
    	 * 通过ID查找角色
    	 */
    	public SysRole findRoleById(int roleId);
    	/*
    	 * 分页角色列表
    	 */
    	public Page<SysRole> findRoles(SysRole sysRole,Page<SysRole> page);
    	/*
    	 * 授权角色
    	 */
    	public boolean assignRight(int rid,String mids); 
    	
    	/*
    	 * 增加角色
    	 */
    	public boolean addRole(SysRole sysRole);
    	
    	/*
    	 * 删除角色
    	 */
    	public boolean delRole(Integer roleId);
    	/*
    	 * 编辑角色
    	 */
    	public boolean editRole(SysRole sysRole);
    }
    

    实现类:
    package com.service.impl;
    
    import java.io.Serializable;
    import java.util.List;
    import java.util.Set;
    
    import org.hibernate.criterion.DetachedCriteria;
    import org.hibernate.criterion.Property;
    import org.hibernate.criterion.Restrictions;
    
    import com.bean.Page;
    import com.dao.ICommonDao;
    import com.pojo.SysRight;
    import com.pojo.SysRole;
    import com.service.IRoleService;
    
    public class RoleServiceImpl implements IRoleService {
    	private ICommonDao<SysRole> sysRoleDao;
    	private ICommonDao<SysRight> sysRightDao;
    	
    	
    	public void setSysRightDao(ICommonDao<SysRight> sysRightDao) {
    		this.sysRightDao = sysRightDao;
    	}
    	public void setSysRoleDao(ICommonDao<SysRole> sysRoleDao) {
    		this.sysRoleDao = sysRoleDao;
    	}
    	/**
    	 * 通过ID查询角色信息
    	 */
    	public SysRole findRoleById(int roleId) {
    		
    		return this.sysRoleDao.getById(SysRole.class,roleId);
    	}
    	/*
    	 * 分页查询
    	 */
    	public Page<SysRole> findRoles(SysRole sysRole, Page<SysRole> page) {
    		if (page==null) {
    			page=new Page<SysRole>();
    		}
    		DetachedCriteria listdc=DetachedCriteria.forClass(SysRole.class).add(Restrictions.eq("roleFlag", (byte)1));
    		DetachedCriteria countdc=DetachedCriteria.forClass(SysRole.class);
    		countdc.setProjection(Property.forName("roleId").count()).add(Restrictions.eq("roleFlag", (byte)1));
    		if (sysRole!=null) {
    			if (sysRole.getRoleName()!= null && !"".equals(sysRole.getRoleName())) {
    				listdc.add(Restrictions.like("roleName","%"+sysRole.getRoleName()+"%"));
    				countdc.add(Restrictions.like("roleName","%"+sysRole.getRoleName()+"%"));
    			}
    		}
    		List<SysRole> list = this.sysRoleDao.findByPage(listdc, page);
    		int count = this.sysRoleDao.getCount(countdc);
    		page.setList(list);
    		page.setCount(count);
    		return page;
    	}
    	public boolean assignRight(int rid, String mids) {
    		//通过角色id查询角色信息
    		SysRole role=this.sysRoleDao.getById(SysRole.class, rid);
    		//获取稳修改前该角色所拥有的权限
    		@SuppressWarnings("unchecked")
    		Set<SysRight> rights= role.getSysRights();
    		//清空之前所有的权限
    		rights.clear();
    		//拆分字符串
    		if (mids!=null) {
    			String[] midArray=mids.split(",");
    			for (String mid : midArray) {
    				DetachedCriteria dc=DetachedCriteria.forClass(SysRight.class);
    				dc.add(Restrictions.eq("rightCode", mid));
    				SysRight right=this.sysRightDao.get(dc);
    				//重新添加到集合中
    				rights.add(right);
    			}
    		}
    		//如上操作都是在内存中逻辑完成的
    		try {
    			this.sysRoleDao.update(role);
    			return true;
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		return false;
    	}
    	/*
    	 *增加角色
    	 */
    	public boolean addRole(SysRole sysRole) {
    		Serializable id=this.sysRoleDao.save(sysRole);
    		if (id!=null) {
    			return true;
    		}
    		return false;
    	}
    	/*
    	 * 删除角色
    	 */
    	public boolean delRole(Integer roleId) {
    		SysRole role=this.sysRoleDao.getById(SysRole.class, roleId);
    		role.setRoleFlag((byte)0);
    		try {
    			this.sysRoleDao.update(role);
    			return true;
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		return false;
    	}
    	/*
    	 * 编辑角色
    	 */
    	public boolean editRole(SysRole sysRole) {
    		sysRole.setRoleFlag((byte)1);
    		try {
    			this.sysRoleDao.update(sysRole);
    			return true;
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		return false;
    	}
    }
    

    6.Action层

    package com.action;
    
    import java.text.SimpleDateFormat;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    import com.bean.Page;
    import com.opensymphony.xwork2.ActionSupport;
    import com.pojo.SysRole;
    import com.service.IRoleService;
    
    public class RoleAction extends ActionSupport {
    	private IRoleService roleService;
    	private SysRole role;
    	private int page=1;
    	private int rows=5;
    	private int rid;
    	private String mids;
    	 private Integer roleId;
    	private Map<String,Object> dataMap;
    	
    	
    	public Integer getRoleId() {
    		return roleId;
    	}
    	public void setRoleId(Integer roleId) {
    		this.roleId = roleId;
    	}
    	public int getRid() {
    		return rid;
    	}
    	public void setRid(int rid) {
    		this.rid = rid;
    	}
    	public String getMids() {
    		return mids;
    	}
    	public void setMids(String mids) {
    		this.mids = mids;
    	}
    	public SysRole getRole() {
    		return role;
    	}
    	public void setRole(SysRole role) {
    		this.role = role;
    	}
    	public int getPage() {
    		return page;
    	}
    	public void setPage(int page) {
    		this.page = page;
    	}
    	public int getRows() {
    		return rows;
    	}
    	public void setRows(int rows) {
    		this.rows = rows;
    	}
    	public Map<String, Object> getDataMap() {
    		return dataMap;
    	}
    	public void setDataMap(Map<String, Object> dataMap) {
    		this.dataMap = dataMap;
    	}
    	public void setRoleService(IRoleService roleService) {
    		this.roleService = roleService;
    	}
    	
    	public String list(){
    		Page<SysRole> p=new Page<SysRole>();
    		p.setCurrentPage(page);
    		p.setLineSize(rows);
    		p=roleService.findRoles(role,p);
    		List<SysRole> roles=p.getList();
    		List<SysRole> roleAll=new ArrayList<SysRole>();
    		for (SysRole sysRole : roles) {
    			SysRole role=new SysRole();
    			role.setRoleId(sysRole.getRoleId());
    			role.setRoleName(sysRole.getRoleName());
    			role.setRoleFlag(sysRole.getRoleFlag());
    			role.setRoleDesc(sysRole.getRoleDesc());
    			roleAll.add(role);
    		}
    		dataMap=new HashMap<String,Object>();
    		//如果要使用easyui,要传递记录数,必须要使用key为total
    		dataMap.put("total",p.getCount());
    		//如果要使用easyui,向前台传递数据,那么集合必须是key为rows
    		dataMap.put("rows",roleAll);
    		return SUCCESS;
    	}
    	
    	public String updateRight(){
    		boolean flag=this.roleService.assignRight(rid, mids);
    		dataMap=new HashMap<String, Object>();
    		if (flag) {
    			dataMap.put("msg", "success");
    		}else {
    			dataMap.put("msg", "faliure");
    		}
    		return "assignRight";	
    	}
    	/*
    	 * 增加 角色
    	 */
    	public String addRole(){
    		role.setRoleFlag((byte)1);
    		boolean flag=this.roleService.addRole(role);
    		dataMap=new HashMap<String, Object>();
    		if (flag) {
    			dataMap.put("msg", "success");
    		}else {
    			dataMap.put("msg", "faliure");
    		}
    		return "addRole";	
    	}
    	/*
    	 * 删除角色
    	 */
    	public String delRole(){
    		boolean flag=this.roleService.delRole(roleId);
    		dataMap=new HashMap<String,Object>();
    		if(flag){
    			dataMap.put("msg","success");
    		}else{
    			dataMap.put("msg","faliure");
    		}
    		return "delRole";
    	}	
    	/*
    	 * 修改角色
    	 */
    	public String updataRole(){
    		boolean flag=this.roleService.editRole(role);
    		dataMap=new HashMap<String,Object>();
    		if(flag){
    			dataMap.put("msg","success");
    		}else{
    			dataMap.put("msg","faliure");
    		}
    		return "updateRole";		
    	}
    }
    

    7.Bean类

    package com.bean;
    
    import java.util.Map;
    
    public class Node {
    	
    	private String id;
    	private String text;
    	private String state;
    	private boolean checked;
    	private Map<String,Object> attributes;//自定义属性
    	
    	
    	public boolean isChecked() {
    		return checked;
    	}
    	public void setChecked(boolean checked) {
    		this.checked = checked;
    	}
    	public String getId() {
    		return id;
    	}
    	public void setId(String id) {
    		this.id = id;
    	}
    	public String getText() {
    		return text;
    	}
    	public void setText(String text) {
    		this.text = text;
    	}
    	public String getState() {
    		return state;
    	}
    	public void setState(String state) {
    		this.state = state;
    	}
    	public Map<String, Object> getAttributes() {
    		return attributes;
    	}
    	public void setAttributes(Map<String, Object> attributes) {
    		this.attributes = attributes;
    	}
    }
    



    package com.bean;
    
    import java.util.List;
    /**
     * 分页
     */
    public class Page<T>{
    	private int currentPage=1;//当前页
    	private int lineSize=5;//每页的跨度
    	private int count;//总记录数
    	private int totalPage;//总页数
    	private List<T> list;//集合
    	public int getCurrentPage() {
    		return currentPage;
    	}
    	public void setCurrentPage(int currentPage) {
    		this.currentPage = currentPage;
    	}
    	public int getLineSize() {
    		return lineSize;
    	}
    	public void setLineSize(int lineSize) {
    		this.lineSize = lineSize;
    	}
    	public int getCount() {
    		return count;
    	}
    	public void setCount(int count) {
    		this.count = count;
    	}
    	public int getTotalPage(int count,int lineSize) {
    		if(count%lineSize==0){
    			return count/lineSize;
    		}else{
    			return count/lineSize+1;
    		}
    	}
    	public void setTotalPage(int totalPage) {
    		this.totalPage = totalPage;
    	}
    	public List<T> getList() {
    		return list;
    	}
    	public void setList(List<T> list) {
    		this.list = list;
    	}
    }
    



    8.XML配置

    applicationContext.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans 
    	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    	http://www.springframework.org/schema/aop 
    	http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
    	http://www.springframework.org/schema/tx 
    	http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
    
    	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
    		</property>
    		<property name="url" value="jdbc:oracle:thin:locahost:1521:orcl">
    		</property>
    		<property name="username" value="laukei"></property>
    		<property name="password" value="laukei"></property>
    	</bean>
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">
    					org.hibernate.dialect.Oracle9Dialect
    				</prop>
    			</props>
    		</property>
    		<property name="mappingResources">
    			<list>
    
    			<value>com/pojo/BasicDictionary.hbm.xml</value>
    			<value>com/pojo/SaleChance.hbm.xml</value>
    			<value>com/pojo/SysUser.hbm.xml</value>
    			<value>com/pojo/Product.hbm.xml</value>
    			<value>com/pojo/SysRight.hbm.xml</value>
    			<value>com/pojo/Storage.hbm.xml</value>
    			<value>com/pojo/Orders.hbm.xml</value>
    			<value>com/pojo/OrdersLine.hbm.xml</value>
    			<value>com/pojo/ServiceManager.hbm.xml</value>
    			<value>com/pojo/CustLost.hbm.xml</value>
    			<value>com/pojo/CustLinkman.hbm.xml</value>
    			<value>com/pojo/SysRole.hbm.xml</value>
    			<value>com/pojo/SalePlan.hbm.xml</value>
    			<value>com/pojo/CommunicateRecord.hbm.xml</value>
    			<value>com/pojo/CustCustomer.hbm.xml</value></list>
    		</property>
    	</bean>
    	<bean id="transactionManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory" />
    		</property>
    	</bean>
    	<tx:advice id="txAdvice" transaction-manager="transactionManager">
    		<tx:attributes>
    			<tx:method name="add*" propagation="REQUIRED" />
    			<tx:method name="delete*" propagation="REQUIRED" />
    			<tx:method name="update*" propagation="REQUIRED" />
    			<tx:method name="find*" propagation="NOT_SUPPORTED"
    				read-only="true" />
    			<tx:method name="get*" propagation="NOT_SUPPORTED"
    				read-only="true" />
    			<tx:method name="*" propagation="REQUIRED" />
    		</tx:attributes>
    	</tx:advice>
    	<aop:config>
    		<aop:pointcut expression="execution(public * com.service.impl.*.*(..))"
    			id="pc" />
    		<aop:advisor advice-ref="txAdvice" pointcut-ref="pc" />
    	</aop:config>
    	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory" />
    		</property>
    	</bean>
    	<bean id="commonDao" class="com.dao.impl.CommonDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    
    	<bean id="basicDictionaryService" class="com.service.impl.BasicDictionaryServiceImpl">
    		<property name="basicDictionaryDao">
    			<ref bean="commonDao" />
    		</property>
    	</bean>
    	<bean id="productService" class="com.service.impl.ProductServiceImpl">
    		<property name="productDao">
    			<ref bean="commonDao" />
    		</property>
    	</bean>
    	<bean id="storageService" class="com.service.impl.StorageServiceImpl">
    		<property name="strorageDao">
    			<ref bean="commonDao" />
    		</property>
    		<property name="productDao">
    			<ref bean="commonDao" />
    		</property>
    	</bean>
    	<bean id="saleService" class="com.service.impl.SaleServiceImpl">
    		<property name="salePlanDao">
    			<ref bean="commonDao" />
    		</property>
    		<property name="saleChanceDao">
    			<ref bean="commonDao" />
    		</property>
    	</bean>
    	<bean id="userService" class="com.service.impl.SysUesrServiceImpl">
    		<property name="sysUserDao">
    			<ref bean="commonDao" />
    		</property>
    		<property name="sysRoleDao">
    			<ref bean="commonDao" />
    		</property>
    	</bean>
    	<bean id="rightService" class="com.service.impl.RightServiceImpl">
    		<property name="sysRightDao">
    			<ref bean="commonDao" />
    		</property>
    	</bean>
    	<bean id="roleService" class="com.service.impl.RoleServiceImpl">
    		<property name="sysRoleDao">
    			<ref bean="commonDao" />
    		</property>
    		<property name="sysRightDao">
    			<ref bean="commonDao" />
    		</property>
    	</bean>
    	<bean id="customerService" class="com.service.impl.CustCustomerServiceImpl">
    		<property name="custCustomerDao">
    			<ref bean="commonDao" />
    		</property>
    		<property name="custLostDao">
    			<ref bean="commonDao" />
    		</property>
    	</bean>
    	<bean id="ServManageDao" class="com.service.impl.ServiceServiceImpl">
    		<property name="sercManagerDao">
    			<ref bean="commonDao"/>
    		</property>
    		<property name="sercByCustDao">
    			<ref bean="commonDao"/>
    		</property>
    		<property name="serByBasicDao">
    			<ref bean="commonDao"/>
    		</property>
    		<property name="serviceUser">
    			<ref bean="commonDao"/>
    		</property>
    	</bean>
    	<bean id="basicDictionaryAction" class="com.action.BasicDictionaryAction"
    		scope="prototype">
    		<property name="basicDictionaryService">
    			<ref bean="basicDictionaryService" />
    		</property>
    	</bean>
    	<bean id="productAction" class="com.action.ProductAction" scope="prototype">
    		<property name="productService">
    			<ref bean="productService" />
    		</property>
    	</bean>
    	<bean id="storageAction" class="com.action.StorageAction" scope="prototype">
    		<property name="storageService">
    			<ref bean="storageService" />
    		</property>
    	</bean>
    	<bean id="saleAction" class="com.action.SaleAction" scope="prototype">
    		<property name="saleService">
    			<ref bean="saleService" />
    		</property>
    	</bean>
    	<bean id="userAction" class="com.action.SysUserAction" scope="prototype">
    		<property name="userService">
    			<ref bean="userService" />
    		</property>
    		<property name="rightService">
    			<ref bean="rightService"/>
    		</property>
    		<property name="roleService">
    			<ref bean="roleService"/>
    		</property>
    	</bean>
    	<bean id="customerAction" class="com.action.CustomerAction" scope="prototype">
    		<property name="customerService">
    			<ref bean="customerService" />
    		</property>
    		<property name="custLostService">
    			<ref bean="customerService" />
    		</property>
    	</bean>
    	<bean id="roleAction" class="com.action.RoleAction" scope="prototype">
    		<property name="roleService">
    			<ref bean="roleService" />
    		</property>
    	</bean>
    	<bean id="ServiceActionDao" class="com.action.ServiceAction" scope="prototype">
    		<property name="managerService">
    			<ref bean="ServManageDao"/>
    		</property>
    	</bean>
    </beans>

    struts.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    	<constant name="struts.devMode" value="true"></constant>
    	<package name="default" namespace="/" extends="json-default">
    		<action name="basicDictionaryAction" class="basicDictionaryAction">
    			<result type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="addBasic" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="delBasic" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="editBasic" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="getById" type="json">
    				<param name="root">basicDictionary</param>
    			</result>
    		</action>
    		<action name="productAction" class="productAction">
    			<result type="json">
    				<param name="root">proMap</param>
    			</result>
    			<result name="addProduct" type="json">
    				<param name="root">proMap</param>
    			</result>
    			<result name="delProduct" type="json">
    				<param name="root">proMap</param>
    			</result>
    			<result name="editProduct" type="json">
    				<param name="root">proMap</param>
    			</result>
    			<result name="getById" type="json">
    				<param name="root">product</param>
    			</result>
    		</action>
    		<action name="storageAction" class="storageAction">
    			<result type="json">
    				<param name="root">StoMap</param>
    			</result>
    			<result name="products" type="json">
    				<param name="root">products</param>
    			</result>
    		</action>
    		<action name="saleAction" class="saleAction">
    			<result type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="addSaleCh" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="delSaleCh" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="getSaleCh" type="json">
    				<param name="root">saleChance</param>
    			</result>
    			<result name="updateSaleCh" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="assignSaleCh" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="addSalePl" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="getPlan" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="listSP" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="delSaleSP" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="updateSaleSP" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="goodSt" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="stopSt" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="upChan" type="json">
    				<param name="root">saleChance</param>
    			</result>
    			<result name="updaItem" type="json">
    				<param name="root">dataMap</param>
    			</result>
    		</action>
    		<action name="userAction" class="userAction">
    			<result type="json">
    				<param name="root">user</param>
    			</result>
    			<result name="loadTree" type="json">
    			      <param name="root">nodes</param>
    			</result>
    			<result name="users" type="json">
    			      <param name="root">users</param>
    			</result>
    			<result name="list" type="json">
    			      <param name="root">dataMap</param>
    			</result>
    			<result name="addUser" type="json">
    			      <param name="root">dataMap</param>
    			</result>
    			<result name="delUser" type="json">
    			      <param name="root">dataMap</param>
    			</result>
    			<result name="updateUser" type="json">
    			      <param name="root">dataMap</param>
    			</result>
    			<result name="getById" type="json">
    			      <param name="root">user</param>
    			</result>
    			<result name="findSysRole" type="json">
    			      <param name="root">sysRoles</param>
    			</result>
    		</action>
    		<action name="customerAction" class="customerAction">
    			<result type="json">
    				<param name="root">dataMap</param>
    			</result>
    		</action>
    		<action name="roleAction" class="roleAction">
    			<result name="addRole"  type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="assignRight" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="delRole" type="json">
    			      <param name="root">dataMap</param>
    			</result>
    			<result name="updateRole" type="json">
    			      <param name="root">dataMap</param>
    			</result>
    		</action>
    		<action name="managerAction" class="ServiceActionDao">
    			<result type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="byBaType" type="json">
    				<param name="root">basB</param>
    			</result>
    			<result name="byBaStatus" type="json">
    				<param name="root">basB</param>
    			</result>
    			<result name="addServ" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="findUser" type="json">
    				<param name="root">user</param>
    			</result>
    			<result name="fP" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="deleSer" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="chuli" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="fankui" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="guidang" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="servChuLi" type="json">
    				<param name="root">dataMap</param>
    			</result>
    			<result name="servFankui" type="json">
    				<param name="root">dataMap</param>
    			</result>
    		</action>
    		<action name="custcuAction" class="ServiceActionDao">
    			<result type="json">
    				<param name="root">customers</param>
    			</result>
    		</action>
    	</package>
    </struts>    
    


    Web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
      <display-name></display-name>
      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
      </context-param>
      <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>
      <filter>
        <filter-name>characterEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
          <param-name>encoding</param-name>
          <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
          <param-name>forceEncoding</param-name>
          <param-value>true</param-value>
        </init-param>
      </filter>
      <filter-mapping>
        <filter-name>characterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
      <filter>
        <filter-name>openSessionInView</filter-name>
        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
      </filter>
      <filter-mapping>
        <filter-name>openSessionInView</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
      <welcome-file-list>
        <welcome-file>login.jsp</welcome-file>
      </welcome-file-list>
      <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
      		org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
      	</filter-class>
      </filter>
      <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
    </web-app>

    9.JSP页面

    role.jsp
    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <%
    	String path = request.getContextPath();
    	String basePath = request.getScheme() + "://"
    			+ request.getServerName() + ":" + request.getServerPort()
    			+ path + "/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>">
    
    <title>角色管理</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    	<link rel="stylesheet" type="text/css" href="styles.css">
    	-->
    <link rel="stylesheet"
    	href="script/jquery-easyui-1.4.5/themes/metro-blue/easyui.css"
    	type="text/css"></link>
    <link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/icon.css"
    	type="text/css"></link>
    <link rel="stylesheet"
    	href="script/jquery-easyui-1.4.5/themes/color.css" type="text/css"></link>
    <script type="text/javascript"
    	src="script/jquery-easyui-1.4.5/jquery.min.js"></script>
    <script type="text/javascript"
    	src="script/jquery-easyui-1.4.5/jquery.easyui.min.js"></script>
    <script type="text/javascript">
    	$(function() {
    		//表格主体信息
    		$('#dg').datagrid({
    			url : '${pageContext.request.contextPath}/roleAction!list',
    			fitColumns : true,
    			pagination : true,
    			toolbar : '#page_role_management_tb',
    			rownumbers : true,
    			loadMsg : '数据装载中......',
    			columns : [ [ {
    				field : 'roleId',title : '角色编号',width : 150,checkbox : true}, 
    				{field : 'roleName',title : '角色名称',width : 150}, 
    				{field : 'roleDesc',title : '角色描述',width : 150}, 
    				{field : 'roleFlag',title : '角色状态',width : 150,formatter : function(value, row, index) {
    					if (value == '1') {
    						return '正常';
    					} else if (value == '0') {
    						return '非正常';
    					}
    				}
    			}, ]]
    		});
    		$('#dg').datagrid('getPager').pagination({
    			pageSize : 10,
    			pageList : [ 3, 5, 10, 15, 20 ],
    			beforePageText : '第',
    			afterPageText : '页    共 {pages} 页',
    			displayMsg : '当前显示 {from} - {to} 条记录   共 {total} 条记录'
    		});
    		//授权按钮 
    		$("#tb_grant").click(function() {
    			var rows = $('#dg').datagrid('getChecked');
    			if (rows.length == 0) {
    				$.messager.show({
    					title : '提示',
    					msg : '请勾选要授权的角色!'
    				});
    			} else {
    				if (rows.length > 1) {
    					$.messager.show({
    						title : '提示',
    						msg : '授权时只能选择一个角色!'
    					});
    				} else if (rows.length == 1) {
    					var rId = rows[0].roleId;
    					assignRight(rId);
    					$("#win").dialog('open');
    
    				}
    			}
    		});
    		$("#tb_add").click(function() {
    			$("#addWindow").window("open");
    		});
    		$("#addBtn").click(
    				function() {
    					$.post("roleAction!addRole", $("#myForm").serialize(),
    							function(data) {
    								if (data.msg == "success") {
    									$("#addWindow").window("close");
    									$("#dg").datagrid("load");
    								}
    							}, "json");
    				});
    		//删除角色
    			$("#tb_remove").click(function() {
    			var rows = $('#dg').datagrid('getChecked');
    			if (rows.length == 0) {
    				$.messager.show({
    					title : '提示',
    					msg : '请勾选要删除的角色!'
    				});
    			} else  if (rows.length == 1) {
    					var roleId = rows[0].roleId;
    					$.messager.confirm("删除","您确认要删除记录吗?",
    						function(data) {
    						if (data!=null) {
    					$.post(
    						"roleAction!delRole",
    						{"roleId":roleId},
    						function(data){
    						if(data.msg=="success"){
    						$("#dg").datagrid("load");
    					}},
    					"json");
    				};
    			});		
    			}
    		});
    		//修改角色
        	$("#tb_edit").click(function(){	
        		var rows=$("#dg").datagrid("getChecked");
        		if(rows.length==0){
        			$.messager.show({
        				title:'提示',
        				msg:'请勾选修改对象!',
        		});
        		}else if(rows.length>1){
        			$.messager.show({
        				title:'提示',
        				msg:'每次只能修改一个对象',
        			});
        		}else{
        			$("#editWindow").window("open");
        				var str="role.roleId*role.roleName*role.roleDesc";
    					var arr=str.split('*');
    					document.getElementById('d1').value=rows[0].roleId;
    					document.getElementById('d2').value=rows[0].roleName;
    					document.getElementById('d3').value=rows[0].roleDesc;
        		}
        	});
        	$("#editBtn").click(function(){
        		$.post("roleAction!updataRole",$("#updateForm").serialize(),function(data){
        				alert(data);
        			if(data.msg=="success"){
        				$("#editWindow").window("close");
        				$("#dg").datagrid("load");
        			}
        		},"json");
        	});
        	//查询操作
    		$("#searchBtn").click(function(){
    			$("#dg").datagrid('load',{"role.roleName":$("#roleName").val()});
    		});	
    	});
    	
    	function assignRight(rId) {
    		//加载内容
    		$("#tt").tree({
    			url : "userAction!assignTree?roleId=" + rId,
    			lines : true,
    			checkbox : true,
    			animate : true,
    			//页面加载完数据之后触发
    			onLoadSuccess : function() {
    				//展开所有菜单
    				$(this).tree("expandAll");
    			}
    
    		});
    	}
    </script>
    <style type="text/css">
      		#me{
      			font-size: 12px;
      		}
      		input{
    			font-size: 12px;
    		}
      </style>
    </head>
    
    <body>
    		<div id="me">
    		<input id="roleName" type="text" class="easyui-validatebox">
      		<a id="searchBtn" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询角色</a>
      		</div>
    		<div id="page_role_management_tb">
    		<a class="easyui-linkbutton" id="tb_remove"
    			data-options="iconCls:'icon-remove',plain:true" style="float:right;">删除</a>
    		<div class="datagrid-btn-separator"></div>
    		<a class="easyui-linkbutton" id="tb_edit"
    			data-options="iconCls:'icon-edit',plain:true" style="float:right;">编辑</a>
    		<div class="datagrid-btn-separator"></div>
    		<a class="easyui-linkbutton" id="tb_add"
    			data-options="iconCls:'icon-add',plain:true" style="float:right;">增加</a>
    		<div class="datagrid-btn-separator"></div>
    		<a class="easyui-linkbutton" id="tb_grant"
    			data-options="iconCls:'icon-edit',plain:true" style="float:right;">授权</a>
    		<div class="datagrid-btn-separator"></div>
    	</div>
    	<table id="dg"></table>
    	<div id="win" class="easyui-dialog" title="角色授权"
    		style="width:300px;height:500px"
    		data-options="iconCls:'icon-save',modal:true,closed:true,buttons:[{
    				text:'保存',
    				handler:function(){
    					var ids=[];
    					var nodes =$('#tt').tree('getChecked', ['checked','indeterminate']);
    					$.each(nodes,function(key,val){
    						ids.push(val.id);
    					});
    				    var mIds=ids.join(',');
    				    var rows=$('#dg').datagrid('getChecked');
    				    var rId=rows[0].roleId;
    				    $.ajax({
    					url:'roleAction!updateRight',
    					data:{
    						rid:rId,
    						mids:mIds
    					},
    					dataType:'json',
    					type:'POST',
    					success:function(data){
    						if(data.msg=='success'){
    							$('#win').dialog('close');
    						}
    					}
    					});
    				}
    				},{
    				text:'关闭',
    				handler:function(){
    					$('#win').dialog('close');
    				}
    			}]">
    		<ul id="tt"></ul>
    	</div>
    	<div id="addWindow" class="easyui-window" title="增加角色"
    		style="width:200px;height:150px"
    		data-options="iconCls:'icon-save',modal:true,closed:true">
    		<form id="myForm">
    			角色名称<input type="text" name="role.roleName"><br> 
    			角色描述<input type="text" name="role.roleDesc"><br> <input type="button" value="增加" id="addBtn">
    		</form>
    	</div>
    	<!-- 修改操作窗口 -->
        <div id="editWindow" class="easyui-window" title="修改角色数据" style="width:100px;width:auto"   
            	data-options="iconCls:'icon-edit',modal:true,closed:true">
            <form id="updateForm" method="post">
            	<table>  
    	    		<tr>
    	    			<td>角色编号</td>
    	    			<td><input type="text" name="role.roleId" id="d1" readonly="readonly"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>角色名称</td>
    	    			<td><input type="text" name="role.roleName" id="d2"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>角色描述</td>
    	    			<td><textarea rows="5" cols="17" name="role.roleDesc" id="d3" ></textarea></td>
    	    		</tr>
    	    		<tr>
    	    			<td align="center"><input type="button"  class="easyui-linkbutton"  value="提交"  id="editBtn" ></td>
    	    		</tr>
        		</table>
            </form>
        </div>  
    </body>
    </html>


    user.jsp
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>用户管理</title>
    	<meta http-equiv="pragma" content="no-cache">
    	<meta http-equiv="cache-control" content="no-cache">
    	<meta http-equiv="expires" content="0">    
    	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    	<meta http-equiv="description" content="This is my page">
    	<!--
    	<link rel="stylesheet" type="text/css" href="styles.css">
    	-->
    <link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/metro-blue/easyui.css" type="text/css"></link>
    	  <link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/icon.css" type="text/css"></link>
    	  <link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/color.css" type="text/css"></link>
    	  <script type="text/javascript" src="script/jquery-easyui-1.4.5/jquery.min.js"></script>
    	  <script type="text/javascript" src="script/jquery-easyui-1.4.5/jquery.easyui.min.js"></script>
    	   <script type="text/javascript" src="script/jquery-easyui-1.4.5/easyloader.js"></script>
      <script type="text/javascript">
      	$(function(){
      		$("#dg").datagrid({
      			url:"userAction!userList",
      			columns:[[
      				{field:'userId',title:'编号',width:20,checkbox : true},
      				{field:'sysRole.roleName',title:'角色名称',width:20,formatter: function(value,rec){
      					return rec.sysRole.roleName;}},
      				{field:'userName',title:'用户名',width:20},
      				{field:'userPassword',title:'密码',width:20,hidden:true},
      			]],
      			striped:true,
      			fitColumns:true,
      			pagination:true
      			});
      			$("#dg").datagrid('getPager').pagination({
    				pageSize:10,
    				pageList : [3,5,10,15,20],
    				beforePageText: '第',
    				afterPageText: '页    共 {pages} 页',
    				displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'  
    			});
    			//查询操作
    		$("#searchBtn").click(function(){
    			$("#dg").datagrid('load',{"user.userName":$("#userName").val(),"user.userId":$("#userId").val()});
    		});	
      		//增加操作
        		$("#add").click(function(){
        			$("#addwindow").window("open");
    		  		$("#roleId").combobox({    
    				    url:'userAction!findSysRole',    
    				    valueField:'roleId',    
    				    textField:'roleName',
    				    onSelect:function(data){
    				    	$("#roleId").val(data.roleId);
    				    } 
    				}); 
        		});
    				$("#addBtn").click(function(){
        			$.post("userAction!addUser",$("#addForm").serialize(),function(data){
        				if(data.msg=="success"){
        					$("#addwindow").window("close");
        					$("#dg").datagrid("load");
        				}
        			},"json");
        		});
      		
      		//删除
        		$("#remove").click(function(){
        			var rows=$("#dg").datagrid("getChecked");
        			if(rows.length==0){
        				$.messager.show({
        					title:'提示',
        					msg:'请勾选对象!'
        				});
        			}else if(rows.length>1){
        			$.messager.show({
        				title:'提示',
        				msg:'每次只能勾选一个对象',
        			});
        			}else{
        				if($.messager.confirm("删除","您确认要删除记录吗?")){
        					var userId=rows[0].userId;
        					$.post("userAction!delUser",{"userId":userId},function(data){
        						if(data.msg=="success"){
        							$("#dg").datagrid("load");
        						}
        					},"json");
        				}
        			}
        		});
      		
      			//修改操作
        	$("#edit").click(function(){	
        		var rows=$('#dg').datagrid("getChecked");
        		if(rows.length==0){
        			$.messager.show({
        				title:'提示',
        				msg:'请勾选对象!',
        		});
        		}else if(rows.length>1){
        			$.messager.show({
        				title:'提示',
        				msg:'每次只能勾选一个对象',
        			});
        		}else{
        			$("#editWindow").window("open");
        		  var pro_string="user.userId*user.userName*user.userPassword*user.userFlag*user.role.roleId";
    					var arr=pro_string.split('*');
    					document.getElementById('d1').value=rows[0].userId;
    					document.getElementById('d2').value=rows[0].userName;
    					document.getElementById('d3').value=rows[0].userPassword;
    					document.getElementById('d4').value=rows[0].userFlag;
    					document.getElementById('d4').value=rows[0].sysRole.roleId;					
    					//roleId获取
    		  			$("#d5").combobox({    
    				    url:'userAction!findSysRole',    
    				    valueField:'roleId',    
    				    textField:'roleName',
    				    onSelect:function(data){
    				    	$("#d5").val(data.roleId);
    				    } 
    				}); 
        		}
        	});
    		//修改提交
        	$("#updateBtn").click(function(){
        		$.post("userAction!editUser",$("#updateForm").serialize(),function(data){
        			if(data.msg=="success"){	
        				$("#editWindow").window("close");
        				$("#dg").datagrid("load");
        			}
        		},"json");
        	});
      		});
      
      	</script>
      	<style type="text/css">
      		#me{
      			font-size: 12px;
      		}
      		input{
    			font-size: 12px;
    		}
      </style>
      </head> 
      <body>
      <div id="me">
         <form action="#">
      		<input id="userName" type="text" class="easyui-validatebox">
      		<a id="searchBtn" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询用户</a>
      		<div id="page_role_management_tb">
      		<a class="easyui-linkbutton" id="remove" data-options="iconCls:'icon-remove',plain:true" style="float:right;">删除</a>
    		
    		<a class="easyui-linkbutton" id="edit" data-options="iconCls:'icon-edit',plain:true" style="float:right;">编辑</a>
    	
    		<a class="easyui-linkbutton" id="add" data-options="iconCls:'icon-add',plain:true" style="float:right;">增加</a>
    		</div>
      	</form> 
      	</div>	 
      	 <!-- 增加-->
      		<div id="addwindow" class="easyui-window" title="增加数据" style="width:280px;height:auto"   
            	data-options="iconCls:'icon-save',modal:true,closed:true">
            <form id="addForm">
            	<table align="center">
    	    		<tr>
    	    			<td>姓名</td>
    	    			<td><input type="text" name="user.userName" id="userName"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>密码</td>
    	    			<td><input type="text" name="user.userPassword" id="userPassword"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>角色</td>
    	    			<td><input type="text" name="user.sysRole.roleId" id="roleId" type="combobox"></td>
    	    		</tr>
    	    		<tr>
    	    			<td><input type="button" class="easyui-linkbutton" value="提交" id="addBtn"></td>
    	    		</tr>
        		</table>
            </form>
        </div>
      	<!-- 修改 -->
        <div id="editWindow" class="easyui-window" title="编辑数据" style="width:300px;height:auto"   
            	data-options="iconCls:'icon-save',modal:true,closed:true">
            <form id="updateForm" method="post">
            	<table align="center">  
    	  			<tr>
    	    			<td>编号:</td>
    	    			<td><input type="text" name="user.userId" id="d1" readonly="readonly"></td>
    	    		</tr> 
    	    		<tr>
    	    			<td>姓名:</td>
    	    			<td><input type="text"  name="user.userName" id="d2"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>密码:</td>
    	    			<td><input type="text"name="user.userPassword" id="d3"></td>
    	    		</tr>
    	    		<tr>	
    	    			<td>标记:</td>
    	    			<td><input type="text" name="user.userFlag" id="d4"></td>
    	    		</tr>
    	    		<tr>	
    	    			<td>角色Id:</td>
    	    			<td><input type="text"  name="user.sysRole.roleId" id="d5"></td>
    	    			
    	    		</tr>
    	    		<tr>
    	    			<td><input type="button" class="easyui-linkbutton"  value="提交" id="updateBtn" ></td>
    	    		</tr>
        		</table>
            </form>
        </div>
    	 <table id="dg" width="100%"></table>
      </body>
    </html>


    basic.jsp
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>My JSP 'index.jsp' starting page</title>
    	<meta http-equiv="pragma" content="no-cache">
    	<meta http-equiv="cache-control" content="no-cache">
    	<meta http-equiv="expires" content="0">    
    	<meta http-equiv="keywords" content="keyworno,keywortype,keyworitem">
    	<meta http-equiv="description" content="This is my page">
    	<!--
    	<link rel="stylesheet" type="text/css" href="styles.css">
    	-->
     <link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/metro-blue/easyui.css" type="text/css"></link>
    	  <link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/icon.css" type="text/css"></link>
    	  <link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/color.css" type="text/css"></link>
    	  <script type="text/javascript" src="script/jquery-easyui-1.4.5/jquery.min.js"></script>
    	  <script type="text/javascript" src="script/jquery-easyui-1.4.5/jquery.easyui.min.js"></script>
    	   <script type="text/javascript" src="script/jquery-easyui-1.4.5/easyloader.js"></script>
      <script type="text/javascript">
      	$(function(){
      		$("#dg").datagrid({
      			url:"basicDictionaryAction!list",
      			columns:[[
      				{field:'basiNo',title:'编号',width:20,checkbox: true},
      				{field:'basiType',title:'类别',width:20},
      				{field:'basiItem',title:'条目',width:20},
      				{field:'basiValue',title:'值',width:20},
      				{field:'basiEditable',title:'是否可编辑',width:20,
      				formatter : function(value, row, index) {
    					if (value == '1') {
    						return '可以编辑';
    					} else if (value == '0') {
    						return '不可以编辑';
    						}
    					}
    				}
      			]],
      			striped:true,
      			fitColumns:true,
      			pagination:true,
      			toolbar : '#page_role_management_tb'
      			});
      			$("#dg").datagrid('getPager').pagination({
    				pageSize:10,
    				pageList : [3,5,10,15,20],
    				beforePageText: '第',
    				afterPageText: '页    共 {pages} 页',
    				displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'  
    			});
    			$("#searchBtn").click(function(){
    				$("#dg").datagrid('load',{"basicDictionary.basiType":$("#type").val(),"basicDictionary.basiItem":$("#item").val(),"basicDictionary.basiValue":$("#valu").val()});
    			});
    			//增加
        		$("#tb_add").click(function(){
        			$("#addwindow").window("open");
        		});
    				$("#addBtn").click(function(){
        			$.post("basicDictionaryAction!addBasic",$("#addForm").serialize(),function(data){
        				if(data.msg=="success"){
        					$("#addwindow").window("close");
        					$("#dg").datagrid("load");
        				}
        			},"json");
        		});
    			//删除
        		$("#tb_remove").click(function(){
        			var rows=$("#dg").datagrid("getChecked");
        			if(rows.length==0){
        				$.messager.show({
        					title:'提示',
        					msg:'请勾选要删除的记录!'
        				});
        			}else if(rows.length>1){
        			$.messager.show({
        				title:'提示',
        				msg:'每次只允许删除一条记录',
        			});
        			}else if(rows.length==1){
        					$.messager.confirm("删除","您确认要删除记录吗?");
        					var basiNo=rows[0].basiNo;
        					$.post("basicDictionaryAction!delBasic",{"basiNo":basiNo},function(data){
        						if(data.msg=="success"){
        							$("#dg").datagrid("load");
        						}
        					},"json");
        				}
        		});
    		//修改
        	$("#tb_edit").click(function(){	
        		var rows=$('#dg').datagrid("getChecked");
        		if(rows.length==0){
        			$.messager.show({
        				title:'提示',
        				msg:'请选择修改的记录!',
        		});
        		}else if(rows.length>1){
        			$.messager.show({
        				title:'提示',
        				msg:'每次只能修改一条记录',
        			});
        		}else{
        				var str="basicDictionary.basiNo*basicDictionary.basiType*basicDictionary.basiItem*basicDictionary.basiValue*basicDictionary.basiEditable*basicDictionary.basiFlag";
    					var arr=str.split('*');
    					document.getElementById('bno').value=rows[0].basiNo;
    					document.getElementById('btype').value=rows[0].basiType;
    					document.getElementById('bitem').value=rows[0].basiItem;
    					document.getElementById('bvalu').value=rows[0].basiValue;
    					document.getElementById('beditable').value=rows[0].basiEditable;
    					document.getElementById('bflag').value=rows[0].basiFlag;
    		    		$("#editwindow").window("open");
        		}
        	});
        	$("#editBtn").click(function(){
        		$.post("basicDictionaryAction!editBasic",$("#editForm").serialize(),function(data){
        			if(data.msg=="success"){	
        				$("#editwindow").window("close");
        				$("#dg").datagrid("load");
        			}
        		},"json");
        	});
    	});	
      </script>
      <style type="text/css">
      		#me{
      			font-size: 12px;
      		}
      		input{
    			font-size: 12px;
    		}
      </style>
     </head>
      <body>
      		<div id="page_role_management_tb">
    	<div class="datagrid-btn-separator"></div>
    	<a class="easyui-linkbutton" id="tb_add"
    		data-options="iconCls:'icon-add',plain:true" style="float:right;">增加</a>
    	<div class="datagrid-btn-separator"></div>
    	<a class="easyui-linkbutton" id="tb_remove"
    		data-options="iconCls:'icon-remove',plain:true" style="float:right;">删除</a>
    	<div class="datagrid-btn-separator"></div>
    	<a class="easyui-linkbutton" id="tb_edit"
    		data-options="iconCls:'icon-edit',plain:true" style="float:right;">编辑</a>
    	<div class="datagrid-btn-separator"></div>
    	<a href="help.jsp" class="easyui-linkbutton" id="help"
    		data-options="iconCls: 'icon-help',plain:true" οnclick="help('');"
    		style="float:right;margin-right: 1px;">帮助</a>
    		</div>
    	<div id="me">
      	<form action="#">
      		类别 <input id="type" type="text" class="easyui-validatebox">	
      		条目 <input id="item" type="text" class="easyui-validatebox">
      		值 <input id="valu" type="text" class="easyui-validatebox">
      		<a id="searchBtn" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a>
      	</form>
      	</div>
      	<div id="addwindow" class="easyui-window" title="增加数据" style="width:280px;height:auto"   
            	data-options="iconCls:'icon-add',modal:true,closed:true">
            <form id="addForm">
            	<table align="center">  
    	    		<tr>	
    	    			<td>编号:</td>
    	    			<td><input type="text" name="basicDictionary.basiNo"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>类别:</td>
    	    			<td><input type="text" name="basicDictionary.basiType" ></td>
    	    		</tr>
    	    		<tr>
    	    			<td>条目:</td>
    	    			<td><input type="text" name="basicDictionary.basiItem"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>值:</td>
    	    			<td><input  type="text" name="basicDictionary.basiValue"></td>
    	    		</tr>
    	    		<tr>
    	    			<td><input type="button" value="提交" class="easyui-linkbutton"  id="addBtn"></td>
    	    		</tr>
        		</table>
            </form>
        </div>
        
        <div id="editwindow" class="easyui-window" title="编辑数据" style="width:280px;height:auto"   
            	data-options="iconCls:'icon-edit',modal:true,closed:true">
            <form id="editForm">
            	<table align="center">  
    	    		<tr>	
    	    			<td>编号</td>
    	    			<td><input type="text" name="basicDictionary.basiNo" id="bno" readonly></td>
    	    		</tr>
    	    		<tr>
    	    			<td>类别</td>
    	    			<td><input type="text" name="basicDictionary.basiType" id="btype"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>条目</td>
    	    			<td><input type="text" name="basicDictionary.basiItem" id="bitem"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>值</td>
    	    			<td><input  type="text" name="basicDictionary.basiValue" id="bvalu"></td>
    	    		</tr>
    	    		<tr>
    	    			<td>是否可编辑</td>
    	    			<td><input type="text" name="basicd.basiEditable" id="beditable" readonly></td>
    	    		</tr>
    	    		<tr>	
    	    			<td>状态</td>
    	    			<td><input type="text" name="basicd.basiFlag" id="bflag" readonly></td>
    	    		</tr>
    	    		<tr>
    	    			<td><input type="button" value="提交" class="easyui-linkbutton"  id="editBtn"></td>
    	    		</tr>
        		</table>
            </form>
        </div>
    	 <table id="dg" width="90%" align="center"></table>
      </body>
    </html>

    index.jsp
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@page import="java.text.SimpleDateFormat"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>My JSP 'index.jsp' starting page</title>
        
    	<meta http-equiv="pragma" content="no-cache">
    	<meta http-equiv="cache-control" content="no-cache">
    	<meta http-equiv="expires" content="0">    
    	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    	<meta http-equiv="description" content="This is my page">
    	<!--
    	<link rel="stylesheet" type="text/css" href="styles.css">
    	-->
    		<link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/metro-blue/easyui.css" type="text/css"></link>
    	  <link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/icon.css" type="text/css"></link>
    	  <link rel="stylesheet" href="script/jquery-easyui-1.4.5/themes/color.css" type="text/css"></link>
    	  <script type="text/javascript" src="script/jquery-easyui-1.4.5/jquery.min.js"></script>
    	  <script type="text/javascript" src="script/jquery-easyui-1.4.5/jquery.easyui.min.js"></script>
    	   <script type="text/javascript" src="script/jquery-easyui-1.4.5/easyloader.js"></script>
    	  <script type="text/javascript">
      				$(function(){
      		$("#treemenu").tree({
      			url:"userAction!loadTree?roleId="+'${sessionScope.user.sysRole.roleId}',
      			lines:true,
      			animate:true,
      			onClick:function(node){
      				if(node.attributes.url==null){
      					if(node.state=="closed"){
      						$(this).tree('expand',node.target);
    	  				}else if(node.state=="open"){
    						$(this).tree('collapse',node.target);
    					}
      				}else{
      					//alert(node.attributes.url);
      					addTab(node.text,node.attributes.url);
      				}
      			},
      			//页面加载完数据之后触发
      			onLoadSuccess:function(){
      				//展开所有菜单
    				$(this).tree("expandAll");
      			}
      			
      		});
      	});
      	function addTab(title,url){
      		if ($("#tabs").tabs('exists',title)) {
    			$("#tabs").tabs('select',title);	
    		}else{
    			$('#tabs').tabs('add',{    
    		    title:title,    
    		    content:'<iframe src="'+'${pageContext.request.contextPath}/'+url+'" frameborder="0" style="border:0;width:100%;height:99.4%;"></iframe>',    
    		    closable:true   
    			}); 
    		}
      	}
     </script>
     	<%
    	SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
    	String date= format.format(new Date());
      %>
      </head>
      
      <body>
       <body class="easyui-layout">   
        <div data-options="region:'north',noheader:true" style="height:120px;background:#3B7194; padding-top: 38px; overflow:hidden;">
        	<div>
        		 <span style="font-size: 30px;font-weight: bolder;color: white;font-family: 微软雅黑;margin-left: 30px;"><img src="script/Imgs/logo.ico" style="width: 50px" name="旗鱼科技">客户关系管理系统</span>
       		 </div>
        	<div>		 
    	    	 <span style="float:right; color: white;font-family: 微软雅黑; margin-bottom:0px; padding-right:10px; font-size: 12px;">
    	    	 <marquee direction="left" loop="-1" width="400" height="300" behavior="scroll" scrollamount="5">欢迎  ${user.userName}登录CRM管理系统!当前是<%=date%></marquee>
    	    	<a href="login.jsp" class="easyui-linkbutton"> 退出登录</a></span>
       		 </div>
        </div>
        <div data-options="region:'south',noheader:true" style="height:40px;background:#3B7194;">
    	    	<span style="float: right;padding-top: 10px;color: white;font-family: 微软雅黑; padding-right:500px; font-size: 12px;overflow:hidden;">©2016  版权归个人所有 翻版必究  CREATE BY LauKei</span>
        </div>  
        <div data-options="region:'west',title:'导航菜单',split:true,iconCls:'icon-daohang'" style="width:160px;">
        	<ul id="treemenu">
        	</ul>
        </div>   
        <div data-options="region:'center',noheader:true,split:true">
       		 <div class="easyui-tabs" style="fit:true; border: false" id="tabs">
    	      <div title="首页">
    	      		
    	      	 <div><span><img src="script/Imgs/welcome.jpg" style="width: 100%; height: 100%;"/></span>
    	      	 			
    	      	 </div>
    	      </div>
    	    </div>
       </div>   
    </body> 
    </html>


    login.jsp
    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>CRM客戶管理系統  Customer Relationship Management System</title>
        
    	<meta http-equiv="pragma" content="no-cache">
    	<meta http-equiv="cache-control" content="no-cache">
    	<meta http-equiv="expires" content="0">    
    	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    	<meta http-equiv="description" content="This is my page">
    	<link rel="stylesheet" href="script/css/style.css" tppabs="script/css/style.css" /></link>
    	<script src="script/js/jquery.js"></script>
    	<script src="script/js/verificationNumbers.js" tppabs="script/js/verificationNumbers.js"></script>
    	<script src="script/js/Particleground.js" tppabs="script/js/Particleground.js"></script>
    <style type="text/css">
    	body{height:100%;background:#3b7194;overflow:hidden;}
    	canvas{z-index:-1;position:absolute;}
    </style>
    <script>
    		$(document).ready(function() {
    		  //粒子背景特效
    		  $('body').particleground({
    		    dotColor: '#5cbdaa',
    		    lineColor: '#5cbdaa'
    		  });
    		  //验证码
    		  createCode();
    		  $(".submit_btn").click(function(){
    			  $.post("userAction!login",{"user.userName":$("#uname").val(),"user.userPassword":$("#upass").val()},function(data){
      				if (data!=null) {
    					window.location="index.jsp";
    				}else{
    					$messager.show({
    						title:'登录提示',
    						msg:'用户名或者密码有误。',
    						timeout:3000,
    						showType:'slide'
    					});
    				}
      			},"json");
      		});
      	});
    		</script>
    		</head>
    		<body>
    			<dl class="admin_login">
    			 <dt>
    				  <strong>CRM客户管理系统</strong>
    				  <em>Customer Relationship Management System</em>
    			 </dt>
    				 <dd class="user_icon">
    				  <input id="uname" type="text" placeholder="账号" class="login_txtbx"/>
    				 </dd>
    				 <dd class="pwd_icon">
    				  <input id="upass" type="password" placeholder="密码" class="login_txtbx"/>
    				 </dd>
    				 <dd class="val_icon">
    					  <div class="checkcode">
    					    <input type="text" id="J_codetext" placeholder="验证码" maxlength="4" class="login_txtbx">
    					    <canvas class="J_codeimg" id="myCanvas" οnclick="createCode()">对不起,您的浏览器不支持,请下载最新版浏览器!</canvas>
    					  </div>
    				 	 <input type="button" value="换一张" class="ver_btn" onClick="validate();"> 
    				 </dd>
    				 <dd>
    				 	 <input type="button" value="立即登陆" class="submit_btn"/>
    				 </dd>
    				 <dd>
    				<p>©2016  版权归个人所有 翻版必究 </p>
    				<p>CREATE BY LauKei</p>
    				 </dd>
    			</dl>
    		</body>
    	</html>



    本代码是自己第一次写的,有什么问题请指出!未经允许禁止转载。















    展开全文
  • crm代码评审学习

    2017-10-27 14:52:40
    一 关于业务代码评审有感 最近在看组织代码评审的时候,发现还是很多值得总结的地方。  1 缺乏校验:  新人对边界缺乏必要校验  2. 过渡校验:防卫性编程。  本身项目是分了层的,比如web工程,到家有自由...

     一 关于业务代码评审有感

    最近在看组织代码评审的时候,发现还是很多值得总结的地方。

        1 缺乏校验:

          新人对边界缺乏必要校验

      2. 过渡校验:防卫性编程。

        本身项目是分了层的,比如web工程,到家有自由框架dwf.有controller,中间是service,当然service也可能包含了rpc的调用其他依赖的服务。

       底层dao。  也是防卫性编程,前面一层都做了入口校验,中间的service还要在校验。内部调用都不放心,导致真正的业务逻辑占比不大,

    估计有1/3左右做各种校验及逻辑判断。

       简单的可以把检验抽出一个方法。这样以只关心核心业务逻辑、

    当然team内可以开发一套公用的组件。基于注解的方式,去校验非空,长度,值大小等等。这样最好了,

    3. 异常处理:

       前面说的校验本身各种校验不过会返回异常,参数多的话,这块会一大块代码,简化后会好很多。

       另外,业务内部出现异常时,有的就层层抛异常。

      还是要关注下,自己不去保存好现场,抛出异常给上级调用,调用者也容易晕,尽量的少传递错误,少去做兼容,

    及时停止,返回异常。

      另外就是异常的处理流程本身:关键异常有没有捕获,文件打开关闭,流的关闭,超时设置等等、

    4. 编程规范:

       命名,缩进,大括号使用等等。。。

       

    *****************************************

    多说两句:

    1 。项目管理平台接入sonar,提测时自动检测。

        这个需要摸索,有时候sonar统计不准,单元测试覆盖率就容易出问题。

    2. 还是推荐阿里的编码规范。

      

    展开全文
  • 02crm代码托管码云

    2020-04-29 08:35:58
    1.搭好框架后将代码进行代码托管 1.idea安装gitee码云的插件 2.安装好插件后从idea登录码云 3.随便写点什么进行提交 4.提交完成后若要更新先push

    1.搭好框架后将代码进行代码托管

    1.idea安装gitee码云的插件

    9ISFlD2AyRxoXLr
    2.安装好插件后从idea登录码云
    HzvYckfM2TWVaru
    3.随便写点什么进行提交
    xfKPyBhNQIkodqZ

    4.提交完成后若要更新先push
    Ob2PZ8HUktaeyAD

    展开全文
  • crm代码片段

    2013-05-29 10:17:43
    using Microsoft.Crm.Sdk.Messages; using System.IO; namespace ZLCRM.PersonalPlugin.Plugin.SystemManage {  public class PluginPersonalCustom : IPlugin  {  private const string ENTITY_...

    using Microsoft.Xrm.Sdk;
    using Microsoft.Xrm.Sdk.Query;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using ZLCRM.PersonalPlugin.Bll.SystemManage;
    using ZLCRM.PersonalPlugin.Common;
    using Microsoft.Crm.Sdk.Messages;
    using System.IO;

    namespace ZLCRM.PersonalPlugin.Plugin.SystemManage
    {

        public class PluginPersonalCustom : IPlugin
        {
            private const string ENTITY_NAME = "*_personal_custom"; //个人客户实体名称 

            public void Execute(IServiceProvider serviceProvider)
            {
                IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
                IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                IOrganizationService adminOrgService = factory.CreateOrganizationService(context.UserId);

                if (context.MessageName == "Create")
                {
                    if (context.PrimaryEntityName != ENTITY_NAME)
                    {
                        return;
                    }

                    #region Create
                    if (context.Stage == 20)  //操作前 
                    {
                        Entity personalEntity = context.InputParameters["Target"] as Entity;
                        QueryExpression queryUserList = new QueryExpression("systemuser");
                        queryUserList.ColumnSet = new ColumnSet("systemuserid");
                        queryUserList.Criteria = new FilterExpression();
                        queryUserList.Criteria.AddCondition("*_personal_custom_sale_flag", ConditionOperator.Equal, true);  //标记
                        Guid countId = personalEntity.GetAttributeValue<EntityReference>("*_city_custom").Id;
                        //用户
                        LinkEntity linkbussinessunit = new LinkEntity("systemuser", "businessunit", "businessunitid", "businessunitid", JoinOperator.Inner);
                        linkbussinessunit.LinkCriteria = new FilterExpression();
                        linkbussinessunit.LinkCriteria.AddCondition("*_city", ConditionOperator.Equal, countId);  //取得城市id
                        linkbussinessunit.EntityAlias = "bu";
                        queryUserList.LinkEntities.Add(linkbussinessunit);

                        EntityCollection systemUserEntityList = adminOrgService.RetrieveMultiple(queryUserList);
                        List<Guid> sysUserList = new List<Guid>();

                        if (systemUserEntityList.Entities.Count != 0)
                        {
                            int rdmVal = new Random().Next(0, systemUserEntityList.Entities.Count);

                            Entity checkuser = systemUserEntityList.Entities[rdmVal];
                            Guid userid = new Guid(checkuser["systemuserid"].ToString());

                            personalEntity["ownerid"] = new EntityReference("systemuser", userid);
                            context.InputParameters["Target"] = personalEntity;

                        }
                     }

                    }
                    #endregion


                }

            }
        }
    }

    (目的是导入数据Execl前把ownerid随机分派给从城市属性字段做标记的ownerid,简明说就是随机分派,在做随机分派的时候会有大数据的验证,验证证明数据量越大,平均分派的可能性就会大很多 )

    展开全文
  • Created by Wang, Jerry, last modified on Jan 05, 2017 ...Jerry uses tcode CODE_SCANNER to perform a source code scan with key word “COMM_PRODUCT” on 4599 CRM packages in AG3/001. There are tot...
  • crm系统代码系统代码系统代码crm系统代码系统代码系统代码
  • crm 项目实现代码

    2011-09-22 10:49:19
    crm 代码实现的源码,使用的是 SSH 框架技术,值得一看。。。
  • crm开源代码crm源码Customer Relationship Management (CRM) solutions have, for years, been a very effective tool for attracting new prospects, increasing sales, and building better relationships with ...
  • crm通过代码添加按钮

    2018-06-22 13:26:54
    crm通过代码添加按钮,给窗体,列表添加按钮 crm通过代码添加按钮,给窗体,列表添加按钮 crm通过代码添加按钮,给窗体,列表添加按钮
  • 小黄豆CRM代码

    2018-01-18 15:56:13
    小黄豆CRM代码,c#源代码,CRM,使用asp.net 技术,前端使用js. 源代码版本:小黄豆CRM+v1.17.2.1116
  • CRM相关代码

    2019-09-27 03:29:39
    0|1CRM目录结构 from django.shortcuts import HttpResponse,render,redirect from django.conf.urls import url from django.utils.safestring import mark_safe from django.urls import reverse ...
  • linux crm部署代码详解

    2020-09-14 21:29:18
    在本篇文章里小编给大家分享了关于linux crm部署流程代码,需要的朋友们可以学习下。
  • Extjs版本CRM完整代码

    2012-02-26 22:46:09
    Extjs版本CRM完整代码
  • 用友TurboCRM代码

    2013-12-27 11:36:31
    用友TurboCRM代码 不可能直接运行,须在安装TurboCRM之后替换,版本7.2_sp4
  • dotnet crm代码

    2014-11-08 23:15:16
    挺好的crm源码 vs2010+sql2005
  • CRM开源代码

    2011-11-03 15:15:30
    主要功能:客服信息管理,客户信息列表,公开客户信息,公开联系人活动信息管理,活动信息列表,公开活动信息,进货,进货相信,库存管理销售,销售列表,销售分析,客户价值分析,服务构成分析等........
  • 悟空CRM开源代码

    2015-07-21 15:44:43
    悟空CRM系统是一款开源免费的通用企业客户关系管理平台软件,采用先进的LAMP架构,具有良好的开放性、可扩展性、安全性和透明性;我们以CRM理念为基础,结合中国中小型企的特点与现状,调查了解各行业的需求,悟出了...
  • 北风网CRM代码

    2013-10-07 18:25:24
    北风网CRM代码,其中的95%的代码和厉风行老师讲解的一样(包括变量的命名和数据库的字段),都是自己看视频然后敲到出来的。
  • CRM 开元代码 C# mvc

    2013-09-24 14:10:01
    CRM-开源代码 支持C# win7,window 2008等环境下
  • Java访问微软CRM2011的示例代码
  • 简单CRM代码

    2013-04-20 10:23:06
    使用.NET 及C# SQL2008数据库完成简单CRM网上订单系统
  • 达内CRM代码PPT

    2008-04-24 17:39:14
    达内CRM代码PPT
  • sugarcrm_dev:SugarCRM CE源代码
  • 北大青鸟 CRM代码

    2012-05-14 22:52:10
    CSDN中的同类文档,只是demo用的静态html,这个是实现的源代码
  • CRM项目源代码

    2014-06-27 18:52:11
    JavaCRM项目用的Myeclipse开发
  • CRM系统 源代码

    热门讨论 2012-06-21 17:14:32
    代码,欢迎各位同行分享,由于经验不足,代码仅供参考。请根据个人情况进行分享。
  • 使用eclipse实现了crm管理系统,下载后可以直接运行。
  • CRMStart:CRM项目源代码

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 2,916
精华内容 1,166
关键字:

crm代码