|
|
@@ -20,12 +20,13 @@ namespace Winsoft.GOV.Framework.Provider
|
|
|
+ "QL_NAME varchar(200),"
|
|
|
+ "QL_INNER_CODE varchar(50),"
|
|
|
+ "QL_DEP varchar(50),"
|
|
|
- + "OUGUID varchar(50)"
|
|
|
+ + "OUGUID varchar(50),"
|
|
|
+ + "QL_STATE varchar(1) DEFAULT '1'"
|
|
|
+ "); "
|
|
|
+ "call add_index('PowerMattersBase', 'index1', 'index1(QL_INNER_CODE, OUGUID)'); "
|
|
|
+ "call add_index('PowerMattersBase', 'index2', 'index2(QL_INNER_CODE)'); "
|
|
|
- + "call add_index('PowerMattersBase', 'index3', 'index3(OUGUID)'); ";
|
|
|
- //+ "call add_index('PowerMattersBase', 'index4', 'index4(QL_NAME)'); ";
|
|
|
+ + "call add_index('PowerMattersBase', 'index3', 'index3(OUGUID)'); "
|
|
|
+ + "call add_index('PowerMattersBase', 'index4', 'index4(QL_STATE, OUGUID); ";
|
|
|
using(var con = GetDbConnection())
|
|
|
{
|
|
|
con.Execute(sql);
|
|
|
@@ -55,7 +56,8 @@ namespace Winsoft.GOV.Framework.Provider
|
|
|
|
|
|
public IEnumerable<PowerMattersBase> FindByBranchGUID(string guid)
|
|
|
{
|
|
|
- string sql = "select " + cols + " from PowerMattersBase where ouguid=@guid";
|
|
|
+ //string sql = "select " + cols + " from powerMettersDetail where QL_INNER_CODE in (select QL_INNER_CODE PowerMattersBase where ouguid=@guid) and QL_STATE = '1'";
|
|
|
+ string sql = "select " + cols + " from PowerMattersBase where ouguid=@guid and QL_STATE = '1'";
|
|
|
using (IDbConnection connection = GetDbConnection())
|
|
|
{
|
|
|
return connection.Query<PowerMattersBase>(sql, new { guid = guid });
|
|
|
@@ -64,7 +66,7 @@ namespace Winsoft.GOV.Framework.Provider
|
|
|
|
|
|
public IEnumerable<PowerMattersBase> Find(string guid, string ql_kind)
|
|
|
{
|
|
|
- string sql = "select " + cols + " from powerMettersDetail where OUGUID=@guid and ql_kind = @ql_kind and QL_INNER_CODE in (SELECT QL_INNER_CODE FROM PowerMattersBase WHERE ouguid=@guid)";
|
|
|
+ string sql = "select " + cols + " from powerMettersDetail where OUGUID=@guid and ql_kind = @ql_kind and QL_INNER_CODE in (SELECT QL_INNER_CODE FROM PowerMattersBase WHERE ouguid=@guid and ql_state='1')";
|
|
|
using (IDbConnection connection = GetDbConnection())
|
|
|
{
|
|
|
return connection.Query<PowerMattersBase>(sql, new { guid = guid, ql_kind = ql_kind });
|
|
|
@@ -73,7 +75,7 @@ namespace Winsoft.GOV.Framework.Provider
|
|
|
|
|
|
public IEnumerable<PowerMattersBase> Search(string ql_name, int itemIndex, int size)
|
|
|
{
|
|
|
- string sql = "select " + cols + " from PowerMattersBase where ql_name like @ql_name";
|
|
|
+ string sql = "select " + cols + " from PowerMattersBase where ql_name like @ql_name and ql_state='1'";
|
|
|
return GetItemList(sql, itemIndex, size, new { ql_name = "%" + ql_name + "%" });
|
|
|
}
|
|
|
|
|
|
@@ -91,7 +93,7 @@ namespace Winsoft.GOV.Framework.Provider
|
|
|
{
|
|
|
string select = "select count(*) from PowerMattersBase where QL_INNER_CODE=@QL_INNER_CODE and OUGUID=@OUGUID;";
|
|
|
string update = "update PowerMattersBase set QL_NAME=@QL_NAME, QL_DEP=@QL_DEP where QL_INNER_CODE=@QL_INNER_CODE and OUGUID=@OUGUID;";
|
|
|
- string insert = "insert PowerMattersBase(QL_NAME, QL_INNER_CODE, OUGUID, QL_DEP) values(@QL_NAME, @QL_INNER_CODE, @OUGUID, @QL_DEP);";
|
|
|
+ string insert = "insert PowerMattersBase(QL_NAME, QL_INNER_CODE, OUGUID, QL_DEP, QL_STATE) values(@QL_NAME, @QL_INNER_CODE, @OUGUID, @QL_DEP, @QL_STATE);";
|
|
|
|
|
|
using (var conn = GetDbConnection())
|
|
|
{
|
|
|
@@ -115,56 +117,21 @@ namespace Winsoft.GOV.Framework.Provider
|
|
|
|
|
|
public void Update(PowerMattersBase p)
|
|
|
{
|
|
|
- //const string sql = "UPDATE `powermettersbase` "
|
|
|
- // + "SET "
|
|
|
- // + "`QL_MAINITEM_ID` = @QL_MAINITEM_ID, "
|
|
|
- // + "`QL_SUBITEM_ID` = @QL_SUBITEM_ID, "
|
|
|
- // + "`QL_NAME` = @QL_NAME, "
|
|
|
- // + "`QL_KIND` = @QL_KIND, "
|
|
|
- // + "`QL_STATE` = @QL_STATE, "
|
|
|
- // + "`OUGUID` = @OUGUID, "
|
|
|
- // + "`QL_DEP` = @QL_DEP, "
|
|
|
- // + "`UPDATE_DATE` = @UPDATE_DATE, "
|
|
|
- // + "`APPLYERMIN_COUNT_DESC` = @APPLYERMIN_COUNT_DESC "
|
|
|
- // + " WHERE `ROWGUID` = @ROWGUID; ";
|
|
|
- //using (IDbConnection connection = GetDbConnection())
|
|
|
- //{
|
|
|
- // connection.Execute(sql, p);
|
|
|
- //}
|
|
|
+ string update = "update PowerMattersBase set QL_NAME=@QL_NAME, QL_DEP=@QL_DEP, QL_STATE=@QL_STATE where QL_INNER_CODE=@QL_INNER_CODE and OUGUID=@OUGUID;";
|
|
|
+ using (IDbConnection connection = GetDbConnection())
|
|
|
+ {
|
|
|
+ connection.Execute(update, p);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void Insert(PowerMattersBase p)
|
|
|
{
|
|
|
- //string sql = "INSERT INTO `powermettersbase`"
|
|
|
- // + "(`ROWGUID`, "
|
|
|
- // + "`QL_MAINITEM_ID`, "
|
|
|
- // + "`QL_SUBITEM_ID`, "
|
|
|
- // + "`QL_NAME`, "
|
|
|
- // + "`QL_KIND`, "
|
|
|
- // + "`QL_STATE`, "
|
|
|
- // + "`OUGUID`, "
|
|
|
- // + "`ShortName`, "
|
|
|
- // + "`QL_DEP`, "
|
|
|
- // + "`UPDATE_DATE`, "
|
|
|
- // + "`IsOnceRun`, "
|
|
|
- // + "`APPLYERMIN_COUNT_DESC`) "
|
|
|
- // + "VALUES"
|
|
|
- // + "(@ROWGUID, "
|
|
|
- // + "@QL_MAINITEM_ID, "
|
|
|
- // + "@QL_SUBITEM_ID, "
|
|
|
- // + "@QL_NAME, "
|
|
|
- // + "@QL_KIND, "
|
|
|
- // + "@QL_STATE, "
|
|
|
- // + "@OUGUID, "
|
|
|
- // + "@ShortName, "
|
|
|
- // + "@QL_DEP, "
|
|
|
- // + "@UPDATE_DATE, "
|
|
|
- // + "@IsOnceRun, "
|
|
|
- // + "@APPLYERMIN_COUNT_DESC); ";
|
|
|
- //using (IDbConnection connection = GetDbConnection())
|
|
|
- //{
|
|
|
- // connection.Execute(sql, p);
|
|
|
- //}
|
|
|
+ string insert = "insert PowerMattersBase(QL_NAME, QL_INNER_CODE, OUGUID, QL_DEP, QL_STATE) values(@QL_NAME, @QL_INNER_CODE, @OUGUID, @QL_DEP, @QL_STATE);";
|
|
|
+
|
|
|
+ using (IDbConnection connection = GetDbConnection())
|
|
|
+ {
|
|
|
+ connection.Execute(insert, p);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public bool IsOnceRun(string ql_inner_code)
|