SystemBackDAO.xml 25.5 KB
Newer Older
罗绍泽 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754
<?xml version="1.0" encoding="UTF-8" ?>   
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">   
<mapper namespace="com.gaowj.business.system.SystemBackDAO">

	<select id="getUserAllModule" parameterType="String" resultType="upperCaseKeyMap">
	 <![CDATA[
	    select m_id from c_t_sys_group_m where g_id in (select g_id from c_t_sys_group_u where u_id=#{uid}) 
	  ]]>
	</select>
	
	<select id="getTopMenu" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	select * from  c_t_sys_module_type where mt_id in(select distinct mt_id from c_t_sys_module where m_id in(${MIDS}) and m_state=0) order by mt_sort
     ]]>
	</select>
	
	<select id="getLeftMenu1" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	select distinct m_menu from c_t_sys_module where m_id in(${MIDS}) and mt_id=#{MTID} and m_state=0
     ]]>
	</select>
	
	<select id="getLeftMenu2" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	   select * from c_t_sys_module 
	   where 1=1 and m_state=0 
     ]]>
     <if test="MIDS != null and MIDS != ''">
      and m_id in (${MIDS})
     </if>
     <if test="MTID != null and MTID != ''">
      and mt_id = #{MTID}
     </if>
     <if test="MENU1 != null and MENU1 != ''">
      and m_menu = #{MENU1}
     </if>
     order by m_sort 
	</select>
	
	<insert id="insert_user" parameterType="map">
	      insert into c_t_sys_loginuser(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="CODE != null ">CODE, </if>
	         <if test="EMID != null ">EMID, </if>
             <if test="EMPASS != null ">EMPASS, </if>
             <if test="EMDEPART != null ">EMDEPART, </if>
             <if test="EMNAME != null ">EMNAME , </if>
             <if test="EMSEX != null ">EMSEX , </if>
             <if test="EMAIL != null ">EMAIL , </if>
             <if test="REGDATE != null ">REGDATE , </if>
             <if test="O_ENABLE != null ">O_ENABLE , </if>
             <if test="W_ENABLE != null ">W_ENABLE , </if>
             <if test="TYPE != null ">TYPE , </if>
             <if test="STATE != null ">STATE , </if>
             <if test="ID_CODE != null ">ID_CODE , </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="CODE != null ">#{CODE}, </if>
	         <if test="EMID != null ">#{EMID}, </if>
             <if test="EMPASS != null ">#{EMPASS}, </if>
             <if test="EMDEPART != null ">#{EMDEPART}, </if>
             <if test="EMNAME != null ">#{EMNAME} , </if>
             <if test="EMSEX != null ">#{EMSEX} , </if>
             <if test="EMAIL != null ">#{EMAIL} , </if>
             <if test="REGDATE != null ">#{REGDATE} , </if>
             <if test="O_ENABLE != null ">#{O_ENABLE} , </if>
             <if test="W_ENABLE != null ">#{W_ENABLE} , </if>
             <if test="TYPE != null ">#{TYPE} , </if>
             <if test="STATE != null ">#{STATE} , </if>
             <if test="ID_CODE != null ">#{ID_CODE} , </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
 
 	<update id="update_user" parameterType="map">
	   update c_t_sys_loginuser  
	    <set> 
	         <if test="EMID != null ">EMID = #{EMID}, </if>
             <if test="EMPASS != null ">EMPASS = #{EMPASS}, </if>
             <if test="EMDEPART != null ">EMDEPART = #{EMDEPART}, </if>
             <if test="EMNAME != null ">EMNAME = #{EMNAME} , </if>
             <if test="EMSEX != null ">EMSEX = #{EMSEX} , </if>
             <if test="EMAIL != null ">EMAIL = #{EMAIL} , </if>
             <if test="REGDATE != null ">REGDATE = #{REGDATE} , </if>
             <if test="O_ENABLE != null ">O_ENABLE = #{O_ENABLE} , </if>
             <if test="W_ENABLE != null ">W_ENABLE = #{W_ENABLE} , </if>
             <if test="TYPE != null ">TYPE = #{TYPE} , </if>
             <if test="STATE != null ">STATE = #{STATE} , </if>
             <if test="ID_CODE != null ">ID_CODE = #{ID_CODE} , </if>
	    </set>
         where CODE = #{CODE} 
 	</update>
 	
 	<update id="delete_user" parameterType="map">
	 <![CDATA[
	delete from c_t_sys_loginuser 
	  ]]>
	  <where>
	    <if test="CODE != null and CODE != ''">
	      and code = #{CODE} 
	    </if>
	    <if test="EMID != null and EMID != ''">
	      and emid = #{EMID}
	    </if>
	  </where> 
 	</update>
	
	<select id="listLoginUserInfo" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	   select u.*,d.dpt_name emdepartname,(select max(opetime) from c_t_sys_loginlog where code=u.code) beforetime,
	   (select count(1) from c_t_sys_group_u gu where gu.u_id=u.emid) ysy 
	   from c_t_sys_loginuser u left 
	   join c_t_sys_department d on d.dpt_no = u.emdepart 
	   where 1=1  
     ]]>
     <if test="EMID != null and EMID != ''">
      and u.emid = #{EMID}
     </if>
     <if test="EMPASS != null and EMPASS != ''">
      and u.empass = #{EMPASS}
     </if>
     <if test="CODE != null and CODE != ''">
      and u.code = #{CODE}
     </if>
	</select>
	
	<select id="listLoginUserInfoCount" parameterType="map" resultType="int">
	 <![CDATA[
	   select count(*) c 
	   from c_t_sys_loginuser u left 
	   join c_t_sys_department d on d.dpt_no = u.emdepart 
	   where 1=1  
     ]]>
     <if test="EMID != null and EMID != ''">
      and u.emid = #{EMID}
     </if>
     <if test="EMPASS != null and EMPASS != ''">
      and u.empass = #{EMPASS}
     </if>
     <if test="CODE != null and CODE != ''">
      and u.code = #{CODE}
     </if>
	</select>
	
	<select id="getMaxLoginUserCode" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	   select max(code) maxcode from c_t_sys_loginuser where 1=1 and code like '${EMDEPART}%'
	  ]]>
	</select>
	
	<select id="getMaxLoginUserEmid" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	   select max(emid) maxemid from c_t_sys_loginuser where 1=1 and emid like '${EMDEPART}%'
	  ]]>
	</select>
	
	<select id="listDepartmentInfo" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	   select d.*,(select emname from c_t_sys_loginuser u where u.code = d.manager) managername,(select count(*) from c_t_sys_loginuser u where u.emdepart = d.dpt_no) ysy  
	   from c_t_sys_department d 
	   where 1=1 
     ]]>
     <if test="DPT_NO != null and DPT_NO != ''">
      and d.dpt_no = #{DPT_NO}
     </if>
      order by d.sort 
	</select>
	
	<select id="listDepartmentInfoCount" parameterType="map" resultType="int">
	 <![CDATA[
	   select count(*) c 
	   from c_t_sys_department d 
	   where 1=1 
     ]]>
     <if test="DPT_NO != null and DPT_NO != ''">
      and d.dpt_no = #{DPT_NO}
     </if>
	</select>
	
	<insert id="insert_depart" parameterType="map">
	      insert into c_t_sys_department(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="DPT_NO != null ">DPT_NO, </if>
	         <if test="DPT_NAME != null ">DPT_NAME, </if>
             <if test="MANAGER != null ">MANAGER, </if>
             <if test="SORT != null ">SORT, </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="DPT_NO != null ">#{DPT_NO}, </if>
	         <if test="DPT_NAME != null ">#{DPT_NAME}, </if>
             <if test="MANAGER != null ">#{MANAGER}, </if>
             <if test="SORT != null ">#{SORT}, </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
 
 	<update id="update_depart" parameterType="map">
	   update c_t_sys_department  
	    <set> 
	         <if test="DPT_NAME != null ">DPT_NAME = #{DPT_NAME}, </if>
             <if test="MANAGER != null ">MANAGER = #{MANAGER}, </if>
             <if test="SORT != null ">SORT = #{SORT}, </if>
	    </set>
         where DPT_NO = #{DPT_NO} 
 	</update>
 	
 	<update id="delete_depart" parameterType="map">
	 <![CDATA[
	delete from c_t_sys_department 
	  ]]>
	  <where>
	    <if test="DPT_NO != null and DPT_NO != ''">
	      and dpt_no = #{DPT_NO} 
	    </if>
	  </where> 
 	</update>
	
	<update id="modifyPass" parameterType="map">
	 <![CDATA[
	     update c_t_sys_loginuser set empass=#{EMPASS} where code=#{CODE}
	  ]]> 
 	</update>
	
	
	
	<select id="listGroupAll" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	    select t.*,(select count(*) from c_t_sys_group_m t1 where t1.g_id=t.g_id) msy,
	    (select count(*) from c_t_sys_group_u t2 where t2.g_id=t.g_id) usy  from c_t_sys_group t  
		where 1=1
	  ]]> 
		<if test="G_ID != null and G_ID != ''">
	    and  t.g_id = #{G_ID}
		</if>
		<if test="G_STATE != null and G_STATE != ''">
	    and  t.g_state = #{G_STATE}
		</if>
		order by t.g_sort
	</select>
 
	<select id="listGroupAllCount" parameterType="map" resultType="int">
	 <![CDATA[
	   select count(1) c from c_t_sys_group t 
		where 1=1
	  ]]> 
		<if test="G_ID != null and G_ID != ''">
	    and  t.g_id = #{G_ID}
		</if>
		<if test="G_STATE != null and G_STATE != ''">
	    and  t.g_state = #{G_STATE}
		</if>
	</select>
	
	<insert id="insert_group" parameterType="map">
	      insert into c_t_sys_group(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="G_ID != null ">G_ID, </if>
	         <if test="G_NAME != null ">G_NAME, </if>
             <if test="G_TITLE != null ">G_TITLE, </if>
             <if test="G_SORT != null ">G_SORT, </if>
             <if test="G_STATE != null ">G_STATE , </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="G_ID != null ">#{G_ID}, </if>
	         <if test="G_NAME != null ">#{G_NAME}, </if>
             <if test="G_TITLE != null ">#{G_TITLE}, </if>
             <if test="G_SORT != null ">#{G_SORT}, </if>
             <if test="G_STATE != null ">#{G_STATE}, </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
 
 	<update id="update_group" parameterType="map">
	   update c_t_sys_group  
	    <set> 
	         <if test="G_NAME != null ">G_NAME = #{G_NAME}, </if>
             <if test="G_TITLE != null ">G_TITLE = #{G_TITLE}, </if>
             <if test="G_SORT != null ">G_SORT = #{G_SORT}, </if>
             <if test="G_STATE != null ">G_STATE = #{G_STATE}, </if>
	    </set>
         where G_ID = #{G_ID} 
 	</update>
 	
 	<update id="delete_group" parameterType="String">
	 <![CDATA[
	delete from c_t_sys_group 
		where G_ID = #{G_ID} 
	  ]]> 
 	</update>
 	
 	<select id="listGroupM_from_G" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
 	     select m.m_id,m.m_name from c_t_sys_group_m gm,c_t_sys_module m 
 	     where 1=1 and gm.m_id=m.m_id
	  ]]>
	  <if test="G_ID != null and G_ID != ''">
	    and  gm.g_id = #{G_ID}
	  </if>
	  <if test="M_ID != null and M_ID != ''">
	    and  gm.m_id = #{M_ID}
	  </if>
	</select>
	
	<select id="listModuleType" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	  select mt.*,(select count(1) c from c_t_sys_module m  where m.mt_id=mt.mt_id) ysy from  c_t_sys_module_type mt where 1=1 
     ]]>
	    <if test="MT_ID != null and MT_ID != ''">
	      and mt.mt_id = #{MT_ID} 
	    </if>
	  order by mt.mt_sort
	</select>
	<select id="listModuleTypeCount" parameterType="map" resultType="int">
	 <![CDATA[
	   select count(1) c from c_t_sys_module_type where 1=1 
	  ]]>
	    <if test="MT_ID != null and MT_ID != ''">
	      and mt_id = #{MT_ID} 
	    </if> 
	</select>
	<insert id="insert_moduleType" parameterType="map">
	      insert into c_t_sys_module_type(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="MT_ID != null ">MT_ID, </if>
	         <if test="MT_NAME != null ">MT_NAME, </if>
             <if test="MT_TITLE != null ">MT_TITLE, </if>
             <if test="MT_SORT != null ">MT_SORT, </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="MT_ID != null ">#{MT_ID}, </if>
	         <if test="MT_NAME != null ">#{MT_NAME}, </if>
             <if test="MT_TITLE != null ">#{MT_TITLE}, </if>
             <if test="MT_SORT != null ">#{MT_SORT}, </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
 
 	<update id="update_moduleType" parameterType="map">
	   update c_t_sys_module_type  
	    <set> 
	         <if test="MT_ID != null ">MT_ID = #{MT_ID}, </if>
             <if test="MT_NAME != null ">MT_NAME = #{MT_NAME}, </if>
             <if test="MT_TITLE != null ">MT_TITLE = #{MT_TITLE}, </if>
             <if test="MT_SORT != null ">MT_SORT = #{MT_SORT} , </if>
	    </set>
         where MT_ID = #{MT_ID}
 	</update>
 	
 	<update id="delete_moduleType" parameterType="map">
	 <![CDATA[
	delete from c_t_sys_module_type 
	  ]]>
	  <where>
	    <if test="MT_ID != null and MT_ID != ''">
	      and mt_id = #{MT_ID} 
	    </if>
	  </where> 
 	</update>
	
	<select id="listModule" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	   select m.*,(select mt.mt_name from c_t_sys_module_type mt where mt.mt_id=m.mt_id) mt_name,(select count(1) c from c_t_sys_group_m gm  where m.m_id=gm.m_id) ysy from c_t_sys_module m where 1=1  
     ]]>
      <if test="MT_ID != null and MT_ID != ''">
	    and  m.mt_id = #{MT_ID}
	  </if>
	  <if test="M_ID != null and M_ID != ''">
	      and m.m_id = #{M_ID} 
	  </if>
	  <if test="M_STATE != null and M_STATE != ''">
	      and m.m_state = #{M_STATE} 
	  </if>
     order by m.mt_id,m.m_menu,m.m_sort 
	</select>
	<select id="listModuleCount" parameterType="map" resultType="int">
	 <![CDATA[
	   select count(1) c from c_t_sys_module where 1=1 and m_state=0
	  ]]>
	  <if test="MT_ID != null and MT_ID != ''">
	    and  mt_id = #{MT_ID}
	  </if> 
	  <if test="M_ID != null and M_ID != ''">
	      and m_id = #{M_ID} 
	  </if>
	  <if test="M_STATE != null and M_STATE != ''">
	      and m.m_state = #{M_STATE} 
	  </if>
	</select>
	
	<insert id="insert_module" parameterType="map">
	      insert into c_t_sys_module(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="M_ID != null ">M_ID, </if>
             <if test="M_NAME != null ">M_NAME, </if>
             <if test="M_TITLE != null ">M_TITLE, </if>
             <if test="M_SORT != null ">M_SORT , </if>
             <if test="MT_ID != null ">MT_ID , </if>
             <if test="M_MENU != null ">M_MENU , </if>
             <if test="M_STATE != null ">M_STATE , </if>
             <if test="WINDOWNAME_WEB != null ">WINDOWNAME_WEB , </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="M_ID != null ">#{M_ID}, </if>
             <if test="M_NAME != null ">#{M_NAME}, </if>
             <if test="M_TITLE != null ">#{M_TITLE}, </if>
             <if test="M_SORT != null ">#{M_SORT} , </if>
             <if test="MT_ID != null ">#{MT_ID} , </if>
             <if test="M_MENU != null ">#{M_MENU} , </if>
             <if test="M_STATE != null ">#{M_STATE} , </if>
             <if test="WINDOWNAME_WEB != null ">#{WINDOWNAME_WEB} , </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
 
 	<update id="update_module" parameterType="map">
	   update c_t_sys_module  
	    <set> 
             <if test="M_NAME != null ">M_NAME = #{M_NAME}, </if>
             <if test="M_TITLE != null ">M_TITLE = #{M_TITLE}, </if>
             <if test="M_SORT != null ">M_SORT = #{M_SORT} , </if>
             <if test="MT_ID != null ">MT_ID = #{MT_ID} , </if>
             <if test="M_MENU != null ">M_MENU = #{M_MENU} , </if>
             <if test="M_STATE != null ">M_STATE = #{M_STATE} , </if>
             <if test="WINDOWNAME_WEB != null ">WINDOWNAME_WEB = #{WINDOWNAME_WEB} , </if>
	    </set>
         where M_ID = #{M_ID}
 	</update>
 	
 	<update id="delete_module" parameterType="map">
	 <![CDATA[
	delete from c_t_sys_module 
	  ]]>
	  <where>
	    <if test="MT_ID != null and MT_ID != ''">
	      and mt_id = #{MT_ID} 
	    </if>
	    <if test="M_ID != null and M_ID != ''">
	      and m_id = #{M_ID} 
	    </if>
	  </where> 
 	</update>
	
	<insert id="insert_group_c_m" parameterType="map">
	      insert into c_t_sys_group_m(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="GM != null ">GM, </if>
	         <if test="G_ID != null ">G_ID, </if>
             <if test="M_ID != null ">M_ID, </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="GM != null ">#{GM}, </if>
	         <if test="G_ID != null ">#{G_ID}, </if>
             <if test="M_ID != null ">#{M_ID}, </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
 	
 	<update id="delete_group_c_m" parameterType="map">
	 <![CDATA[
	delete from c_t_sys_group_m  
	  ]]> 
	  <where>
	    <if test="GM != null and GM != ''">
	    and  gm = #{GM}
	    </if>
	    <if test="G_ID != null and G_ID != ''">
	    and  g_id = #{G_ID}
	  </if>
	  </where>
 	</update>
 	
 	<select id="getMaxGm" parameterType="map" resultType="int">
	 <![CDATA[
	   select max(gm) maxgm from c_t_sys_group_m where 1=1 
	  ]]>
	</select>
	
	
	<!-- 角色组/功能组选人 -->
	<select id="listGroupU_from_G" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
 	     select e.code,e.emname,e.emdepart,e.emid from c_t_sys_group_u gu,c_t_sys_loginuser e 
 	     where 1=1 and gu.u_id=e.emid
	  ]]>
	  <if test="G_ID != null and G_ID != ''">
	    and  gu.g_id = #{G_ID}
	  </if>
	  <if test="U_ID != null and U_ID != ''">
	    and  gu.u_id = #{U_ID}
	  </if>
	</select>

	<insert id="insert_group_c_u" parameterType="map">
	      insert into c_t_sys_group_u(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="GU != null ">GU, </if>
	         <if test="G_ID != null ">G_ID, </if>
             <if test="U_ID != null ">U_ID, </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="GU != null ">#{GU}, </if>
	         <if test="G_ID != null ">#{G_ID}, </if>
             <if test="U_ID != null ">#{U_ID}, </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
 	
 	<update id="delete_group_c_u" parameterType="map">
	 <![CDATA[
	delete from c_t_sys_group_u  
	  ]]> 
	  <where>
	    <if test="GM != null and GM != ''">
	    and  gu = #{GU}
	    </if>
	    <if test="G_ID != null and G_ID != ''">
	    and  g_id = #{G_ID}
	  </if>
	  </where>
 	</update>
 	
 	<select id="getMaxGu" parameterType="map" resultType="int">
	 <![CDATA[
	   select max(gu) maxgu from c_t_sys_group_u where 1=1 
	  ]]>
	</select>
	
	<!-- 人管人查询 -->
	<select id="listPerson_from_P" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
 	     select * from c_t_sys_person 
 	     where 1=1 
	  ]]>
	  <if test="QXLX != null and QXLX != ''">
	    and  qxlx = #{QXLX}
	  </if>
	  <if test="GUANLI != null and GUANLI != ''">
	    and  guanli = #{GUANLI}
	  </if>
	  <if test="BEIGUANLI != null and BEIGUANLI != ''">
	    and  beiguanli = #{BEIGUANLI}
	  </if>
	  <if test="SETTING != null and SETTING != ''">
	    and  setting = #{SETTING}
	  </if>
	</select>
	
	<insert id="insert_person_p" parameterType="map">
	      insert into c_t_sys_person(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="QXLX != null ">QXLX, </if>
	         <if test="GUANLI != null ">GUANLI, </if>
             <if test="BEIGUANLI != null ">BEIGUANLI, </if>
             <if test="SETTING != null ">SETTING, </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="QXLX != null ">#{QXLX}, </if>
	         <if test="GUANLI != null ">#{GUANLI}, </if>
             <if test="BEIGUANLI != null ">#{BEIGUANLI}, </if>
             <if test="SETTING != null ">#{SETTING}, </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
 	
 	<update id="delete_person_p" parameterType="map">
	 <![CDATA[
	delete from c_t_sys_person  
	  ]]> 
	  <where>
	    <if test="QXLX != null and QXLX != ''">
	      and  qxlx = #{QXLX}
	    </if>
	    <if test="GUANLI != null and GUANLI != ''">
	      and  guanli = #{GUANLI}
	    </if>
	    <if test="BEIGUANLI != null and BEIGUANLI != ''">
	      and  beiguanli = #{BEIGUANLI}
	    </if>
	    <if test="SETTING != null and SETTING != ''">
	      and  setting = #{SETTING}
	    </if>
	  </where>
 	</update>
 	<!-- 日志信息 -->
 	<select id="listLogInfo" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	   select * 
	   from c_t_sys_loginlog log 
	   where 1=1 
     ]]>
     <if test="BEGIN_DATE != null and BEGIN_DATE != ''">
	    and  log.opetime &gt;= #{BEGIN_DATE} 
	 </if>
	 <if test="END_DATE != null and END_DATE != ''">
	    and  log.opetime &lt;= #{END_DATE} 
	 </if>
	 <if test="NAME != null and NAME != ''">
	    and log.code in (select l.code from c_t_sys_loginuser l where l.code like '${NAME}%' or l.emname like '${NAME}%')
	 </if>
	 <if test="EMIP != null and EMIP != ''">
	    and log.emIP like '${EMIP}%'
	 </if>
      order by log.opetime desc 
	</select>
	
	<select id="listLogInfoCount" parameterType="map" resultType="int">
	 <![CDATA[
	   select count(*) c 
	   from c_t_sys_loginlog log 
	   where 1=1 
     ]]>
     <if test="BEGIN_DATE != null and BEGIN_DATE != ''">
	    and  log.opetime &gt;= #{BEGIN_DATE} 
	 </if>
	 <if test="END_DATE != null and END_DATE != ''">
	    and  log.opetime &lt;= #{END_DATE} 
	 </if>
	 <if test="NAME != null and NAME != ''">
	    and log.code in (select l.code from c_t_sys_loginuser l where l.code like '${NAME}%' or l.emname like '${NAME}%')
	 </if>
	 <if test="EMIP != null and EMIP != ''">
	    and log.emIP like '${EMIP}%'
	 </if>
	</select>
	
	<insert id="insert_log" parameterType="map">
	      insert into c_t_sys_loginlog(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="ID != null ">ID, </if>
	         <if test="CODE != null ">CODE, </if>
             <if test="EMNAME != null ">EMNAME, </if>
             <if test="EMIP != null ">EMIP, </if>
             <if test="OPENAME != null ">OPENAME , </if>
             <if test="OPETIME != null ">OPETIME , </if>
             <if test="TYPE != null ">TYPE , </if>
             <if test="OPETYPE != null ">OPETYPE , </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="ID != null ">#{ID}, </if>
	         <if test="CODE != null ">#{CODE}, </if>
             <if test="EMNAME != null ">#{EMNAME}, </if>
             <if test="EMIP != null ">#{EMIP}, </if>
             <if test="OPENAME != null ">#{OPENAME} , </if>
             <if test="OPETIME != null ">#{OPETIME} , </if>
             <if test="TYPE != null ">#{TYPE} , </if>
             <if test="OPETYPE != null ">#{OPETYPE} , </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
	<select id="getMaxLog" parameterType="map" resultType="int">
	 <![CDATA[
	   select max(id) maxid from c_t_sys_loginlog where 1=1 
	  ]]>
	</select>
	<!--log4j 日志信息 -->
	<select id="listLog4jInfo" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	   select * 
	   from c_t_sys_log4jinfo log4j 
	   where 1=1 
     ]]>
     <if test="BEGIN_DATE != null and BEGIN_DATE != ''">
	    and  log4j.logdate &gt;= #{BEGIN_DATE} 
	 </if>
	 <if test="END_DATE != null and END_DATE != ''">
	    and  log4j.logdate &lt;= #{END_DATE} 
	 </if>
	 <if test="USERINFO != null and USERINFO != ''">
	    and log4j.userinfo in like '${USERINFO}' 
	 </if>
	 <if test="LOGLEVEL != null and LOGLEVEL != ''">
	    and log4j.loglevel = #{LOGLEVEL} 
	 </if>
      order by log4j.logdate desc 
	</select>
	
	<select id="listLog4jInfoCount" parameterType="map" resultType="int">
	 <![CDATA[
	   select count(*) c 
	   from c_t_sys_log4jinfo log4j 
	   where 1=1 
     ]]>
     <if test="BEGIN_DATE != null and BEGIN_DATE != ''">
	    and  log4j.logdate &gt;= #{BEGIN_DATE} 
	 </if>
	 <if test="END_DATE != null and END_DATE != ''">
	    and  log4j.logdate &lt;= #{END_DATE} 
	 </if>
	 <if test="USERINFO != null and USERINFO != ''">
	    and log4j.userinfo in like '${USERINFO}' 
	 </if>
	 <if test="LOGLEVEL != null and LOGLEVEL != ''">
	    and log4j.loglevel = #{LOGLEVEL} 
	 </if>
	</select>
	
	<insert id="insert_log4j" parameterType="map">
	      insert into c_t_sys_log4jinfo(
	      <trim prefix=""  suffixOverrides=",">
	         <if test="ID != null ">ID, </if>
	         <if test="LOGDATE != null ">LOGDATE, </if>
             <if test="LOGTHREAD != null ">LOGTHREAD, </if>
             <if test="LOGLEVEL != null ">LOGLEVEL, </if>
             <if test="LOGCATEGORY != null ">LOGCATEGORY , </if>
             <if test="LOGLOCATION != null ">LOGLOCATION , </if>
             <if test="LOGMESSAGE != null ">LOGMESSAGE , </if>
             <if test="USERINFO != null ">USERINFO , </if>
             <if test="CLIENTINFO != null ">CLIENTINFO , </if>
             <if test="SERVERINFO != null ">SERVERINFO , </if>
             <if test="LOGTHROWABLE != null ">LOGTHROWABLE , </if>
             <if test="LOGNDC != null ">LOGNDC , </if>
           </trim>
	    <![CDATA[ ) values( ]]> 
	       <trim prefix=""  suffixOverrides=",">
	         <if test="ID != null ">#{ID}, </if>
	         <if test="LOGDATE != null ">#{LOGDATE}, </if>
             <if test="LOGTHREAD != null ">#{LOGTHREAD}, </if>
             <if test="LOGLEVEL != null ">#{LOGLEVEL}, </if>
             <if test="LOGCATEGORY != null ">#{LOGCATEGORY} , </if>
             <if test="LOGLOCATION != null ">#{LOGLOCATION} , </if>
             <if test="LOGMESSAGE != null ">#{LOGMESSAGE} , </if>
             <if test="USERINFO != null ">#{USERINFO} , </if>
             <if test="CLIENTINFO != null ">#{CLIENTINFO} , </if>
             <if test="SERVERINFO != null ">#{SERVERINFO} , </if>
             <if test="LOGTHROWABLE != null ">#{LOGTHROWABLE} , </if>
             <if test="LOGNDC != null ">#{LOGNDC} , </if>
            </trim>
	    <![CDATA[ ) ]]> 
 	</insert>
 	
 	<update id="update_log4j" parameterType="map">
	   update c_t_sys_log4jinfo  
	    <set> 
             <if test="LOGTHROWABLE != null ">LOGTHROWABLE = #{LOGTHROWABLE}, </if>
             <if test="LOGNDC != null ">LOGNDC = #{LOGNDC}, </if>
	    </set>
         where ID = #{ID}
 	</update>
 	
	<select id="getMaxLog4j" parameterType="map" resultType="int">
	 <![CDATA[
	   select max(id) maxid from c_t_sys_log4jinfo where 1=1 
	  ]]>
	</select>
</mapper>