| | |
| | | { |
| | | if (operType == "Add") |
| | | { |
| | | sql = @"insert into TOrganization(parent_id,org_code,org_name,lm_user,lm_date,description) |
| | | sql = @"select * from TOrganization where org_code=@organCode"; |
| | | dynamicParams.Add("@organCode", organCode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "新增操作失败,编码重复!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | |
| | | sql = @"insert into TOrganization(parent_id,org_code,org_name,lm_user,lm_date,description) |
| | | values(@supUnit,@organCode,@organName,@Operator,@CreateDate,@organType)"; |
| | | list.Add(new { str = sql, parm = new { supUnit = supUnit, organCode= organCode, organName= organName, Operator= Operator, CreateDate= DateTime.Now.ToString(), organType= organType } }); |
| | | //sql = @"update T_CodeRules set value=@cunm2 where rightcode=@RightCode"; |
| | |
| | | { |
| | | if (OperType == "Add") |
| | | { |
| | | var sql0 = @"select * from TUser where usercode=@UserCode"; |
| | | dynamicParams.Add("@UserCode", UserCode); |
| | | var data = DapperHelper.selectdata(sql0, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "新增操作失败,编码重复!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | |
| | | var sql = @"insert into TUser(usercode,username,password,enable,mobile,lm_date,email,lm_user,stu_torgcode,wagetype,usergroup_code) |
| | | values(@UserCode,@UserName,@password,@Enable,@Mobile,@CreateDate,@Email,@Operator,@StuOrg,@wagetype,@groupcode)"; |
| | | dynamicParams.Add("@UserCode", UserCode); |
| | |
| | | //循环写入用户组表 |
| | | for (int i = 0; i < json.Count; i++) |
| | | { |
| | | var sql0 = @"select * from TGroup where group_code=@group_code"; |
| | | dynamicParams.Add("@group_code", json[i].code); |
| | | var data = DapperHelper.selectdata(sql0, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "操作失败,编码重复!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | sql = @"insert into TGroup(group_code,group_name,description,lm_user,lm_date) values(@groupcode,@groupename,@description,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | { |
| | |
| | | //循环写入角色类型表 |
| | | for (int i = 0; i < json.Count; i++) |
| | | { |
| | | var sql0 = @"select * from TRoleType where roletype_code=@roletype_code"; |
| | | dynamicParams.Add("@roletype_code", json[i].code); |
| | | var data = DapperHelper.selectdata(sql0, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "操作失败,编码重复!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | sql = @"insert into TRoleType(roletype_code,roletype_name) values(@roletypecode,@roletypename)"; |
| | | list.Add(new |
| | | { |
| | |
| | | } |
| | | if (CreateUser != "" && CreateUser != null) |
| | | { |
| | | search += "and A.lm_user like '%'+@CreateUser+'%' "; |
| | | search += "and T.username like '%'+@CreateUser+'%' "; |
| | | dynamicParams.Add("@CreateUser", CreateUser); |
| | | } |
| | | if (search == "") |
| | |
| | | //search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select A.id,A.role_code,A.role_name,b.roletype_code,B.roletype_name,A.description,A.lm_user,A.lm_date,A.is_user,A.is_right |
| | | var sql = @"select A.id,A.role_code,A.role_name,b.roletype_code,B.roletype_name,A.description,T.username as lm_user,A.lm_date,A.is_user,A.is_right |
| | | from TRole A |
| | | left join TRoleType B on A.roletype_code=B.roletype_code |
| | | left join TUser T on A.lm_user=T.usercode |
| | | where A.is_delete<>'1' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | |
| | | { |
| | | if (OperType == "Add") |
| | | { |
| | | var sql0 = @"select * from TRole where role_code=@role_code"; |
| | | dynamicParams.Add("@role_code", RoleCode); |
| | | var data = DapperHelper.selectdata(sql0, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "操作失败,编码重复!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | var sql = @"insert into TRole(role_code,role_name,lm_user,lm_date,roletype_code,description) |
| | | values(@RoleCode,@RoleName,@Usercode,@CreateDate,@RoleTypeCode,@description)"; |
| | | dynamicParams.Add("@RoleCode", RoleCode); |
| | |
| | | { |
| | | if (cuntUnitCode != "" && cuntUnitCode != null) |
| | | { |
| | | search += "and code like '%'+@cuntUnitCode+'%' "; |
| | | search += "and A.code like '%'+@cuntUnitCode+'%' "; |
| | | dynamicParams.Add("@cuntUnitCode", cuntUnitCode); |
| | | } |
| | | if (cuntUnitName != "" && cuntUnitName != null) |
| | | { |
| | | search += "and name like '%'+@cuntUnitName+'%' "; |
| | | search += "and A.name like '%'+@cuntUnitName+'%' "; |
| | | dynamicParams.Add("@cuntUnitName", cuntUnitName); |
| | | } |
| | | if (unitAttr != "" && unitAttr != null) |
| | |
| | | switch (unitAttr) |
| | | { |
| | | case "WG": //外购 |
| | | search += "and mtype=@unitAttr "; |
| | | search += "and A.mtype=@unitAttr "; |
| | | dynamicParams.Add("@unitAttr", unitAttr); |
| | | break; |
| | | case "WX": //外协 |
| | | search += "and btype=@unitAttr "; |
| | | search += "and A.btype=@unitAttr "; |
| | | dynamicParams.Add("@unitAttr", unitAttr); |
| | | break; |
| | | default: //客户 |
| | | search += "and htype=@unitAttr "; |
| | | search += "and A.htype=@unitAttr "; |
| | | dynamicParams.Add("@unitAttr", unitAttr); |
| | | break; |
| | | } |
| | | } |
| | | if (createUser != "" && createUser != null) |
| | | { |
| | | search += "and lm_user like '%'+@createUser+'%' "; |
| | | search += "and T.username like '%'+@createUser+'%' "; |
| | | dynamicParams.Add("@createUser", createUser); |
| | | } |
| | | if (search == "") |
| | |
| | | } |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select id,code,name,mtype,btype,htype,conttacts,conttphone,addr,lm_user,lm_date from TCustomer |
| | | where is_delete<>'1' " + search; |
| | | var sql = @"select A.id,A.code,A.name,A.mtype,A.btype,A.htype,A.conttacts,A.conttphone,A.addr,T.username as lm_user,A.lm_date from TCustomer A |
| | | left join TUser T on A.lm_user=T.usercode |
| | | where A.is_delete<>'1' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | |
| | | { |
| | | if (OperType == "Add") |
| | | { |
| | | var sql0 = @"select * from TCustomer where code=@code"; |
| | | dynamicParams.Add("@unitcode", unitcode); |
| | | var data = DapperHelper.selectdata(sql0, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "操作失败,编码重复!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | var sql = @"insert into TCustomer(code,name,mtype,btype,htype,conttacts,conttphone,addr,lm_user,lm_date) |
| | | values(@unitcode,@unitname,@mtypecode,@btypecode,@htypecode,@person,@contact,@description,@usercode,@CreateDate)"; |
| | | dynamicParams.Add("@unitcode", unitcode); |
| | |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //删除(更新状态)往来单位表 |
| | | sql = @"update TCustomer set is_delete='1' where code=@unitcode"; |
| | | //删除往来单位表 |
| | | sql = @"delete TCustomer where code=@unitcode"; |
| | | list.Add(new { str = sql, parm = new { unitcode = unitcode } }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |